-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathr1.R
More file actions
41 lines (25 loc) · 819 Bytes
/
r1.R
File metadata and controls
41 lines (25 loc) · 819 Bytes
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
library("Biobase")
library("ALL")
library("genefilter")
data("ALL")
library("MLInterfaces")
moltyp = which(as.character(ALL$mol.biol)
%in% c("NEG", "BCR/ABL"))
ALL_bcrneg = ALL[, moltyp]
ALL_bcrneg$mol.biol = factor(ALL_bcrneg$mol.biol)
Negs = which(ALL_bcrneg$mol.biol == "NEG")
Bcr = which(ALL_bcrneg$mol.biol == "BCR/ABL")
S1 = sample(Negs, 45, replace=FALSE)
S2 = sample(Bcr, 25, replace = FALSE)
TrainInd = c(S1, S2)
TestInd = setdiff(0:110, TrainInd)
Traintt = rowttests(ALL_bcrneg[, TrainInd], "mol.biol")
ordTT = order(abs(Traintt$statistic), decreasing=TRUE)
fNtt = featureNames(ALL_bcrneg)[ordTT[1:50]]
BNf = ALL_bcrneg[fNtt,]
knnf = MLearn( mol.biol ~ ., data=BNf, .method=knnI(1,0),
TrainInd)
confuMat(knnf)
cfKNN = confuMat(knnf)
(cfKNN[1,2] + cfKNN[2,1])/sum(cfKNN)
confuMat(knnf)