Functions for making predictions and performing simulations using trained SCA and SCE models. The package provides both S3 methods and direct function calls for various prediction scenarios.
# S3 method for SCA
predict(object, newdata, ...)# S3 method for SCE
predict(object, newdata, ...)
Model_simulation(model, Testing_data)
SCA_tree_predict(model, Testing_data)
SCE_Prediction(X_sample, model)
OOB_validation(model)
For S3 methods:
predict.SCA()
: A matrix of predicted values for the predictant variables
predict.SCE()
: A list containing Training, Validation, and Testing predictions
For direct functions:
Model_simulation()
: A list containing three components:
Training: Predictions for the training dataset
Validation: Out-of-bag (OOB) predictions
Testing: Predictions for the testing dataset
SCA_tree_predict()
: A list containing predictions for the test data
SCE_Prediction()
: A matrix containing ensemble predictions for each predictant
OOB_validation()
: A data.frame containing OOB predictions for each predictant
An object for which predictions should be made.
A data.frame or matrix containing new data for prediction. Must contain the same predictor variables as used in training.
A trained model object:
For Model_simulation
: SCE model object (S3 class "SCE")
For SCA_tree_predict
: SCA model object (S3 class "SCA")
For SCE_Prediction
: SCE model object (S3 class "SCE")
For OOB_validation
: SCE model object (S3 class "SCE")
A data.frame or matrix comprising the data that will be used to test the model. Must contain all the predictors used in the model. Must not contain missing values.
A data.frame or matrix containing the predictor variables for which predictions are to be made. Must contain all predictors used in model training.
Additional arguments passed to methods.
Kailong Li <lkl98509509@gmail.com>
Prediction Methods:
predict.SCA()
: S3 method for single SCA trees (calls SCA_tree_predict
)
predict.SCE()
: S3 method for SCE ensembles (calls Model_simulation
)
Model_simulation()
: Comprehensive simulation for SCE models with training, validation, and testing predictions
SCA_tree_predict()
: Direct function for single SCA tree predictions
SCE_Prediction()
: Direct function for SCE ensemble predictions
OOB_validation()
: Internal function for calculating out-of-bag predictions
Prediction Process:
For SCA models:
Input validation (data types, missing values, predictor matching)
Data preparation (conversion to matrix format)
Tree traversal and prediction using leaf node mappings
For SCE models:
Input validation (data types, missing values, predictor matching)
Data preparation (conversion to matrix format)
Training predictions using all trees
Out-of-bag predictions using trees not trained on each sample
Testing predictions using all trees
Weighting predictions based on tree weights
Out-of-Bag (OOB) Validation:
OOB predictions are made using only trees that did not use a particular observation during training
Provides unbiased estimate of model performance
Used internally by Model_simulation
for validation predictions
Input Validation: All functions perform comprehensive validation:
Data type and structure checks (data.frame or matrix)
Missing value checks
Predictor matching with training data
Numeric data validation
Li, Kailong, Guohe Huang, and Brian Baetz. "Development of a Wilks feature importance method with improved variable rankings for supporting hydrological inference and modelling." Hydrology and Earth System Sciences 25.9 (2021): 4947-4966.
SCA
, SCE