train_and_predict: Train and predict

Description Usage Arguments Value Examples

View source: R/machinelearning.R

Description

Train a model and predict new unlabeled samples with that model.

Usage

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)

Arguments

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.

Value

Returns a list with the training result and the predictions result.

Examples

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")

specmine documentation built on Sept. 21, 2021, 5:06 p.m.