Description Usage Arguments Details Value Examples
Plots the results of a fitted ssr object if a testset was provided when fitting the model.
1 2 |
x |
a fitted object of class "ssr". |
metric |
the type of metric to be plotted ("rmse", "mae", "cor"), defaults to "rmse". "cor" is for pearson correlation. |
ptype |
an integer specifying the type of plot. The default 1, plots the performance metric of the fitted model. Any value different of 1, plots the performance metric of the individual regressors used to build the model. |
... |
additional arguments to be passed to the plot function. |
This function generates performance plots to quickly inspect the results of the fitted model. The fitted model contains all the necessary data so the user can create custom plots, if required.
a NULL invisible object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | dataset <- friedman1 # Load dataset.
set.seed(1234)
# Prepare the data.
split1 <- split_train_test(dataset, pctTrain = 70)
split2 <- split_train_test(split1$trainset, pctTrain = 5)
L <- split2$trainset
U <- split2$testset[, -11]
testset <- split1$testset
regressors <- list(knn = caret::knnreg)
model <- ssr("Ytrue ~ .", L, U, regressors = regressors, testdata = testset, maxits = 10)
# Plot the RMSE of the fitted model.
plot(model, metric = "rmse", ptype = 1)
# Plot the MAE.
plot(model, metric = "mae", ptype = 1)
|
[1] "Initial RMSE on testdata: 0.1727"
[1] "Iteration 1 (testdata) RMSE: 0.1729 Improvement: -0.13%"
[1] "Iteration 2 (testdata) RMSE: 0.1699 Improvement: 1.61%"
[1] "Iteration 3 (testdata) RMSE: 0.1689 Improvement: 2.20%"
[1] "Iteration 4 (testdata) RMSE: 0.1629 Improvement: 5.69%"
[1] "Iteration 5 (testdata) RMSE: 0.1629 Improvement: 5.65%"
[1] "Iteration 6 (testdata) RMSE: 0.1638 Improvement: 5.12%"
[1] "Iteration 7 (testdata) RMSE: 0.1638 Improvement: 5.13%"
[1] "Iteration 8 (testdata) RMSE: 0.1641 Improvement: 5.00%"
[1] "Iteration 9 (testdata) RMSE: 0.1635 Improvement: 5.32%"
[1] "Iteration 10 (testdata) RMSE: 0.1627 Improvement: 5.78%"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.