Skip to content

TypeError: estimator should be an estimator implementing 'fit' method #19

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

Open
Abdou24MR opened this issue Apr 6, 2022 · 0 comments
Open

Comments

@Abdou24MR
Copy link

Abdou24MR commented Apr 6, 2022

code implementation

scores = cross_val_score(clf, X, y, cv=5, scoring='accuracy')

error message:

TypeError Traceback (most recent call last)
in
2 for clf, label in zip([elm1, elm2, elm3, elm4, elm5, elm6, elm7, elm8, elm9, elm10, eclf], labels):
3
--> 4 scores = cross_val_score(clf, X, y, cv=5, scoring='accuracy')
5 print("Accuracy: %0.2f (+/- %0.2f) [%s]" % (scores.mean(), scores.std(), label))

c:\users\e580\appdata\local\programs\python\python36\lib\site-packages\sklearn\utils\validation.py in inner_f(*args, **kwargs)
61 extra_args = len(args) - len(all_args)
62 if extra_args <= 0:
--> 63 return f(*args, **kwargs)
64
65 # extra_args > 0

c:\users\e580\appdata\local\programs\python\python36\lib\site-packages\sklearn\model_selection_validation.py in cross_val_score(estimator, X, y, groups, scoring, cv, n_jobs, verbose, fit_params, pre_dispatch, error_score)
441
442 # To ensure multimetric format is not supported
-> 443 scorer = check_scoring(estimator, scoring=scoring)
444
445 cv_results = cross_validate(estimator=estimator, X=X, y=y, groups=groups,

c:\users\e580\appdata\local\programs\python\python36\lib\site-packages\sklearn\utils\validation.py in inner_f(*args, **kwargs)
61 extra_args = len(args) - len(all_args)
62 if extra_args <= 0:
-> 63 return f(*args, **kwargs)
64
65 # extra_args > 0

c:\users\e580\appdata\local\programs\python\python36\lib\site-packages\sklearn\metrics_scorer.py in check_scoring(estimator, scoring, allow_none)
426 if not hasattr(estimator, 'fit'):
427 raise TypeError("estimator should be an estimator implementing "
-> 428 "'fit' method, %r was passed" % estimator)
429 if isinstance(scoring, str):
430 return get_scorer(scoring)

TypeError: estimator should be an estimator implementing 'fit' method, <elm.elmk.ELMKernel object at 0x000001E2CA30BEF0> was passed

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