prediction_intervals¶
-
mastml.plot_helper.
prediction_intervals
(model, X, rf_error_method, rf_error_percentile, Xtrain, Xtest)[source]¶ Method to calculate prediction intervals when using Random Forest and Gaussian Process regression models.
Prediction intervals for random forest adapted from https://blog.datadive.net/prediction-intervals-for-random-forests/
Args:
model: (scikit-learn model/estimator object), a scikit-learn model object
X: (numpy array), array of X features
method: (str), type of error bar to formulate (e.g. “stdev” is standard deviation of predicted errors, “confint” is error bar as confidence interval
percentile: (int), percentile for which to form error bars
Returns:
err_up: (list), list of upper bounds of error bars for each data point
err_down: (list), list of lower bounds of error bars for each data point