SlideShare a Scribd company logo
Bootstrap Aggregation-LooCV-naiveBayes file:///E:/users/rkannan/cuny/fall2020/fall2020/m11-bagging-loocv/baggi...
1 of 11 11/23/2020, 5:39 PM
library('e1071')
file<-'c://Users/rk215/Data/heart.csv'
heart<-read.csv(file,head=T,sep=',',stringsAsFactors=F)
head(heart)
## age sex cp trestbps chol fbs restecg thalach exang oldpeak slope ca tha
l
## 1 63 1 3 145 233 1 0 150 0 2.3 0 0
1
## 2 37 1 2 130 250 0 1 187 0 3.5 0 0
2
## 3 41 0 1 130 204 0 0 172 0 1.4 2 0
2
## 4 56 1 1 120 236 0 1 178 0 0.8 2 0
2
## 5 57 0 0 120 354 0 1 163 1 0.6 2 0
2
## 6 57 1 0 140 192 0 1 148 0 0.4 1 0
1
## target
## 1 1
## 2 1
## 3 1
## 4 1
## 5 1
## 6 1
catheart<-heart[,c(2,3,6,7,9,11,12,13,14)]
set.seed(43)
trdidx<-sample(1:nrow(catheart),0.7*nrow(catheart),replace=F)
trcatheart<-catheart[trdidx,]
tstcatheart<-catheart[-trdidx,]
nb.model<-naiveBayes(target~.,data=trcatheart)
#str(nb.model)
object.size(nb.model) #11096
## 11096 bytes
nb.tstpred<-predict(nb.model,tstcatheart[,-c(9)],type='raw')
nb.tstclass<-unlist(apply(round(nb.tstpred),1,which.max))-1
nb.tbl<-table(tstcatheart[[9]], nb.tstclass)
nb.cfm<-caret::confusionMatrix(nb.tbl)
nb.cfm
Bootstrap Aggregation-LooCV-naiveBayes file:///E:/users/rkannan/cuny/fall2020/fall2020/m11-bagging-loocv/baggi...
2 of 11 11/23/2020, 5:39 PM
## Confusion Matrix and Statistics
##
## nb.tstclass
## 0 1
## 0 28 12
## 1 3 48
##
## Accuracy : 0.8352
## 95% CI : (0.7427, 0.9047)
## No Information Rate : 0.6593
## P-Value [Acc > NIR] : 0.0001482
##
## Kappa : 0.6571
##
## Mcnemar's Test P-Value : 0.0388671
##
## Sensitivity : 0.9032
## Specificity : 0.8000
## Pos Pred Value : 0.7000
## Neg Pred Value : 0.9412
## Prevalence : 0.3407
## Detection Rate : 0.3077
## Detection Prevalence : 0.4396
## Balanced Accuracy : 0.8516
##
## 'Positive' Class : 0
##
start_tm <- proc.time()
df<-trcatheart
runModel<-function(df) {naiveBayes(target~.,data=df[sample(1:nrow(df),nrow(d
f),replace=T),])}
lapplyrunmodel<-function(x)runModel(df)
system.time(models<-lapply(1:100,lapplyrunmodel))
## user system elapsed
## 0.32 0.02 0.33
object.size(models)
## 1110448 bytes
end_tm<-proc.time()
print(paste("time taken to run 100 bootstrapps",(end_tm-start_tm),sep=":"))
Bootstrap Aggregation-LooCV-naiveBayes file:///E:/users/rkannan/cuny/fall2020/fall2020/m11-bagging-loocv/baggi...
3 of 11 11/23/2020, 5:39 PM
## [1] "time taken to run 100 bootstrapps:0.46"
## [2] "time taken to run 100 bootstrapps:0.02"
## [3] "time taken to run 100 bootstrapps:0.47"
## [4] "time taken to run 100 bootstrapps:NA"
## [5] "time taken to run 100 bootstrapps:NA"
bagging_preds<-lapply(models,FUN=function(M,D=tstcatheart[,-c(9)])predict(M,
D,type='raw'))
bagging_cfm<-lapply(bagging_preds,FUN=function(P,A=tstcatheart[[9]])
{pred_class<-unlist(apply(round(P),1,which.max))-1
pred_tbl<-table(A,pred_class)
pred_cfm<-caret::confusionMatrix(pred_tbl)
pred_cfm
})
bagging.perf<-as.data.frame(do.call('rbind',lapply(bagging_cfm,FUN=function
(cfm)c(cfm$overall,cfm$byClass))))
bagging.perf.mean<-apply(bagging.perf[bagging.perf$AccuracyPValue<0.01,-c(6:
7)],2,mean)
bagging.perf.var<-apply(bagging.perf[bagging.perf$AccuracyPValue<0.01,-c(6:
7)],2,sd)
bagging.perf.var
## Accuracy Kappa AccuracyLower
## 0.01618750 0.03355331 0.01846838
## AccuracyUpper AccuracyNull Sensitivity
## 0.01273569 0.01795716 0.03073122
## Specificity Pos Pred Value Neg Pred Value
## 0.01470108 0.02693220 0.02200582
## Precision Recall F1
## 0.02693220 0.03073122 0.02087685
## Prevalence Detection Rate Detection Prevalence
## 0.01795716 0.01183833 0.00000000
## Balanced Accuracy
## 0.01875328
bagging.perf.mean
Bootstrap Aggregation-LooCV-naiveBayes file:///E:/users/rkannan/cuny/fall2020/fall2020/m11-bagging-loocv/baggi...
4 of 11 11/23/2020, 5:39 PM
## Accuracy Kappa AccuracyLower
## 0.8323565 0.6521225 0.7396540
## AccuracyUpper AccuracyNull Sensitivity
## 0.9023711 0.6496947 0.8891540
## Specificity Pos Pred Value Neg Pred Value
## 0.8025070 0.7077778 0.9300654
## Precision Recall F1
## 0.7077778 0.8891540 0.7876655
## Prevalence Detection Rate Detection Prevalence
## 0.3503053 0.3111111 0.4395604
## Balanced Accuracy
## 0.8458305
(bagging_tm<-proc.time()-start_tm)
## user system elapsed
## 2.35 0.02 2.36
N<-nrow(trcatheart)
cv_df<-do.call('rbind',lapply(1:N,FUN=function(idx,data=trcatheart) { # For
each observation
m<-naiveBayes(target~.,data=data[-idx,]) # train with ALL other observatio
ns
p<-predict(m,data[idx,-c(9)],type='raw') # predict that one observation
# NB returns the probabilities of the classes, as per Bayesian Classifie
r,we take the classs with the higher probability
pc<-unlist(apply(round(p),1,which.max))-1 # -1 to make class to be 0 or
1, which.max returns 1 or 2
#pred_tbl<-table(data[idx,c(9)],pc)
#pred_cfm<-caret::confusionMatrix(pred_tbl)
list(fold=idx,m=m,predicted=pc,actual=data[idx,c(9)]) # store the idx, mod
el, predicted class and actual class
}
))
cv_df<-as.data.frame(cv_df)
head(cv_df)
Bootstrap Aggregation-LooCV-naiveBayes file:///E:/users/rkannan/cuny/fall2020/fall2020/m11-bagging-loocv/baggi...
5 of 11 11/23/2020, 5:39 PM
## fold
## 1 1
## 2 2
## 3 3
## 4 4
## 5 5
## 6 6
##
m
## 1 98, 113, 0.8061224, 0.5840708, 0.3973667, 0.4950769, 0.4387755, 1.35398
2, 0.8623431, 0.9535681, 0.1428571, 0.1327434, 0.3517262, 0.3408085, 0.43877
55, 0.6106195, 0.5385419, 0.5076843, 0.5510204, 0.1769912, 0.4999474, 0.3833
613, 1.132653, 1.530973, 0.5493718, 0.6277909, 1.285714, 0.3539823, 1.03545
4, 0.8856026, 2.581633, 2.123894, 0.6568194, 0.4842657, TRUE, TRUE, TRUE, TR
UE, TRUE, TRUE, TRUE, TRUE, naiveBayes.default(x = X, y = Y, laplace = lapla
ce)
## 2 97, 114, 0.8041237, 0.5789474, 0.3989354, 0.4959078, 0.443299, 1.
342105, 0.8656533, 0.9577716, 0.1443299, 0.1315789, 0.3532495, 0.3395249, 0.
443299, 0.6052632, 0.5394649, 0.5086582, 0.5463918, 0.1754386, 0.5004294, 0.
382021, 1.123711, 1.526316, 0.5450102, 0.6269822, 1.278351, 0.3508772, 1.038
25, 0.8822984, 2.57732, 2.122807, 0.658835, 0.4822578, TRUE, TRUE, TRUE, TRU
E, TRUE, TRUE, TRUE, TRUE, naiveBayes.default(x = X, y = Y, laplace = laplac
e)
## 3 97, 114, 0.8041237, 0.5789474, 0.3989354, 0.4959078, 0.443299, 1.
342105, 0.8656533, 0.9577716, 0.1443299, 0.1315789, 0.3532495, 0.3395249, 0.
443299, 0.6052632, 0.5394649, 0.5086582, 0.5463918, 0.1754386, 0.5004294, 0.
382021, 1.14433, 1.526316, 0.5398628, 0.6269822, 1.298969, 0.3508772, 1.0324
42, 0.8822984, 2.57732, 2.122807, 0.658835, 0.4822578, TRUE, TRUE, TRUE, TRU
E, TRUE, TRUE, TRUE, TRUE, naiveBayes.default(x = X, y = Y, laplace = laplac
e)
## 4 98, 113, 0.8061224, 0.5752212, 0.3973667, 0.4965112, 0.4387755, 1.33628
3, 0.8623431, 0.9600095, 0.1428571, 0.1327434, 0.3517262, 0.3408085, 0.43877
55, 0.6017699, 0.5385419, 0.5095485, 0.5510204, 0.1769912, 0.4999474, 0.3833
613, 1.132653, 1.522124, 0.5493718, 0.6281683, 1.285714, 0.3539823, 1.03545
4, 0.8856026, 2.581633, 2.123894, 0.6568194, 0.4842657, TRUE, TRUE, TRUE, TR
UE, TRUE, TRUE, TRUE, TRUE, naiveBayes.default(x = X, y = Y, laplace = lapla
ce)
## 5 98, 113, 0.8061224, 0.5840708, 0.3973667, 0.4950769, 0.4387755, 1.35398
2, 0.8623431, 0.9535681, 0.1428571, 0.1327434, 0.3517262, 0.3408085, 0.43877
55, 0.6017699, 0.5385419, 0.5095485, 0.5510204, 0.1769912, 0.4999474, 0.3833
613, 1.132653, 1.522124, 0.5493718, 0.6281683, 1.285714, 0.3539823, 1.03545
4, 0.8856026, 2.581633, 2.123894, 0.6568194, 0.4842657, TRUE, TRUE, TRUE, TR
UE, TRUE, TRUE, TRUE, TRUE, naiveBayes.default(x = X, y = Y, laplace = lapla
ce)
## 6 97, 114, 0.814433, 0.5789474, 0.3907764, 0.4959078, 0.443299, 1.
342105, 0.8656533, 0.9577716, 0.1340206, 0.1315789, 0.3424442, 0.3395249, 0.
4329897, 0.6052632, 0.5382691, 0.5086582, 0.5463918, 0.1754386, 0.5004294,
0.382021, 1.134021, 1.526316, 0.552058, 0.6269822, 1.278351, 0.3508772, 1.03
825, 0.8822984, 2.57732, 2.122807, 0.658835, 0.4822578, TRUE, TRUE, TRUE, TR
UE, TRUE, TRUE, TRUE, TRUE, naiveBayes.default(x = X, y = Y, laplace = lapla
Bootstrap Aggregation-LooCV-naiveBayes file:///E:/users/rkannan/cuny/fall2020/fall2020/m11-bagging-loocv/baggi...
6 of 11 11/23/2020, 5:39 PM
ce)
## predicted actual
## 1 1 1
## 2 0 0
## 3 0 0
## 4 1 1
## 5 1 1
## 6 0 0
tail(cv_df)
Bootstrap Aggregation-LooCV-naiveBayes file:///E:/users/rkannan/cuny/fall2020/fall2020/m11-bagging-loocv/baggi...
7 of 11 11/23/2020, 5:39 PM
## fold
## 207 207
## 208 208
## 209 209
## 210 210
## 211 211
## 212 212
##
m
## 207 98, 113, 0.8061224, 0.5840708, 0.3973667, 0.4950769, 0.4387755, 1.336
283, 0.8623431, 0.9600095, 0.1428571, 0.1238938, 0.3517262, 0.3309279, 0.438
7755, 0.6017699, 0.5385419, 0.5095485, 0.5510204, 0.1769912, 0.4999474, 0.38
33613, 1.132653, 1.522124, 0.5493718, 0.6281683, 1.285714, 0.3539823, 1.0354
54, 0.8856026, 2.581633, 2.123894, 0.6568194, 0.4842657, TRUE, TRUE, TRUE, T
RUE, TRUE, TRUE, TRUE, TRUE, naiveBayes.default(x = X, y = Y, laplace = lapl
ace)
## 208 98, 113, 0.8061224, 0.5752212, 0.3973667, 0.4965112, 0.4387755, 1.345
133, 0.8623431, 0.9614898, 0.1428571, 0.1238938, 0.3517262, 0.3309279, 0.438
7755, 0.6106195, 0.5385419, 0.5076843, 0.5510204, 0.1769912, 0.4999474, 0.38
33613, 1.132653, 1.522124, 0.5493718, 0.6281683, 1.285714, 0.3539823, 1.0354
54, 0.8856026, 2.581633, 2.123894, 0.6568194, 0.4842657, TRUE, TRUE, TRUE, T
RUE, TRUE, TRUE, TRUE, TRUE, naiveBayes.default(x = X, y = Y, laplace = lapl
ace)
## 209 98, 113, 0.8061224, 0.5752212, 0.3973667, 0.4965112, 0.4387755, 1.353
982, 0.8623431, 0.9535681, 0.1428571, 0.1327434, 0.3517262, 0.3408085, 0.438
7755, 0.6017699, 0.5385419, 0.5095485, 0.5510204, 0.1769912, 0.4999474, 0.38
33613, 1.132653, 1.522124, 0.5493718, 0.6281683, 1.285714, 0.3539823, 1.0354
54, 0.8856026, 2.581633, 2.123894, 0.6568194, 0.4842657, TRUE, TRUE, TRUE, T
RUE, TRUE, TRUE, TRUE, TRUE, naiveBayes.default(x = X, y = Y, laplace = lapl
ace)
## 210 98, 113, 0.8061224, 0.5840708, 0.3973667, 0.4950769, 0.4387755, 1.345
133, 0.8623431, 0.9614898, 0.1428571, 0.1238938, 0.3517262, 0.3309279, 0.438
7755, 0.6106195, 0.5385419, 0.5076843, 0.5510204, 0.1681416, 0.4999474, 0.37
56579, 1.132653, 1.522124, 0.5493718, 0.6281683, 1.285714, 0.3451327, 1.0354
54, 0.8840846, 2.581633, 2.123894, 0.6568194, 0.4842657, TRUE, TRUE, TRUE, T
RUE, TRUE, TRUE, TRUE, TRUE, naiveBayes.default(x = X, y = Y, laplace = lapl
ace)
## 211 97, 114, 0.8041237, 0.5789474, 0.3989354, 0.4959078, 0.443299,
1.342105, 0.8656533, 0.9577716, 0.1443299, 0.1315789, 0.3532495, 0.3395249,
0.4329897, 0.6052632, 0.5382691, 0.5086582, 0.5463918, 0.1754386, 0.5004294,
0.382021, 1.134021, 1.526316, 0.552058, 0.6269822, 1.28866, 0.3508772, 1.040
42, 0.8822984, 2.57732, 2.122807, 0.658835, 0.4822578, TRUE, TRUE, TRUE, TRU
E, TRUE, TRUE, TRUE, TRUE, naiveBayes.default(x = X, y = Y, laplace = laplac
e)
## 212 98, 113, 0.8061224, 0.5840708, 0.3973667, 0.4950769, 0.4387755, 1.345
133, 0.8623431, 0.9614898, 0.1428571, 0.1327434, 0.3517262, 0.3408085, 0.438
7755, 0.6106195, 0.5385419, 0.5076843, 0.5510204, 0.1769912, 0.4999474, 0.38
33613, 1.132653, 1.522124, 0.5493718, 0.6281683, 1.285714, 0.3539823, 1.0354
54, 0.8856026, 2.581633, 2.123894, 0.6568194, 0.4842657, TRUE, TRUE, TRUE, T
RUE, TRUE, TRUE, TRUE, TRUE, naiveBayes.default(x = X, y = Y, laplace = lapl
Bootstrap Aggregation-LooCV-naiveBayes file:///E:/users/rkannan/cuny/fall2020/fall2020/m11-bagging-loocv/baggi...
8 of 11 11/23/2020, 5:39 PM
ace)
## predicted actual
## 207 1 1
## 208 1 1
## 209 1 1
## 210 1 1
## 211 0 0
## 212 1 1
table(as.numeric(cv_df$actual)==as.numeric(cv_df$predicted))
##
## FALSE TRUE
## 34 178
loocv_tbl<-table(as.numeric(cv_df$actual),as.numeric(cv_df$predicted))
sum(diag(loocv_tbl))/sum(loocv_tbl)
## [1] 0.8396226
(loocv_caret_cfm<-caret::confusionMatrix(loocv_tbl))
Bootstrap Aggregation-LooCV-naiveBayes file:///E:/users/rkannan/cuny/fall2020/fall2020/m11-bagging-loocv/baggi...
9 of 11 11/23/2020, 5:39 PM
## Confusion Matrix and Statistics
##
##
## 0 1
## 0 79 19
## 1 15 99
##
## Accuracy : 0.8396
## 95% CI : (0.7832, 0.8863)
## No Information Rate : 0.5566
## P-Value [Acc > NIR] : <2e-16
##
## Kappa : 0.6765
##
## Mcnemar's Test P-Value : 0.6069
##
## Sensitivity : 0.8404
## Specificity : 0.8390
## Pos Pred Value : 0.8061
## Neg Pred Value : 0.8684
## Prevalence : 0.4434
## Detection Rate : 0.3726
## Detection Prevalence : 0.4623
## Balanced Accuracy : 0.8397
##
## 'Positive' Class : 0
##
# now we have to apply the training models to testdata and average them
# since this is classification we will take the majority vote
# double loop
tstcv.perf<-as.data.frame(do.call('cbind',lapply(cv_df$m,FUN=function(m,data
=tstcatheart)
{
v<-predict(m,data[,-c(9)],type='raw')
lbllist<-unlist(apply(round(v),1,which.max))-1
}
)))
np<-ncol(tstcv.perf)
predclass<-unlist(apply(tstcv.perf,1,FUN=function(v){ ifelse(sum(v[2:length
(v)])/np<0.5,0,1)}))
loocvtbl<-table(tstcatheart[,c(9)],predclass)
(loocv_cfm<-caret::confusionMatrix(loocvtbl))
Bootstrap Aggregation-LooCV-naiveBayes file:///E:/users/rkannan/cuny/fall2020/fall2020/m11-bagging-loocv/baggi...
10 of 11 11/23/2020, 5:39 PM
## Confusion Matrix and Statistics
##
## predclass
## 0 1
## 0 28 12
## 1 3 48
##
## Accuracy : 0.8352
## 95% CI : (0.7427, 0.9047)
## No Information Rate : 0.6593
## P-Value [Acc > NIR] : 0.0001482
##
## Kappa : 0.6571
##
## Mcnemar's Test P-Value : 0.0388671
##
## Sensitivity : 0.9032
## Specificity : 0.8000
## Pos Pred Value : 0.7000
## Neg Pred Value : 0.9412
## Prevalence : 0.3407
## Detection Rate : 0.3077
## Detection Prevalence : 0.4396
## Balanced Accuracy : 0.8516
##
## 'Positive' Class : 0
##
print(paste('Bagging:',bagging.perf.mean[1]))
## [1] "Bagging: 0.832356532356532"
print(paste('LOO-CV:',loocv_cfm$overall[1]))
## [1] "LOO-CV: 0.835164835164835"
print(paste('Base NB',nb.cfm$overall[[1]]))
## [1] "Base NB 0.835164835164835"
Bootstrap Aggregation-LooCV-naiveBayes file:///E:/users/rkannan/cuny/fall2020/fall2020/m11-bagging-loocv/baggi...
11 of 11 11/23/2020, 5:39 PM

