scikit-learn-contrib / forest-confidence-interval

Confidence intervals for scikit-learn forest algorithms
http://contrib.scikit-learn.org/forest-confidence-interval/
MIT License
284 stars 48 forks source link

Error with `random_forest_error` #60

Closed ericmjl closed 7 years ago

ericmjl commented 7 years ago

Submitting an error report here, just for record purposes.

With the following line:

pred_error = fci.random_forest_error(clf, X_train=X_train, X_test=X_test, inbag=None)

I get the following error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-60-79c18cb1c841> in <module>()
----> 1 pred_error = fci.random_forest_error(clf, X_train=X_train, X_test=X_test, inbag=None)

~/anaconda/envs/targetpred/lib/python3.6/site-packages/forestci/forestci.py in random_forest_error(forest, inbag, X_train, X_test)
    115     pred_centered = pred - pred_mean
    116     n_trees = forest.n_estimators
--> 117     V_IJ = _core_computation(X_train, X_test, inbag, pred_centered, n_trees)
    118     V_IJ_unbiased = _bias_correction(V_IJ, inbag, pred_centered, n_trees)
    119     return V_IJ_unbiased

~/anaconda/envs/targetpred/lib/python3.6/site-packages/forestci/forestci.py in _core_computation(X_train, X_test, inbag, pred_centered, n_trees)
     57 
     58     for t_idx in range(n_trees):
---> 59         inbag_r = (inbag[:, t_idx] - 1).reshape(-1, 1)
     60         pred_c_r = pred_centered.T[t_idx].reshape(1, -1)
     61         cov_hat += np.dot(inbag_r, pred_c_r) / n_trees

TypeError: 'NoneType' object is not subscriptable

I am using version 0.1.0, installed from pip.

I think a new release is required; after inspecting the source code, I'm seeing that inbag=None is no longer a required keyword argument (contrary to what my installed version is saying), and that inbag=None is handled correctly in the GitHub version (contrary to how my installed version is working).

arokem commented 7 years ago

Indeed. We are long overdue for a release.

We are still working on our JOSS paper, and we hope to make a release as soon as we have met all the requirements of the review there:

https://github.com/openjournals/joss-reviews/issues/124

On Tue, Nov 7, 2017 at 2:42 PM, Eric Ma notifications@github.com wrote:

Submitting an error report here, just for record purposes.

With the following line:

pred_error = fci.random_forest_error(clf, X_train=X_train, X_test=X_test, inbag=None)

I get the following error:


TypeError Traceback (most recent call last)

in () ----> 1 pred_error = fci.random_forest_error(clf, X_train=X_train, X_test=X_test, inbag=None) ~/anaconda/envs/targetpred/lib/python3.6/site-packages/forestci/forestci.py in random_forest_error(forest, inbag, X_train, X_test) 115 pred_centered = pred - pred_mean 116 n_trees = forest.n_estimators --> 117 V_IJ = _core_computation(X_train, X_test, inbag, pred_centered, n_trees) 118 V_IJ_unbiased = _bias_correction(V_IJ, inbag, pred_centered, n_trees) 119 return V_IJ_unbiased ~/anaconda/envs/targetpred/lib/python3.6/site-packages/forestci/forestci.py in _core_computation(X_train, X_test, inbag, pred_centered, n_trees) 57 58 for t_idx in range(n_trees): ---> 59 inbag_r = (inbag[:, t_idx] - 1).reshape(-1, 1) 60 pred_c_r = pred_centered.T[t_idx].reshape(1, -1) 61 cov_hat += np.dot(inbag_r, pred_c_r) / n_trees TypeError: 'NoneType' object is not subscriptable I am using version 0.1.0, installed from pip. I think a new release is required; after inspecting the source code, I'm seeing that inbag=None is no longer a required keyword argument (contrary to what my installed version is saying), and that inbag=None is handled correctly in the GitHub version (contrary to how my installed version is working). — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub , or mute the thread .
ericmjl commented 7 years ago

All the best on the review! :smile:

arokem commented 7 years ago

New release now out. Closing.