priya-dwivedi/Deep-Learning

Regarding an error while executing handwriting recognition program

sai-phani255 opened this issue · 0 comments

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.