简体   繁体   中英

R: Error training data in random forest regression model

I'm trying to train a regression random forest model for monthly time series data. However, when trying to run the following code

# Training the model
model_rf <- train(diff_gasp ~ ., data = diff_gas, method = "cforest",
              metric = "RMSE", trControl = ctrl, tuneGrid = grid_rf)

I get the error:

1 package is needed for this model and is not installed. (party). Would you like to try to install it now?
1: yes
2: no

Supposedly, train() is in the caret package which is already installed and imported. This error is not interactive... So I can't click or type "yes" and see what happens. I tried to install the package "party" but nothing seems to load.

What can I do?

Here's the link source to the data (non-differenced gas_data.csv and differenced diff_gas.csv ) where the last column (gas price) is the label and the remaining columns the features: https://drive.google.com/drive/folders/1R5-vVkgQLEpVaQkqq7k96O4nF_LJ1aqA?usp=sharing

I'd like to use a random forest regression model for forecasting and know about the most relevant features from the data to predict gas prices. Help in how to achieve this would be highly appreciated.

Installing caret will not install the modelling packages it can use to avoid filling up your hard drive with packages you don't use. You need to install them separately. In this case you need to run:

install.packages("party")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM