Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regarding an error while executing handwriting recognition program #106

Open
sai-phani255 opened this issue Apr 8, 2020 · 0 comments
Open

Comments

@sai-phani255
Copy link

Madam...
train_files, rem_files, train_targets, rem_targets = train_test_split(
img_files, encoded_Y, train_size=0.66, random_state=52, shuffle= True)

validation_files, test_files, validation_targets, test_targets = train_test_split(
rem_files, rem_targets, train_size=0.5, random_state=22, shuffle=True)

print(train_files.shape, validation_files.shape, test_files.shape)
print(train_targets.shape, validation_targets.shape, test_targets.shape)

When I execute these four lines....Its showing the following error....

ValueError Traceback (most recent call last)
in
1 train_files, rem_files, train_targets, rem_targets = train_test_split(
----> 2 img_files, encoded_Y, train_size=0.66, random_state=52, shuffle=True)
3
4 validation_files, test_files, validation_targets, test_targets = train_test_split(
5 rem_files, rem_targets, train_size=0.5, random_state=22, shuffle=True)

~\Anaconda3\lib\site-packages\sklearn\model_selection_split.py in train_test_split(*arrays, **options)
2114 raise TypeError("Invalid parameters passed: %s" % str(options))
2115
-> 2116 arrays = indexable(*arrays)
2117
2118 n_samples = _num_samples(arrays[0])

~\Anaconda3\lib\site-packages\sklearn\utils\validation.py in indexable(*iterables)
235 else:
236 result.append(np.array(X))
--> 237 check_consistent_length(*result)
238 return result
239

~\Anaconda3\lib\site-packages\sklearn\utils\validation.py in check_consistent_length(*arrays)
210 if len(uniques) > 1:
211 raise ValueError("Found input variables with inconsistent numbers of"
--> 212 " samples: %r" % [int(l) for l in lengths])
213
214

ValueError: Found input variables with inconsistent numbers of samples: [4899, 0]

Could you please help me in solving this error...
Hope you will do the needful as early as possible..
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant