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

random_forest_error() takes exactly 4 arguments (3 given) #44

Closed ericgcoker closed 7 years ago

ericgcoker commented 7 years ago

I'm substituting my own Data into this but running this code and receiving the above titled error??

import numpy as np
from matplotlib import pyplot as plt
from sklearn.ensemble import RandomForestRegressor
import sklearn.cross_validation as xval
from sklearn.datasets.mldata import fetch_mldata
import forestci as fci

# create RandomForestRegressor
n_trees = 2000
mpg_forest = RandomForestRegressor(n_estimators=n_trees, random_state=42)
mpg_forest.fit(X, y)
mpg_y_hat = mpg_forest.predict(X2)

# calculate inbag and unbiased variance
mpg_inbag = fci.calc_inbag(X.shape[0], mpg_forest)
mpg_V_IJ_unbiased = fci.random_forest_error(mpg_forest, X,
                                            X2)

# Plot error bars for predicted MPG using unbiased variance
plt.errorbar(y2, mpg_y_hat, yerr=np.sqrt(mpg_V_IJ_unbiased), fmt='o')
plt.plot([5, 45], [5, 45], '--')
plt.xlabel('Reported MPG')
plt.ylabel('Predicted MPG')

TypeError: random_forest_error() takes exactly 4 arguments (3 given)

arokem commented 7 years ago

That's because of this: https://github.com/scikit-learn-contrib/forest-confidence-interval/issues/43

Use pip install git+git://github.com/scikit-learn-contrib/forest-confidence-interval.git to install directly from the current master branch