I continue to run into errors when run any form of quantile forest models with the prediction and quantile phases. I am following this example but with my own X and y. I have trained many a random forest and other derivations of tree models with this dataset, so I'm fairly certain it's not the input data issue.
https://github.com/zillow/quantile-forest
And have created an environment that supposedly follows all the installation requirements. I can provide my list of versions upon request. Time and time again, the RandomForestQuantileRegressor
will work, but when I want to plot and see the quantiles, I get the error
**"TypeError: predict() got an unexpected keyword argument 'quantiles'" **
Here is an example when I set up the environment:
Collecting quantile-forest Downloading quantile_forest-1.1.2-cp310-cp310-macosx_10_9_x86_64.whl (188 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 188.6/188.6 kB 2.7 MB/s eta 0:00:00 Requirement already satisfied: numpy>=1.23 in ./opt/anaconda3/envs/uq_rf/lib/python3.10/site-packages (from quantile-forest) (1.24.3) Requirement already satisfied: scipy>=1.4 in ./opt/anaconda3/envs/uq_rf/lib/python3.10/site-packages (from quantile-forest) (1.10.1) Requirement already satisfied: scikit-learn>=1.0 in ./opt/anaconda3/envs/uq_rf/lib/python3.10/site-packages (from quantile-forest) (1.2.2) Requirement already satisfied: joblib>=1.1.1 in ./opt/anaconda3/envs/uq_rf/lib/python3.10/site-packages (from scikit-learn>=1.0->quantile-forest) (1.2.0) Requirement already satisfied: threadpoolctl>=2.0.0 in ./opt/anaconda3/envs/uq_rf/lib/python3.10/site-packages (from scikit-learn>=1.0->quantile-forest) (3.1.0) Installing collected packages: quantile-forest Successfully installed quantile-forest-1.1.2
This code works:
X_train, X_test, y_train, y_test = train_test_split(features, labels, train_size=0.5, random_state=0)
qrf = RandomForestQuantileRegressor(q=[0.05, 0.50, 0.95])
qrf.fit(X_train, y_train)
y_pred_5, y_pred_median, y_pred_95 = qrf.predict(X_test)
qrf.score(X_test, y_test)
But I cannot get any code that calls "predict" where I specify the quantiles to work without that type error.