ibis-project / ibis-ml

IbisML is a library for building scalable ML pipelines using Ibis.
https://ibis-project.github.io/ibis-ml/
Apache License 2.0
96 stars 13 forks source link

AttributeError: 'list' object has no attribute 'fit_table' #137

Closed ianmcook closed 3 months ago

ianmcook commented 3 months ago

When I run this code:

import ibis
import ibis_ml as ml

con = ibis.connect("duckdb://nycflights13.ddb")
con.create_table(
    "flights", ibis.examples.nycflights13_flights.fetch().to_pyarrow(), overwrite=True
)
flights = con.table("flights")

recipe = ml.Recipe(
    [
        ml.ScaleStandard("distance")
    ]
)
recipe.fit(flights)

I get this error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/homebrew/anaconda3/lib/python3.11/site-packages/ibis_ml/core.py", line 562, in fit
    self._fit_table(table, targets, index)
  File "/opt/homebrew/anaconda3/lib/python3.11/site-packages/ibis_ml/core.py", line 511, in _fit_table
    step.fit_table(table, metadata)
    ^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'fit_table'
jcrist commented 3 months ago

The recipe constructor is variadic (it takes one or more steps as args, not a list of steps). You want:

recipe = ml.Recipe(
    ml.ScaleStandard("distance")
)
ianmcook commented 3 months ago

Aha, thanks! I got tripped up on this because in a very early version of IbisML, it took a list of steps.