Learn R Programming

BioM2 (version 1.1.1)

baseModel: 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
)

Value

The predicted output for the test data.

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.Currently only supports 'probability' for binary classification tasks.

classifier

Learners in mlr3

paramlist

Learner parameters search spaces

inner_folds

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

Author

Shunjie Zhang

Examples

Run this code
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


Run the code above in your browser using DataLab