View source: R/variable_selection.R
calculate.error | R Documentation |
Calculates errors by comparing predictions with the true values. For regression and probability mode, it will give root mean squared error (rmse) and pseudo R-squared (rsq). For classification mode, overall accuracy (acc), overall error (err), Matthews correlation coefficient (mcc), sensitivity (sens) and specificity (spec) are returned.
calculate.error(rf, true, test.set = NULL)
rf |
Object of class |
true |
vector with true value for each sample |
test.set |
matrix or data.frame of predictor variables for test set with variables in columns and samples in rows (Note: missing values are not allowed) |
numeric vector with two elements for regression and probability estimation (rmse, rsq) and five elements for classification (acc, err, mcc, sens, spec)
# simulate toy data set data = simulation.data.cor(no.samples = 100, group.size = rep(10, 6), no.var.total = 200) # random forest rf = wrapper.rf(x = data[, -1], y = data[, 1], type = "regression") # error calculate.error(rf = rf, true = data[, 1])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.