More Related Content

What's hot

Gevent rabbit rpc
Gevent rabbit rpcGevent rabbit rpc
Gevent rabbit rpc
Aleksandr Mokrov
 
Angle debug
Angle debugAngle debug
Angle debug
anshuk0805
 
Data manipulation and visualization in r 20190711 myanmarucsy
Data manipulation and visualization in r 20190711 myanmarucsyData manipulation and visualization in r 20190711 myanmarucsy
Data manipulation and visualization in r 20190711 myanmarucsy
SmartHinJ
 
Bytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreterBytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreter
akaptur
 
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
akaptur
 
Parallel Computing With Dask - PyDays 2017
Parallel Computing With Dask - PyDays 2017Parallel Computing With Dask - PyDays 2017
Parallel Computing With Dask - PyDays 2017
Christian Aichinger
 
Cooking pies with Celery
Cooking pies with CeleryCooking pies with Celery
Cooking pies with Celery
Aleksandr Mokrov
 
System Calls
System CallsSystem Calls
System Calls
David Evans
 
python高级内存管理
python高级内存管理python高级内存管理
python高级内存管理
rfyiamcool
 
Sangam 19 - Successful Applications on Autonomous
Sangam 19 - Successful Applications on AutonomousSangam 19 - Successful Applications on Autonomous
Sangam 19 - Successful Applications on Autonomous
Connor McDonald
 
