You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
3 frames /usr/local/lib/python3.10/dist-packages/sklearn/utils/validation.py in _num_samples(x)
333 if hasattr(x, "shape") and x.shape is not None:
334 if len(x.shape) == 0:
--> 335 raise TypeError(
336 "Singleton array %r cannot be considered a valid collection." % x
337 )
TypeError: Singleton array array(<Flags(allows_duplicate_labels=True)>, dtype=object) cannot be considered a valid collection.
The text was updated successfully, but these errors were encountered:
I solved this problem by changing the way it accesses the target column.
In the file train.py, within the function 'perform_kfold_cv', change df.flags to df['flags']. The first returns the attribute of the dataframe, while the second accesses the data within the flags column
TypeError Traceback (most recent call last)
in <cell line: 1>()
----> 1 f1_per_fold = perform_kfold_cv(df, models, optims, criterion, k_folds, device=device, n_epochs=10)
3 frames
/usr/local/lib/python3.10/dist-packages/sklearn/utils/validation.py in _num_samples(x)
333 if hasattr(x, "shape") and x.shape is not None:
334 if len(x.shape) == 0:
--> 335 raise TypeError(
336 "Singleton array %r cannot be considered a valid collection." % x
337 )
TypeError: Singleton array array(<Flags(allows_duplicate_labels=True)>, dtype=object) cannot be considered a valid collection.
The text was updated successfully, but these errors were encountered: