smarie/python-m5p

Can't run examples because lack of .fit() method

lccatala opened this issue · 2 comments

When running the example, I run into the following error

Traceback (most recent call last): File "/home/luis/Projects/toys/main.py", line 12, in <module> reg.fit(X, y) File "/home/luis/Projects/toys/.venv/lib/python3.10/site-packages/m5py/main.py", line 214, in fit super(M5Base, self).fit(X, y, sample_weight=sample_weight, check_input=check_input) AttributeError: 'super' object has no attribute 'fit'

It seems the class BaseDecisionTree doesn't have a fit() method, however replacing it with _fit() it seems to work. I'm not sure if I should simply replace it or if the class should inherit from something like DecisionTreeRegressor (which would necessitate changing the criterion).

Thanks for reporting this @lccatala ! Most probably this is a change due to a newer sklearn version. Could you please find out at which version this BaseDecisionTree.fit disappeared ? We'll then be able to implement a legacy-compliant PR to fix this.
Thanks!

Hi @smarie it seems it was in version 1.3
Version 1.2.2
Version 1.3.0

I've opened a PR with a quick fix, though I'm not sure if it's the best way of implementing it