Sangam 19 - PLSQL still the coolest
Sangam 19 - PLSQL still the coolestSangam 19 - PLSQL still the coolest
Sangam 19 - PLSQL still the coolest
Connor McDonald
 
Python testing-frameworks overview
Python testing-frameworks overviewPython testing-frameworks overview
Python testing-frameworks overview
Jachym Cepicky
 
Detection of errors and potential vulnerabilities in C and C++ code using the...
Detection of errors and potential vulnerabilities in C and C++ code using the...Detection of errors and potential vulnerabilities in C and C++ code using the...
Detection of errors and potential vulnerabilities in C and C++ code using the...
Andrey Karpov
 
Simple Ways To Be A Better Programmer (OSCON 2007)
Simple Ways To Be A Better Programmer (OSCON 2007)Simple Ways To Be A Better Programmer (OSCON 2007)
Simple Ways To Be A Better Programmer (OSCON 2007)
Michael Schwern
 
ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説
ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説
ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説
Masatoshi Tada
 
Quick reference for solr
Quick reference for solrQuick reference for solr
Quick reference for solr
Rajkumar Asohan, PMP
 
Playing 44CON CTF for fun and profit
Playing 44CON CTF for fun and profitPlaying 44CON CTF for fun and profit
Playing 44CON CTF for fun and profit
44CON
 
PostgreSQL Procedural Languages: Tips, Tricks and Gotchas
PostgreSQL Procedural Languages: Tips, Tricks and GotchasPostgreSQL Procedural Languages: Tips, Tricks and Gotchas
PostgreSQL Procedural Languages: Tips, Tricks and Gotchas
Jim Mlodgenski
 
Agile Database Development with JSON
Agile Database Development with JSONAgile Database Development with JSON
Agile Database Development with JSON
Chris Saxon
 
Spring Data JPAによるデータアクセス徹底入門 #jsug
Spring Data JPAによるデータアクセス徹底入門 #jsugSpring Data JPAによるデータアクセス徹底入門 #jsug
Spring Data JPAによるデータアクセス徹底入門 #jsug
Masatoshi Tada
 

What's hot (20)

Gevent rabbit rpc
Gevent rabbit rpcGevent rabbit rpc
Gevent rabbit rpc
 
Angle debug
Angle debugAngle debug
Angle debug
 
Data manipulation and visualization in r 20190711 myanmarucsy
Data manipulation and visualization in r 20190711 myanmarucsyData manipulation and visualization in r 20190711 myanmarucsy
Data manipulation and visualization in r 20190711 myanmarucsy
 
Bytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreterBytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreter
 
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
 
Parallel Computing With Dask - PyDays 2017
Parallel Computing With Dask - PyDays 2017Parallel Computing With Dask - PyDays 2017
Parallel Computing With Dask - PyDays 2017
 
Cooking pies with Celery
Cooking pies with CeleryCooking pies with Celery
Cooking pies with Celery
 
System Calls
System CallsSystem Calls
System Calls
 
python高级内存管理
python高级内存管理python高级内存管理
python高级内存管理
 
