Skip to content

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

@Abdou24MR

Description

@Abdou24MR

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions