rulefit
rulefit copied to clipboard
ValueError in example_simulated.py
Hi, running example_simulated.py gives the following error:
/Users/navid/opt/anaconda3/envs/rulefit-venv/bin/python "/Users/navid/Google Drive/PhD/Repositories/XAI-2016/rulefit/example_simulated.py"
/Users/navid/opt/anaconda3/envs/rulefit-venv/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:472: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 0.4675243067167685, tolerance: 0.4523666850279077
tol, rng, random, positive)
/Users/navid/opt/anaconda3/envs/rulefit-venv/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:476: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 5.518840165506575, tolerance: 0.6706225710160342
positive)
Traceback (most recent call last):
File "/Users/navid/Google Drive/PhD/Repositories/XAI-2016/rulefit/example_simulated.py", line 25, in <module>
rf.fit(X.values, y)
File "/Users/navid/Google Drive/PhD/Repositories/XAI-2016/rulefit/rulefit/rulefit.py", line 398, in fit
self.tree_generator.fit(np.copy(X, order='C'), np.copy(y, order='C'))
File "/Users/navid/opt/anaconda3/envs/rulefit-venv/lib/python3.7/site-packages/sklearn/ensemble/_gb.py", line 1523, in fit
self.estimators_.shape[0]))
ValueError: n_estimators=1 must be larger or equal to estimators_.shape[0]=560 when warm_start==True
Got the same error, i try to disable warm_start = False but same problem! It happens when I run the model twice. The first time is ok than this error when i run the model again
I am also seeing this error. I re-ran everything and it works. Fine for my use case but tuning has become tedious.
When you run the RuleFit with any tree generator, after fitting the model, the value of the parameter n_estimators gets changed to 1, and hence we face this issue.
If you initialise the RuleFit again before fitting and specify n_estimators, it seems to work.