-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNK_Cell_Prediction.R
48 lines (36 loc) · 1.35 KB
/
NK_Cell_Prediction.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
library(caret)
library(skimr)
library(mlbench)
library(caretEnsemble)
NKcellDF <- read.csv('/home/srivastava/Documents/NK_Cells.csv')
head(NKcellDF, n=2)
summary(NKcellDF)
skimmed <- skim(NKcellDF)
skimmed
x <- ncol(NKcellDF)
dataset <- NKcellDF[,2:x]
dataset$Status <- factor(dataset$Status)
validation_index <- createDataPartition(dataset$Status,p=0.80, list=FALSE)
# select 20% of the data for validation
testSet<- dataset[-validation_index,]
# use the remaining 80% of data to training and testingthe models
trainSet <- dataset[validation_index,]
levels(factor(dataset$Status))
control <- trainControl(method="cv", number=10)
set.seed(7)
modelSvmradial <- train(Status~., data=dataset, method="svmRadial", trControl=control)
set.seed(7)
modelLvq <- train(Status~., data=dataset, method="lvq", trControl=control)
set.seed(7)
modelRF <- train(Status~., data=dataset, method="rf", trControl=control)
set.seed(7)
modelRda <- train(Status~., data=dataset, method="rda", trControl=control)
set.seed(7)
modelAda <- train(Status~., data=dataset, method="ada", trControl=control)
results <- resamples(list(ADA=modelLAda, LVQ=modelLvq, RF=modelRF, SVM=modelSvmradial, RDA=modelRda))
summary(results)
#generate the numbers from your models
dotplot(results)
predictions <- predict(models$Svm, testSet)
finalMatrix <- confusionMatrix(predictions, factor(testSet$class))
finalMatrix