You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
predict method on DecisionTreeRegressor panics when tree is not fit #469
this will panic when tree_regressor is still None (when fit wasn't called prior to predict).
Propose to change the implementation to:
pubfnpredict(&self,x:&X) -> Result<Y,Failed>{match&self.tree_regressor{Some(tree) => tree.predict(x),None => Err(Failed::predict("'fit' should be called before calling 'predict'",)),}}
Similar changes can be made for many other classifiers.
If you want, I can create a PR for this (and all classifiers/regressors that have the same or similar issue).
Activity
Mec-iS commentedon Sep 28, 2026
Thanks. OK proceed.
slievens commentedon Sep 28, 2026
Pull request created.
Remaining issue:
decision_functiononSVCmight still panic. I did not know whether it was OK to use the existingFailed::predicthere.