Description Usage Arguments Value Examples
View source: R/machinelearning.R
Train a model and predict new unlabeled samples with that model.
1 2 3 4 | train_and_predict(dataset, new.samples, column.class, model,
validation, num.folds = 10, num.repeats = 10, tunelength = 10,
tunegrid = NULL, metric = NULL, summary.function =
defaultSummary)
|
dataset |
list representing the dataset from a metabolomics experiment. |
new.samples |
dataframe with new samples to predict the class label. |
column.class |
metadata column class. |
model |
model to be used in training. |
validation |
validation method. |
num.folds |
number of folds in cross validation. |
num.repeats |
number of repeats. |
tunelength |
number of levels for each tuning parameters. |
tunegrid |
dataframe with possible tuning values. |
metric |
metric used to evaluate the model's performance. Can be "Accuracy" or "ROC". |
summary.function |
summary function. For "ROC" the multiClassSummary function must be used. |
Returns a list with the training result and the predictions result.
1 2 3 4 5 | ## Example of training and predicting
library(specmine.datasets)
data(cachexia)
result = train_and_predict(cachexia, new.samples = cachexia$data,
"Muscle.loss", "pls", "cv")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.