View source: R/modelTrainingTuningFittingTesting.R
fit_and_evaluate_rf | R Documentation |
This function fits a Random Forest model using the provided hyperparameters and training data, then evaluates its performance on a validation set.
fit_and_evaluate_rf(
best_params,
X_train,
y_train,
X_val = NULL,
y_val = NULL,
save_path = NULL,
seed = 4
)
best_params |
A list of best hyperparameters obtained from hyperparameter tuning. |
X_train |
Training feature matrix. |
y_train |
Training target vector. |
X_val |
Validation feature matrix (optional). |
y_val |
Validation target vector (optional). |
save_path |
Optional path to save the trained model. |
seed |
Optional random seed. |
A list containing the trained model and, if testing or validation data is provided, the accuracy, f1, precision, recall and roc_auc scores on the testing or validation set.
fitting_results<-fit_and_evaluate_rf(tuning_results$best_params,processed_training_data$X_training_mat,processed_training_data$y_training_vector,processed_validation_data$X_validation_mat,processed_validation_data$y_validation_vector)
Print the fitting results, provides accuracy, f1 score, precision, recall and roc_auc scores on the model as fitted to the validation set
print(fitting_results)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.