View source: R/ranger_reg_plot.R
calc_rel_predicted | R Documentation |
Calculate the relative predicted values to the spline fit.
calc_rel_predicted( train_y, predicted_train_y, train_SampleIDs = NULL, test_y = NULL, predicted_test_y = NULL, test_SampleIDs = NULL, train_prefix = "train", test_prefix = "test", train_target_field = "y", test_target_field = "y", outdir = NULL )
train_y |
The numeric labels for training data. |
predicted_train_y |
The predicted values for training data. |
train_SampleIDs |
The sample ids in the train data. |
test_y |
The numeric labels for testing data. |
predicted_test_y |
The predicted values for test data. |
test_SampleIDs |
The sample ids in the test data. |
train_prefix |
The prefix for the dataset in the training data. |
test_prefix |
The prefix for the dataset in the testing data. |
train_target_field |
A string indicating the target field of the training metadata for regression. |
test_target_field |
A string indicating the target field of the testing metadata for regression. |
outdir |
The output directory. |
Shi Huang
set.seed(123) train_x <- data.frame(rbind(t(rmultinom(7, 75, c(.201,.5,.02,.18,.099))), t(rmultinom(8, 75, c(.201,.4,.12,.18,.099))), t(rmultinom(15, 75, c(.011,.3,.22,.18,.289))), t(rmultinom(15, 75, c(.091,.2,.32,.18,.209))), t(rmultinom(15, 75, c(.001,.1,.42,.18,.299))))) train_y<- 1:60 test_x <- data.frame(rbind(t(rmultinom(7, 75, c(.201,.5,.02,.18,.099))), t(rmultinom(8, 75, c(.201,.4,.12,.18,.099))), t(rmultinom(15, 75, c(.011,.3,.22,.18,.289))), t(rmultinom(15, 75, c(.091,.2,.32,.18,.209))))) test_y<- 1:45 train_rf_model<-rf.out.of.bag(train_x, train_y) predicted_test_y<-predict(train_rf_model$rf.model, test_x)$predictions calc_rel_predicted(train_y, predicted_train_y=train_rf_model$predicted) calc_rel_predicted(train_y=train_y, predicted_train_y=train_rf_model$predicted, #train_SampleIDs=as.character(1:60), test_y=test_y, predicted_test_y=predicted_test_y, #test_SampleIDs=as.character(1:45), train_target_field="y", test_target_field="test_y", outdir=NULL) calc_rel_predicted(train_y=train_y, predicted_train_y=train_rf_model$predicted, train_SampleIDs=as.character(1:60), test_y=test_y, predicted_test_y=predicted_test_y, test_SampleIDs=as.character(1:45), train_target_field="y", test_target_field="test_y", outdir=NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.