baseModel {BioM2}R Documentation

Prediction by Machine Learning

Description

Prediction by Machine Learning with different learners ( From 'mlr3' )

Usage

baseModel(
  trainData,
  testData,
  predMode = "probability",
  classifier,
  paramlist = NULL,
  inner_folds = 10
)

Arguments

trainData

The input training dataset. The first column is the label or the output. For binary classes, 0 and 1 are used to indicate the class member.

testData

The input test dataset. The first column is the label or the output. For binary classes, 0 and 1 are used to indicate the class member.

predMode

The prediction mode. Available options are c('probability', 'classification').

classifier

Learners in mlr3

paramlist

Learner parameters

inner_folds

k-fold cross validation ( Only supported when testData = NULL )

Value

The predicted output for the test data.

Author(s)

Shunjie Zhang

Examples

library(mlr3verse)
library(caret)
library(BioM2)
data=MethylData_Test
set.seed(1)
part=unlist(createDataPartition(data$label,p=0.8))#Split data
predict=baseModel(trainData=data[part,1:10],
                 testData=data[-part,1:10],
                 classifier = 'svm')#Use 10 features to make predictions,Learner uses svm



[Package BioM2 version 1.0.8 Index]