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 name __cls__.lower() bug #212

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.

codecov[bot] commented 1 year ago

Codecov Report

Merging #212 (ffe8f2b) into julearn_sk_pandas (8f931db) will not change coverage. The diff coverage is 0.00%.

Impacted file tree graph

@@                Coverage Diff                @@
##           julearn_sk_pandas    #212   +/-   ##
=================================================
  Coverage               0.07%   0.07%           
=================================================
  Files                     34      34           
  Lines                   1324    1324           
=================================================
  Hits                       1       1           
  Misses                  1323    1323           
Flag Coverage Δ
docs 100.00% <ø> (ø)
junifer 0.00% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
julearn/pipeline/pipeline.py 0.00% <0.00%> (ø)