Sangam 19 - Successful Applications on Autonomous
Sangam 19 - Successful Applications on AutonomousSangam 19 - Successful Applications on Autonomous
Sangam 19 - Successful Applications on Autonomous
 
Sangam 19 - PLSQL still the coolest
Sangam 19 - PLSQL still the coolestSangam 19 - PLSQL still the coolest
Sangam 19 - PLSQL still the coolest
 
Python testing-frameworks overview
Python testing-frameworks overviewPython testing-frameworks overview
Python testing-frameworks overview
 
Detection of errors and potential vulnerabilities in C and C++ code using the...
Detection of errors and potential vulnerabilities in C and C++ code using the...Detection of errors and potential vulnerabilities in C and C++ code using the...
Detection of errors and potential vulnerabilities in C and C++ code using the...
 
Simple Ways To Be A Better Programmer (OSCON 2007)
Simple Ways To Be A Better Programmer (OSCON 2007)Simple Ways To Be A Better Programmer (OSCON 2007)
Simple Ways To Be A Better Programmer (OSCON 2007)
 
ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説
ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説
ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説
 
Quick reference for solr
Quick reference for solrQuick reference for solr
Quick reference for solr
 
Playing 44CON CTF for fun and profit
Playing 44CON CTF for fun and profitPlaying 44CON CTF for fun and profit
Playing 44CON CTF for fun and profit
 
PostgreSQL Procedural Languages: Tips, Tricks and Gotchas
PostgreSQL Procedural Languages: Tips, Tricks and GotchasPostgreSQL Procedural Languages: Tips, Tricks and Gotchas
PostgreSQL Procedural Languages: Tips, Tricks and Gotchas
 
Agile Database Development with JSON
Agile Database Development with JSONAgile Database Development with JSON
Agile Database Development with JSON
 
Spring Data JPAによるデータアクセス徹底入門 #jsug
Spring Data JPAによるデータアクセス徹底入門 #jsugSpring Data JPAによるデータアクセス徹底入門 #jsug
Spring Data JPAによるデータアクセス徹底入門 #jsug
 

Similar to M11 bagging loo cv

Beyond PHP - it's not (just) about the code
Beyond PHP - it's not (just) about the codeBeyond PHP - it's not (just) about the code
Beyond PHP - it's not (just) about the code
Wim Godden
 
Seaborn graphing present
Seaborn graphing presentSeaborn graphing present
Seaborn graphing present
Yilin Zeng
 
Rooted 2010 ppp
Rooted 2010 pppRooted 2010 ppp
Rooted 2010 ppp
noc_313
 
Танки_в_Лунапарке: нагрузочное_тестирование_в_Яндексе
Танки_в_Лунапарке: нагрузочное_тестирование_в_ЯндексеТанки_в_Лунапарке: нагрузочное_тестирование_в_Яндексе
Танки_в_Лунапарке: нагрузочное_тестирование_в_Яндексе
Yandex
 
Beyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the codeBeyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the code
Wim Godden
 
Webinar: The Whys and Hows of Predictive Modelling
Webinar: The Whys and Hows of Predictive Modelling Webinar: The Whys and Hows of Predictive Modelling
Webinar: The Whys and Hows of Predictive Modelling
Edureka!
 
Getting more out of Matplotlib with GR
Getting more out of Matplotlib with GRGetting more out of Matplotlib with GR
Getting more out of Matplotlib with GR
Josef Heinen
 
מערכות לומדות תרגול 3 עצים
מערכות לומדות תרגול 3 עציםמערכות לומדות תרגול 3 עצים
מערכות לומדות תרגול 3 עצים
Igor Kleiner
 
Easy HTML Tables in RStudio with Tabyl and kableExtra
Easy HTML Tables in RStudio with Tabyl and kableExtraEasy HTML Tables in RStudio with Tabyl and kableExtra
Easy HTML Tables in RStudio with Tabyl and kableExtra
Barry DeCicco
 
Regression and Classification with R
Regression and Classification with RRegression and Classification with R
Regression and Classification with R
Yanchang Zhao
 
