SlideShare uma empresa Scribd logo
1 de 11
Baixar para ler offline
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

Mais conteúdo relacionado

Mais procurados

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 myanmarucsySmartHinJ
 
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 interpreterakaptur
 
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 2017Christian Aichinger
 
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 AutonomousConnor McDonald
 
Sangam 19 - PLSQL still the coolest
Sangam 19 - PLSQL still the coolestSangam 19 - PLSQL still the coolest
Sangam 19 - PLSQL still the coolestConnor McDonald
 
Python testing-frameworks overview
Python testing-frameworks overviewPython testing-frameworks overview
Python testing-frameworks overviewJachym 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
 
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 profit44CON
 
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 GotchasJim Mlodgenski
 
Agile Database Development with JSON
Agile Database Development with JSONAgile Database Development with JSON
Agile Database Development with JSONChris Saxon
 
Spring Data JPAによるデータアクセス徹底入門 #jsug
Spring Data JPAによるデータアクセス徹底入門 #jsugSpring Data JPAによるデータアクセス徹底入門 #jsug
Spring Data JPAによるデータアクセス徹底入門 #jsugMasatoshi Tada
 

Mais procurados (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
 

Semelhante a 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 codeWim Godden
 
Seaborn graphing present
Seaborn graphing presentSeaborn graphing present
Seaborn graphing presentYilin Zeng
 
Rooted 2010 ppp
Rooted 2010 pppRooted 2010 ppp
Rooted 2010 pppnoc_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 codeWim 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 GRJosef 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 kableExtraBarry DeCicco
 
Regression and Classification with R
Regression and Classification with RRegression and Classification with R
Regression and Classification with RYanchang 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 citibikeVivian S. Zhang
 
Itsecteam shell
Itsecteam shellItsecteam shell
Itsecteam shellady36
 
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 codeWim 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 codeWim 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 .pdfpicscamshoppe
 
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 codeWim Godden
 

Semelhante a 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
 

Mais de Raman Kannan

Essays on-civic-responsibilty
Essays on-civic-responsibiltyEssays on-civic-responsibilty
Essays on-civic-responsibiltyRaman Kannan
 
M12 boosting-part02
M12 boosting-part02M12 boosting-part02
M12 boosting-part02Raman Kannan
 
M10 gradient descent
M10 gradient descentM10 gradient descent
M10 gradient descentRaman Kannan
 
M08 BiasVarianceTradeoff
M08 BiasVarianceTradeoffM08 BiasVarianceTradeoff
M08 BiasVarianceTradeoffRaman Kannan
 
Chapter 04-discriminant analysis
Chapter 04-discriminant analysisChapter 04-discriminant analysis
Chapter 04-discriminant analysisRaman Kannan
 
Augmented 11022020-ieee
Augmented 11022020-ieeeAugmented 11022020-ieee
Augmented 11022020-ieeeRaman Kannan
 
Chapter 02-logistic regression
Chapter 02-logistic regressionChapter 02-logistic regression
Chapter 02-logistic regressionRaman Kannan
 
Chapter01 introductory handbook
Chapter01 introductory handbookChapter01 introductory handbook
Chapter01 introductory handbookRaman Kannan
 
A voyage-inward-02
A voyage-inward-02A voyage-inward-02
A voyage-inward-02Raman Kannan
 
Evaluating classifierperformance ml-cs6923
Evaluating classifierperformance ml-cs6923Evaluating classifierperformance ml-cs6923
Evaluating classifierperformance ml-cs6923Raman Kannan
 
A data scientist's study plan
A data scientist's study planA data scientist's study plan
A data scientist's study planRaman Kannan
 
Cognitive Assistants
Cognitive AssistantsCognitive Assistants
Cognitive AssistantsRaman Kannan
 
Essay on-data-analysis
Essay on-data-analysisEssay on-data-analysis
Essay on-data-analysisRaman Kannan
 
How to-run-ols-diagnostics-02
How to-run-ols-diagnostics-02How to-run-ols-diagnostics-02
How to-run-ols-diagnostics-02Raman Kannan
 
Sdr dodd frankbirdseyeview
Sdr dodd frankbirdseyeviewSdr dodd frankbirdseyeview
Sdr dodd frankbirdseyeviewRaman Kannan
 

Mais de 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
 

Último

➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...amitlee9823
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxolyaivanovalion
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% SecurePooja Nehwal
 
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...amitlee9823
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Valters Lauzums
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxolyaivanovalion
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfMarinCaroMartnezBerg
 
Call Girls In Attibele ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Attibele ☎ 7737669865 🥵 Book Your One night StandCall Girls In Attibele ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Attibele ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionfulawalesam
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...amitlee9823
 
Capstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramCapstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramMoniSankarHazra
 
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangaloreamitlee9823
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxolyaivanovalion
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Researchmichael115558
 
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...amitlee9823
 
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...amitlee9823
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysismanisha194592
 

Último (20)

➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
 
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptx
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
 
Call Girls In Attibele ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Attibele ☎ 7737669865 🥵 Book Your One night StandCall Girls In Attibele ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Attibele ☎ 7737669865 🥵 Book Your One night Stand
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 
Predicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science ProjectPredicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science Project
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
 
Capstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramCapstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics Program
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptx
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
 
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysis
 

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