csinva / imodels

Interpretable ML package 🔍 for concise, transparent, and accurate predictive modeling (sklearn-compatible).
https://csinva.io/imodels
MIT License
1.4k stars 124 forks source link

'FIGS' object has no attribute 'decision_function' #181

Closed davips closed 1 year ago

davips commented 1 year ago

When trying to perform a permutation_test_score from sklearn:

~/.cache/pypoetry/virtualenvs/germina-_FW2ScvW-py3.10/lib/python3.10/site-packages/imodels/tree/figs.py:491: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
  preds[i] = _predict_tree_single_point(root, X[i])
Traceback (most recent call last):
  File "~/.cache/pypoetry/virtualenvs/germina-_FW2ScvW-py3.10/lib/python3.10/site-packages/sklearn/metrics/_scorer.py", line 373, in _score
    y_pred = method_caller(clf, "decision_function", X)
  File "~/.cache/pypoetry/virtualenvs/germina-_FW2ScvW-py3.10/lib/python3.10/site-packages/sklearn/metrics/_scorer.py", line 73, in _cached_call
    return getattr(estimator, method)(*args, **kwargs)
AttributeError: 'FIGS' object has no attribute 'decision_function'. Did you mean: '_init_decision_function'?
davips commented 1 year ago

I've just realized I should probably be using FIGSClassifier instead of FIGS.