SDPHP - Percona Toolkit (It's Basically Magic)
SDPHP - Percona Toolkit (It's Basically Magic)SDPHP - Percona Toolkit (It's Basically Magic)
SDPHP - Percona Toolkit (It's Basically Magic)
Robert Swisher
 
make simple neural network python
make simple neural network pythonmake simple neural network python
make simple neural network python
아르떼소피
 
Nyc open data project ii -- predict where to get and return my citibike
Nyc open data project ii -- predict where to get and return my citibikeNyc open data project ii -- predict where to get and return my citibike
Nyc open data project ii -- predict where to get and return my citibike
Vivian S. Zhang
 
Itsecteam shell
Itsecteam shellItsecteam shell
Itsecteam shell
ady36
 
JQuery Flot
JQuery FlotJQuery Flot
JQuery Flot
Arshavski Alexander
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
Wim Godden
 
Beyond PHP - it's not (just) about the code
Beyond PHP - it's not (just) about the codeBeyond PHP - it's not (just) about the code
Beyond PHP - it's not (just) about the code
Wim Godden
 
Spark DataFrames for Data Munging
Spark DataFrames for Data MungingSpark DataFrames for Data Munging
Spark DataFrames for Data Munging
(Susan) Xinh Huynh
 
Using the following code Install Packages pip install .pdf
Using the following code Install Packages   pip install .pdfUsing the following code Install Packages   pip install .pdf
Using the following code Install Packages pip install .pdf
picscamshoppe
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
Wim Godden
 

Similar to M11 bagging loo cv (20)

Beyond PHP - it's not (just) about the code
Beyond PHP - it's not (just) about the codeBeyond PHP - it's not (just) about the code
Beyond PHP - it's not (just) about the code
 
Seaborn graphing present
Seaborn graphing presentSeaborn graphing present
Seaborn graphing present
 
Rooted 2010 ppp
Rooted 2010 pppRooted 2010 ppp
Rooted 2010 ppp
 
Танки_в_Лунапарке: нагрузочное_тестирование_в_Яндексе
Танки_в_Лунапарке: нагрузочное_тестирование_в_ЯндексеТанки_в_Лунапарке: нагрузочное_тестирование_в_Яндексе
Танки_в_Лунапарке: нагрузочное_тестирование_в_Яндексе
 
Beyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the codeBeyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the code
 
Webinar: The Whys and Hows of Predictive Modelling
Webinar: The Whys and Hows of Predictive Modelling Webinar: The Whys and Hows of Predictive Modelling
Webinar: The Whys and Hows of Predictive Modelling
 
Getting more out of Matplotlib with GR
Getting more out of Matplotlib with GRGetting more out of Matplotlib with GR
Getting more out of Matplotlib with GR
 
מערכות לומדות תרגול 3 עצים
מערכות לומדות תרגול 3 עציםמערכות לומדות תרגול 3 עצים
מערכות לומדות תרגול 3 עצים
 
Easy HTML Tables in RStudio with Tabyl and kableExtra
Easy HTML Tables in RStudio with Tabyl and kableExtraEasy HTML Tables in RStudio with Tabyl and kableExtra
Easy HTML Tables in RStudio with Tabyl and kableExtra
 
Regression and Classification with R
Regression and Classification with RRegression and Classification with R
Regression and Classification with R
 
SDPHP - Percona Toolkit (It's Basically Magic)
SDPHP - Percona Toolkit (It's Basically Magic)SDPHP - Percona Toolkit (It's Basically Magic)
SDPHP - Percona Toolkit (It's Basically Magic)
 
make simple neural network python
make simple neural network pythonmake simple neural network python
make simple neural network python
 
Nyc open data project ii -- predict where to get and return my citibike
Nyc open data project ii -- predict where to get and return my citibikeNyc open data project ii -- predict where to get and return my citibike
Nyc open data project ii -- predict where to get and return my citibike
 
Itsecteam shell
Itsecteam shellItsecteam shell
Itsecteam shell
 
JQuery Flot
JQuery FlotJQuery Flot
JQuery Flot
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
Beyond PHP - it's not (just) about the code
Beyond PHP - it's not (just) about the codeBeyond PHP - it's not (just) about the code
Beyond PHP - it's not (just) about the code
 
Spark DataFrames for Data Munging
Spark DataFrames for Data MungingSpark DataFrames for Data Munging
Spark DataFrames for Data Munging
 
Using the following code Install Packages pip install .pdf
Using the following code Install Packages   pip install .pdfUsing the following code Install Packages   pip install .pdf
Using the following code Install Packages pip install .pdf
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 

More from Raman Kannan

Essays on-civic-responsibilty
Essays on-civic-responsibiltyEssays on-civic-responsibilty
Essays on-civic-responsibilty
Raman Kannan
 
M12 boosting-part02
M12 boosting-part02M12 boosting-part02
M12 boosting-part02
Raman Kannan
 
M10 gradient descent
M10 gradient descentM10 gradient descent
M10 gradient descent
Raman Kannan
 
M06 tree
M06 treeM06 tree
M06 tree
Raman Kannan
 
M07 svm
M07 svmM07 svm
M07 svm
Raman Kannan
 
M08 BiasVarianceTradeoff
M08 BiasVarianceTradeoffM08 BiasVarianceTradeoff
M08 BiasVarianceTradeoff
Raman Kannan
 
Chapter 05 k nn
Chapter 05 k nnChapter 05 k nn
Chapter 05 k nn
Raman Kannan
 
Chapter 04-discriminant analysis
Chapter 04-discriminant analysisChapter 04-discriminant analysis
Chapter 04-discriminant analysis
Raman Kannan
 
M03 nb-02
M03 nb-02M03 nb-02
M03 nb-02
Raman Kannan
 
Augmented 11022020-ieee
Augmented 11022020-ieeeAugmented 11022020-ieee
Augmented 11022020-ieee
Raman Kannan
 
Chapter 02-logistic regression
Chapter 02-logistic regressionChapter 02-logistic regression
Chapter 02-logistic regression
Raman Kannan
 
Chapter01 introductory handbook
Chapter01 introductory handbookChapter01 introductory handbook
Chapter01 introductory handbook
Raman Kannan
 
A voyage-inward-02
A voyage-inward-02A voyage-inward-02
A voyage-inward-02
Raman Kannan
 
Evaluating classifierperformance ml-cs6923
Evaluating classifierperformance ml-cs6923Evaluating classifierperformance ml-cs6923
Evaluating classifierperformance ml-cs6923
Raman Kannan
 
A data scientist's study plan
A data scientist's study planA data scientist's study plan
A data scientist's study plan
Raman Kannan
 
Cognitive Assistants
Cognitive AssistantsCognitive Assistants
Cognitive Assistants
Raman Kannan
 
Essay on-data-analysis
Essay on-data-analysisEssay on-data-analysis
Essay on-data-analysis
Raman Kannan
 
Joy of Unix
Joy of UnixJoy of Unix
Joy of Unix
Raman Kannan
 
How to-run-ols-diagnostics-02
How to-run-ols-diagnostics-02How to-run-ols-diagnostics-02
How to-run-ols-diagnostics-02
Raman Kannan
 
Sdr dodd frankbirdseyeview
Sdr dodd frankbirdseyeviewSdr dodd frankbirdseyeview
Sdr dodd frankbirdseyeview
Raman Kannan
 

More from Raman Kannan (20)

Essays on-civic-responsibilty
Essays on-civic-responsibiltyEssays on-civic-responsibilty
Essays on-civic-responsibilty
 
M12 boosting-part02
M12 boosting-part02M12 boosting-part02
M12 boosting-part02
 
M10 gradient descent
M10 gradient descentM10 gradient descent
M10 gradient descent
 
M06 tree
M06 treeM06 tree
M06 tree
 
M07 svm
M07 svmM07 svm
M07 svm
 
M08 BiasVarianceTradeoff
M08 BiasVarianceTradeoffM08 BiasVarianceTradeoff
M08 BiasVarianceTradeoff
 
Chapter 05 k nn
Chapter 05 k nnChapter 05 k nn
Chapter 05 k nn
 
Chapter 04-discriminant analysis
Chapter 04-discriminant analysisChapter 04-discriminant analysis
Chapter 04-discriminant analysis
 
M03 nb-02
M03 nb-02M03 nb-02
M03 nb-02
 
Augmented 11022020-ieee
Augmented 11022020-ieeeAugmented 11022020-ieee
Augmented 11022020-ieee
 
Chapter 02-logistic regression
Chapter 02-logistic regressionChapter 02-logistic regression
Chapter 02-logistic regression
 
Chapter01 introductory handbook
Chapter01 introductory handbookChapter01 introductory handbook
Chapter01 introductory handbook
 
A voyage-inward-02
A voyage-inward-02A voyage-inward-02
A voyage-inward-02
 
Evaluating classifierperformance ml-cs6923
Evaluating classifierperformance ml-cs6923Evaluating classifierperformance ml-cs6923
Evaluating classifierperformance ml-cs6923
 
A data scientist's study plan
A data scientist's study planA data scientist's study plan
A data scientist's study plan
 
Cognitive Assistants
Cognitive AssistantsCognitive Assistants
Cognitive Assistants
 
Essay on-data-analysis
Essay on-data-analysisEssay on-data-analysis
Essay on-data-analysis
 
Joy of Unix
Joy of UnixJoy of Unix
Joy of Unix
 
How to-run-ols-diagnostics-02
How to-run-ols-diagnostics-02How to-run-ols-diagnostics-02
How to-run-ols-diagnostics-02
 
Sdr dodd frankbirdseyeview
Sdr dodd frankbirdseyeviewSdr dodd frankbirdseyeview
Sdr dodd frankbirdseyeview
 

Recently uploaded

一比一原版美国帕森斯设计学院毕业证(parsons毕业证书)如何办理
一比一原版美国帕森斯设计学院毕业证(parsons毕业证书)如何办理一比一原版美国帕森斯设计学院毕业证(parsons毕业证书)如何办理
一比一原版美国帕森斯设计学院毕业证(parsons毕业证书)如何办理
asyed10
 
一比一原版多伦多大学毕业证(UofT毕业证书)学历如何办理
一比一原版多伦多大学毕业证(UofT毕业证书)学历如何办理一比一原版多伦多大学毕业证(UofT毕业证书)学历如何办理
一比一原版多伦多大学毕业证(UofT毕业证书)学历如何办理
eoxhsaa
 
How To Control IO Usage using Resource Manager
How To Control IO Usage using Resource ManagerHow To Control IO Usage using Resource Manager
How To Control IO Usage using Resource Manager
Alireza Kamrani
 
REUSE-SCHOOL-DATA-INTEGRATED-SYSTEMS.pptx
REUSE-SCHOOL-DATA-INTEGRATED-SYSTEMS.pptxREUSE-SCHOOL-DATA-INTEGRATED-SYSTEMS.pptx
REUSE-SCHOOL-DATA-INTEGRATED-SYSTEMS.pptx
KiriakiENikolaidou
 
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
xclpvhuk
 
一比一原版南昆士兰大学毕业证如何办理
一比一原版南昆士兰大学毕业证如何办理一比一原版南昆士兰大学毕业证如何办理
一比一原版南昆士兰大学毕业证如何办理
ugydym
 
社内勉強会資料_Hallucination of LLMs               .
社内勉強会資料_Hallucination of LLMs               .社内勉強会資料_Hallucination of LLMs               .
社内勉強会資料_Hallucination of LLMs               .
NABLAS株式会社
 
一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理
一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理
一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理
uevausa
 
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
nyvan3
 
一比一原版(Sheffield毕业证书)谢菲尔德大学毕业证如何办理
一比一原版(Sheffield毕业证书)谢菲尔德大学毕业证如何办理一比一原版(Sheffield毕业证书)谢菲尔德大学毕业证如何办理
一比一原版(Sheffield毕业证书)谢菲尔德大学毕业证如何办理
1tyxnjpia
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
aqzctr7x
 
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
ytypuem
 
一比一原版格里菲斯大学毕业证(Griffith毕业证书)学历如何办理
一比一原版格里菲斯大学毕业证(Griffith毕业证书)学历如何办理一比一原版格里菲斯大学毕业证(Griffith毕业证书)学历如何办理
一比一原版格里菲斯大学毕业证(Griffith毕业证书)学历如何办理
lzdvtmy8
 
一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理
一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理
一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理
hyfjgavov
 
Jio cinema Retention & Engagement Strategy.pdf
Jio cinema Retention & Engagement Strategy.pdfJio cinema Retention & Engagement Strategy.pdf
Jio cinema Retention & Engagement Strategy.pdf
inaya7568
 
Template xxxxxxxx ssssssssssss Sertifikat.pptx
Template xxxxxxxx ssssssssssss Sertifikat.pptxTemplate xxxxxxxx ssssssssssss Sertifikat.pptx
Template xxxxxxxx ssssssssssss Sertifikat.pptx
TeukuEriSyahputra
 
一比一原版(uom毕业证书)曼彻斯特大学毕业证如何办理
一比一原版(uom毕业证书)曼彻斯特大学毕业证如何办理一比一原版(uom毕业证书)曼彻斯特大学毕业证如何办理
一比一原版(uom毕业证书)曼彻斯特大学毕业证如何办理
osoyvvf
 
Cell The Unit of Life for NEET Multiple Choice Questions.docx
Cell The Unit of Life for NEET Multiple Choice Questions.docxCell The Unit of Life for NEET Multiple Choice Questions.docx
Cell The Unit of Life for NEET Multiple Choice Questions.docx
vasanthatpuram
 
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docxDATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
SaffaIbrahim1
 
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
aguty
 

Recently uploaded (20)

一比一原版美国帕森斯设计学院毕业证(parsons毕业证书)如何办理
一比一原版美国帕森斯设计学院毕业证(parsons毕业证书)如何办理一比一原版美国帕森斯设计学院毕业证(parsons毕业证书)如何办理
一比一原版美国帕森斯设计学院毕业证(parsons毕业证书)如何办理
 
一比一原版多伦多大学毕业证(UofT毕业证书)学历如何办理
一比一原版多伦多大学毕业证(UofT毕业证书)学历如何办理一比一原版多伦多大学毕业证(UofT毕业证书)学历如何办理
一比一原版多伦多大学毕业证(UofT毕业证书)学历如何办理
 
How To Control IO Usage using Resource Manager
How To Control IO Usage using Resource ManagerHow To Control IO Usage using Resource Manager
How To Control IO Usage using Resource Manager
 
REUSE-SCHOOL-DATA-INTEGRATED-SYSTEMS.pptx
REUSE-SCHOOL-DATA-INTEGRATED-SYSTEMS.pptxREUSE-SCHOOL-DATA-INTEGRATED-SYSTEMS.pptx
REUSE-SCHOOL-DATA-INTEGRATED-SYSTEMS.pptx
 
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
一比一原版(Unimelb毕业证书)墨尔本大学毕业证如何办理
 
一比一原版南昆士兰大学毕业证如何办理
一比一原版南昆士兰大学毕业证如何办理一比一原版南昆士兰大学毕业证如何办理
一比一原版南昆士兰大学毕业证如何办理
 
社内勉強会資料_Hallucination of LLMs               .
社内勉強会資料_Hallucination of LLMs               .社内勉強会資料_Hallucination of LLMs               .
社内勉強会資料_Hallucination of LLMs               .
 
一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理
一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理
一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理
 
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
 
一比一原版(Sheffield毕业证书)谢菲尔德大学毕业证如何办理
一比一原版(Sheffield毕业证书)谢菲尔德大学毕业证如何办理一比一原版(Sheffield毕业证书)谢菲尔德大学毕业证如何办理
一比一原版(Sheffield毕业证书)谢菲尔德大学毕业证如何办理
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
 
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
 
一比一原版格里菲斯大学毕业证(Griffith毕业证书)学历如何办理
一比一原版格里菲斯大学毕业证(Griffith毕业证书)学历如何办理一比一原版格里菲斯大学毕业证(Griffith毕业证书)学历如何办理
一比一原版格里菲斯大学毕业证(Griffith毕业证书)学历如何办理
 
一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理
一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理
一比一原版兰加拉学院毕业证(Langara毕业证书)学历如何办理
 
Jio cinema Retention & Engagement Strategy.pdf
Jio cinema Retention & Engagement Strategy.pdfJio cinema Retention & Engagement Strategy.pdf
Jio cinema Retention & Engagement Strategy.pdf
 
Template xxxxxxxx ssssssssssss Sertifikat.pptx
Template xxxxxxxx ssssssssssss Sertifikat.pptxTemplate xxxxxxxx ssssssssssss Sertifikat.pptx
Template xxxxxxxx ssssssssssss Sertifikat.pptx
 
一比一原版(uom毕业证书)曼彻斯特大学毕业证如何办理
一比一原版(uom毕业证书)曼彻斯特大学毕业证如何办理一比一原版(uom毕业证书)曼彻斯特大学毕业证如何办理
一比一原版(uom毕业证书)曼彻斯特大学毕业证如何办理
 
Cell The Unit of Life for NEET Multiple Choice Questions.docx
Cell The Unit of Life for NEET Multiple Choice Questions.docxCell The Unit of Life for NEET Multiple Choice Questions.docx
Cell The Unit of Life for NEET Multiple Choice Questions.docx
 
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docxDATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
 
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
 

M11 bagging loo cv

  • 2. library('e1071') file<-'c://Users/rk215/Data/heart.csv' heart<-read.csv(file,head=T,sep=',',stringsAsFactors=F) head(heart) ## age sex cp trestbps chol fbs restecg thalach exang oldpeak slope ca tha l ## 1 63 1 3 145 233 1 0 150 0 2.3 0 0 1 ## 2 37 1 2 130 250 0 1 187 0 3.5 0 0 2 ## 3 41 0 1 130 204 0 0 172 0 1.4 2 0 2 ## 4 56 1 1 120 236 0 1 178 0 0.8 2 0 2 ## 5 57 0 0 120 354 0 1 163 1 0.6 2 0 2 ## 6 57 1 0 140 192 0 1 148 0 0.4 1 0 1 ## target ## 1 1 ## 2 1 ## 3 1 ## 4 1 ## 5 1 ## 6 1 catheart<-heart[,c(2,3,6,7,9,11,12,13,14)] set.seed(43) trdidx<-sample(1:nrow(catheart),0.7*nrow(catheart),replace=F) trcatheart<-catheart[trdidx,] tstcatheart<-catheart[-trdidx,] nb.model<-naiveBayes(target~.,data=trcatheart) #str(nb.model) object.size(nb.model) #11096 ## 11096 bytes nb.tstpred<-predict(nb.model,tstcatheart[,-c(9)],type='raw') nb.tstclass<-unlist(apply(round(nb.tstpred),1,which.max))-1 nb.tbl<-table(tstcatheart[[9]], nb.tstclass) nb.cfm<-caret::confusionMatrix(nb.tbl) nb.cfm Bootstrap Aggregation-LooCV-naiveBayes file:///E:/users/rkannan/cuny/fall2020/fall2020/m11-bagging-loocv/baggi... 2 of 11 11/23/2020, 5:39 PM
  • 3. ## Confusion Matrix and Statistics ## ## nb.tstclass ## 0 1 ## 0 28 12 ## 1 3 48 ## ## Accuracy : 0.8352 ## 95% CI : (0.7427, 0.9047) ## No Information Rate : 0.6593 ## P-Value [Acc > NIR] : 0.0001482 ## ## Kappa : 0.6571 ## ## Mcnemar's Test P-Value : 0.0388671 ## ## Sensitivity : 0.9032 ## Specificity : 0.8000 ## Pos Pred Value : 0.7000 ## Neg Pred Value : 0.9412 ## Prevalence : 0.3407 ## Detection Rate : 0.3077 ## Detection Prevalence : 0.4396 ## Balanced Accuracy : 0.8516 ## ## 'Positive' Class : 0 ## start_tm <- proc.time() df<-trcatheart runModel<-function(df) {naiveBayes(target~.,data=df[sample(1:nrow(df),nrow(d f),replace=T),])} lapplyrunmodel<-function(x)runModel(df) system.time(models<-lapply(1:100,lapplyrunmodel)) ## user system elapsed ## 0.32 0.02 0.33 object.size(models) ## 1110448 bytes end_tm<-proc.time() print(paste("time taken to run 100 bootstrapps",(end_tm-start_tm),sep=":")) Bootstrap Aggregation-LooCV-naiveBayes file:///E:/users/rkannan/cuny/fall2020/fall2020/m11-bagging-loocv/baggi... 3 of 11 11/23/2020, 5:39 PM
  • 4. ## [1] "time taken to run 100 bootstrapps:0.46" ## [2] "time taken to run 100 bootstrapps:0.02" ## [3] "time taken to run 100 bootstrapps:0.47" ## [4] "time taken to run 100 bootstrapps:NA" ## [5] "time taken to run 100 bootstrapps:NA" bagging_preds<-lapply(models,FUN=function(M,D=tstcatheart[,-c(9)])predict(M, D,type='raw')) bagging_cfm<-lapply(bagging_preds,FUN=function(P,A=tstcatheart[[9]]) {pred_class<-unlist(apply(round(P),1,which.max))-1 pred_tbl<-table(A,pred_class) pred_cfm<-caret::confusionMatrix(pred_tbl) pred_cfm }) bagging.perf<-as.data.frame(do.call('rbind',lapply(bagging_cfm,FUN=function (cfm)c(cfm$overall,cfm$byClass)))) bagging.perf.mean<-apply(bagging.perf[bagging.perf$AccuracyPValue<0.01,-c(6: 7)],2,mean) bagging.perf.var<-apply(bagging.perf[bagging.perf$AccuracyPValue<0.01,-c(6: 7)],2,sd) bagging.perf.var ## Accuracy Kappa AccuracyLower ## 0.01618750 0.03355331 0.01846838 ## AccuracyUpper AccuracyNull Sensitivity ## 0.01273569 0.01795716 0.03073122 ## Specificity Pos Pred Value Neg Pred Value ## 0.01470108 0.02693220 0.02200582 ## Precision Recall F1 ## 0.02693220 0.03073122 0.02087685 ## Prevalence Detection Rate Detection Prevalence ## 0.01795716 0.01183833 0.00000000 ## Balanced Accuracy ## 0.01875328 bagging.perf.mean Bootstrap Aggregation-LooCV-naiveBayes file:///E:/users/rkannan/cuny/fall2020/fall2020/m11-bagging-loocv/baggi... 4 of 11 11/23/2020, 5:39 PM
  • 5. ## Accuracy Kappa AccuracyLower ## 0.8323565 0.6521225 0.7396540 ## AccuracyUpper AccuracyNull Sensitivity ## 0.9023711 0.6496947 0.8891540 ## Specificity Pos Pred Value Neg Pred Value ## 0.8025070 0.7077778 0.9300654 ## Precision Recall F1 ## 0.7077778 0.8891540 0.7876655 ## Prevalence Detection Rate Detection Prevalence ## 0.3503053 0.3111111 0.4395604 ## Balanced Accuracy ## 0.8458305 (bagging_tm<-proc.time()-start_tm) ## user system elapsed ## 2.35 0.02 2.36 N<-nrow(trcatheart) cv_df<-do.call('rbind',lapply(1:N,FUN=function(idx,data=trcatheart) { # For each observation m<-naiveBayes(target~.,data=data[-idx,]) # train with ALL other observatio ns p<-predict(m,data[idx,-c(9)],type='raw') # predict that one observation # NB returns the probabilities of the classes, as per Bayesian Classifie r,we take the classs with the higher probability pc<-unlist(apply(round(p),1,which.max))-1 # -1 to make class to be 0 or 1, which.max returns 1 or 2 #pred_tbl<-table(data[idx,c(9)],pc) #pred_cfm<-caret::confusionMatrix(pred_tbl) list(fold=idx,m=m,predicted=pc,actual=data[idx,c(9)]) # store the idx, mod el, predicted class and actual class } )) cv_df<-as.data.frame(cv_df) head(cv_df) Bootstrap Aggregation-LooCV-naiveBayes file:///E:/users/rkannan/cuny/fall2020/fall2020/m11-bagging-loocv/baggi... 5 of 11 11/23/2020, 5:39 PM
  • 6. ## fold ## 1 1 ## 2 2 ## 3 3 ## 4 4 ## 5 5 ## 6 6 ## m ## 1 98, 113, 0.8061224, 0.5840708, 0.3973667, 0.4950769, 0.4387755, 1.35398 2, 0.8623431, 0.9535681, 0.1428571, 0.1327434, 0.3517262, 0.3408085, 0.43877 55, 0.6106195, 0.5385419, 0.5076843, 0.5510204, 0.1769912, 0.4999474, 0.3833 613, 1.132653, 1.530973, 0.5493718, 0.6277909, 1.285714, 0.3539823, 1.03545 4, 0.8856026, 2.581633, 2.123894, 0.6568194, 0.4842657, TRUE, TRUE, TRUE, TR UE, TRUE, TRUE, TRUE, TRUE, naiveBayes.default(x = X, y = Y, laplace = lapla ce) ## 2 97, 114, 0.8041237, 0.5789474, 0.3989354, 0.4959078, 0.443299, 1. 342105, 0.8656533, 0.9577716, 0.1443299, 0.1315789, 0.3532495, 0.3395249, 0. 443299, 0.6052632, 0.5394649, 0.5086582, 0.5463918, 0.1754386, 0.5004294, 0. 382021, 1.123711, 1.526316, 0.5450102, 0.6269822, 1.278351, 0.3508772, 1.038 25, 0.8822984, 2.57732, 2.122807, 0.658835, 0.4822578, TRUE, TRUE, TRUE, TRU E, TRUE, TRUE, TRUE, TRUE, naiveBayes.default(x = X, y = Y, laplace = laplac e) ## 3 97, 114, 0.8041237, 0.5789474, 0.3989354, 0.4959078, 0.443299, 1. 342105, 0.8656533, 0.9577716, 0.1443299, 0.1315789, 0.3532495, 0.3395249, 0. 443299, 0.6052632, 0.5394649, 0.5086582, 0.5463918, 0.1754386, 0.5004294, 0. 382021, 1.14433, 1.526316, 0.5398628, 0.6269822, 1.298969, 0.3508772, 1.0324 42, 0.8822984, 2.57732, 2.122807, 0.658835, 0.4822578, TRUE, TRUE, TRUE, TRU E, TRUE, TRUE, TRUE, TRUE, naiveBayes.default(x = X, y = Y, laplace = laplac e) ## 4 98, 113, 0.8061224, 0.5752212, 0.3973667, 0.4965112, 0.4387755, 1.33628 3, 0.8623431, 0.9600095, 0.1428571, 0.1327434, 0.3517262, 0.3408085, 0.43877 55, 0.6017699, 0.5385419, 0.5095485, 0.5510204, 0.1769912, 0.4999474, 0.3833 613, 1.132653, 1.522124, 0.5493718, 0.6281683, 1.285714, 0.3539823, 1.03545 4, 0.8856026, 2.581633, 2.123894, 0.6568194, 0.4842657, TRUE, TRUE, TRUE, TR UE, TRUE, TRUE, TRUE, TRUE, naiveBayes.default(x = X, y = Y, laplace = lapla ce) ## 5 98, 113, 0.8061224, 0.5840708, 0.3973667, 0.4950769, 0.4387755, 1.35398 2, 0.8623431, 0.9535681, 0.1428571, 0.1327434, 0.3517262, 0.3408085, 0.43877 55, 0.6017699, 0.5385419, 0.5095485, 0.5510204, 0.1769912, 0.4999474, 0.3833 613, 1.132653, 1.522124, 0.5493718, 0.6281683, 1.285714, 0.3539823, 1.03545 4, 0.8856026, 2.581633, 2.123894, 0.6568194, 0.4842657, TRUE, TRUE, TRUE, TR UE, TRUE, TRUE, TRUE, TRUE, naiveBayes.default(x = X, y = Y, laplace = lapla ce) ## 6 97, 114, 0.814433, 0.5789474, 0.3907764, 0.4959078, 0.443299, 1. 342105, 0.8656533, 0.9577716, 0.1340206, 0.1315789, 0.3424442, 0.3395249, 0. 4329897, 0.6052632, 0.5382691, 0.5086582, 0.5463918, 0.1754386, 0.5004294, 0.382021, 1.134021, 1.526316, 0.552058, 0.6269822, 1.278351, 0.3508772, 1.03 825, 0.8822984, 2.57732, 2.122807, 0.658835, 0.4822578, TRUE, TRUE, TRUE, TR UE, TRUE, TRUE, TRUE, TRUE, naiveBayes.default(x = X, y = Y, laplace = lapla Bootstrap Aggregation-LooCV-naiveBayes file:///E:/users/rkannan/cuny/fall2020/fall2020/m11-bagging-loocv/baggi... 6 of 11 11/23/2020, 5:39 PM
  • 7. ce) ## predicted actual ## 1 1 1 ## 2 0 0 ## 3 0 0 ## 4 1 1 ## 5 1 1 ## 6 0 0 tail(cv_df) Bootstrap Aggregation-LooCV-naiveBayes file:///E:/users/rkannan/cuny/fall2020/fall2020/m11-bagging-loocv/baggi... 7 of 11 11/23/2020, 5:39 PM
  • 8. ## fold ## 207 207 ## 208 208 ## 209 209 ## 210 210 ## 211 211 ## 212 212 ## m ## 207 98, 113, 0.8061224, 0.5840708, 0.3973667, 0.4950769, 0.4387755, 1.336 283, 0.8623431, 0.9600095, 0.1428571, 0.1238938, 0.3517262, 0.3309279, 0.438 7755, 0.6017699, 0.5385419, 0.5095485, 0.5510204, 0.1769912, 0.4999474, 0.38 33613, 1.132653, 1.522124, 0.5493718, 0.6281683, 1.285714, 0.3539823, 1.0354 54, 0.8856026, 2.581633, 2.123894, 0.6568194, 0.4842657, TRUE, TRUE, TRUE, T RUE, TRUE, TRUE, TRUE, TRUE, naiveBayes.default(x = X, y = Y, laplace = lapl ace) ## 208 98, 113, 0.8061224, 0.5752212, 0.3973667, 0.4965112, 0.4387755, 1.345 133, 0.8623431, 0.9614898, 0.1428571, 0.1238938, 0.3517262, 0.3309279, 0.438 7755, 0.6106195, 0.5385419, 0.5076843, 0.5510204, 0.1769912, 0.4999474, 0.38 33613, 1.132653, 1.522124, 0.5493718, 0.6281683, 1.285714, 0.3539823, 1.0354 54, 0.8856026, 2.581633, 2.123894, 0.6568194, 0.4842657, TRUE, TRUE, TRUE, T RUE, TRUE, TRUE, TRUE, TRUE, naiveBayes.default(x = X, y = Y, laplace = lapl ace) ## 209 98, 113, 0.8061224, 0.5752212, 0.3973667, 0.4965112, 0.4387755, 1.353 982, 0.8623431, 0.9535681, 0.1428571, 0.1327434, 0.3517262, 0.3408085, 0.438 7755, 0.6017699, 0.5385419, 0.5095485, 0.5510204, 0.1769912, 0.4999474, 0.38 33613, 1.132653, 1.522124, 0.5493718, 0.6281683, 1.285714, 0.3539823, 1.0354 54, 0.8856026, 2.581633, 2.123894, 0.6568194, 0.4842657, TRUE, TRUE, TRUE, T RUE, TRUE, TRUE, TRUE, TRUE, naiveBayes.default(x = X, y = Y, laplace = lapl ace) ## 210 98, 113, 0.8061224, 0.5840708, 0.3973667, 0.4950769, 0.4387755, 1.345 133, 0.8623431, 0.9614898, 0.1428571, 0.1238938, 0.3517262, 0.3309279, 0.438 7755, 0.6106195, 0.5385419, 0.5076843, 0.5510204, 0.1681416, 0.4999474, 0.37 56579, 1.132653, 1.522124, 0.5493718, 0.6281683, 1.285714, 0.3451327, 1.0354 54, 0.8840846, 2.581633, 2.123894, 0.6568194, 0.4842657, TRUE, TRUE, TRUE, T RUE, TRUE, TRUE, TRUE, TRUE, naiveBayes.default(x = X, y = Y, laplace = lapl ace) ## 211 97, 114, 0.8041237, 0.5789474, 0.3989354, 0.4959078, 0.443299, 1.342105, 0.8656533, 0.9577716, 0.1443299, 0.1315789, 0.3532495, 0.3395249, 0.4329897, 0.6052632, 0.5382691, 0.5086582, 0.5463918, 0.1754386, 0.5004294, 0.382021, 1.134021, 1.526316, 0.552058, 0.6269822, 1.28866, 0.3508772, 1.040 42, 0.8822984, 2.57732, 2.122807, 0.658835, 0.4822578, TRUE, TRUE, TRUE, TRU E, TRUE, TRUE, TRUE, TRUE, naiveBayes.default(x = X, y = Y, laplace = laplac e) ## 212 98, 113, 0.8061224, 0.5840708, 0.3973667, 0.4950769, 0.4387755, 1.345 133, 0.8623431, 0.9614898, 0.1428571, 0.1327434, 0.3517262, 0.3408085, 0.438 7755, 0.6106195, 0.5385419, 0.5076843, 0.5510204, 0.1769912, 0.4999474, 0.38 33613, 1.132653, 1.522124, 0.5493718, 0.6281683, 1.285714, 0.3539823, 1.0354 54, 0.8856026, 2.581633, 2.123894, 0.6568194, 0.4842657, TRUE, TRUE, TRUE, T RUE, TRUE, TRUE, TRUE, TRUE, naiveBayes.default(x = X, y = Y, laplace = lapl Bootstrap Aggregation-LooCV-naiveBayes file:///E:/users/rkannan/cuny/fall2020/fall2020/m11-bagging-loocv/baggi... 8 of 11 11/23/2020, 5:39 PM
  • 9. ace) ## predicted actual ## 207 1 1 ## 208 1 1 ## 209 1 1 ## 210 1 1 ## 211 0 0 ## 212 1 1 table(as.numeric(cv_df$actual)==as.numeric(cv_df$predicted)) ## ## FALSE TRUE ## 34 178 loocv_tbl<-table(as.numeric(cv_df$actual),as.numeric(cv_df$predicted)) sum(diag(loocv_tbl))/sum(loocv_tbl) ## [1] 0.8396226 (loocv_caret_cfm<-caret::confusionMatrix(loocv_tbl)) Bootstrap Aggregation-LooCV-naiveBayes file:///E:/users/rkannan/cuny/fall2020/fall2020/m11-bagging-loocv/baggi... 9 of 11 11/23/2020, 5:39 PM
  • 10. ## Confusion Matrix and Statistics ## ## ## 0 1 ## 0 79 19 ## 1 15 99 ## ## Accuracy : 0.8396 ## 95% CI : (0.7832, 0.8863) ## No Information Rate : 0.5566 ## P-Value [Acc > NIR] : <2e-16 ## ## Kappa : 0.6765 ## ## Mcnemar's Test P-Value : 0.6069 ## ## Sensitivity : 0.8404 ## Specificity : 0.8390 ## Pos Pred Value : 0.8061 ## Neg Pred Value : 0.8684 ## Prevalence : 0.4434 ## Detection Rate : 0.3726 ## Detection Prevalence : 0.4623 ## Balanced Accuracy : 0.8397 ## ## 'Positive' Class : 0 ## # now we have to apply the training models to testdata and average them # since this is classification we will take the majority vote # double loop tstcv.perf<-as.data.frame(do.call('cbind',lapply(cv_df$m,FUN=function(m,data =tstcatheart) { v<-predict(m,data[,-c(9)],type='raw') lbllist<-unlist(apply(round(v),1,which.max))-1 } ))) np<-ncol(tstcv.perf) predclass<-unlist(apply(tstcv.perf,1,FUN=function(v){ ifelse(sum(v[2:length (v)])/np<0.5,0,1)})) loocvtbl<-table(tstcatheart[,c(9)],predclass) (loocv_cfm<-caret::confusionMatrix(loocvtbl)) Bootstrap Aggregation-LooCV-naiveBayes file:///E:/users/rkannan/cuny/fall2020/fall2020/m11-bagging-loocv/baggi... 10 of 11 11/23/2020, 5:39 PM
  • 11. ## Confusion Matrix and Statistics ## ## predclass ## 0 1 ## 0 28 12 ## 1 3 48 ## ## Accuracy : 0.8352 ## 95% CI : (0.7427, 0.9047) ## No Information Rate : 0.6593 ## P-Value [Acc > NIR] : 0.0001482 ## ## Kappa : 0.6571 ## ## Mcnemar's Test P-Value : 0.0388671 ## ## Sensitivity : 0.9032 ## Specificity : 0.8000 ## Pos Pred Value : 0.7000 ## Neg Pred Value : 0.9412 ## Prevalence : 0.3407 ## Detection Rate : 0.3077 ## Detection Prevalence : 0.4396 ## Balanced Accuracy : 0.8516 ## ## 'Positive' Class : 0 ## print(paste('Bagging:',bagging.perf.mean[1])) ## [1] "Bagging: 0.832356532356532" print(paste('LOO-CV:',loocv_cfm$overall[1])) ## [1] "LOO-CV: 0.835164835164835" print(paste('Base NB',nb.cfm$overall[[1]])) ## [1] "Base NB 0.835164835164835" Bootstrap Aggregation-LooCV-naiveBayes file:///E:/users/rkannan/cuny/fall2020/fall2020/m11-bagging-loocv/baggi... 11 of 11 11/23/2020, 5:39 PM