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

how to solve this error? thanks #2

Open
zzzhmy opened this issue Jan 6, 2024 · 4 comments
Open

how to solve this error? thanks #2

zzzhmy opened this issue Jan 6, 2024 · 4 comments

Comments

@zzzhmy
Copy link

zzzhmy commented Jan 6, 2024

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.

@zzzhmy
Copy link
Author

zzzhmy commented Jan 10, 2024

it's solved,thanks

@zzk1212
Copy link

zzk1212 commented Mar 29, 2024

解决了,谢谢

你好,我碰到了同样的问题,请问您是如何解决的?谢谢

@yeqian1961
Copy link

it's solved,thanks
I meet the same question, could you let me know what you solve the problem?

@Tisandg
Copy link

Tisandg commented Jun 20, 2024

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

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

4 participants