juaml / julearn

Forschungszentrum Jülich Machine Learning Library
https://juaml.github.io/julearn
GNU Affero General Public License v3.0
30 stars 19 forks source link

Fix/pipeline name cls #211

Closed LeSasse closed 1 year ago

LeSasse commented 1 year ago

The PipelineCreator seems to fail when using a scikitlearn estimator object. The simple example:

from julearn.pipeline import PipelineCreator
from sklearn.kernel_ridge import KernelRidge

creator = PipelineCreator(problem_type="regression", apply_to="*").add(
    KernelRidge()
)

results in:

Traceback (most recent call last):
  File "cls_bug.py", line 4, in <module>
    creator = PipelineCreator(problem_type="regression", apply_to="*").add(
  File "/home/leonard/projects/julearn_hackathon/julearn/julearn/pipeline/pipeline.py", line 125, in add
    name = step if isinstance(step, str) else step.__cls__.lower()
AttributeError: 'KernelRidge' object has no attribute '__cls__'

I believe this is intended to be the class.name attribute? With the applied change it works.