Sonar Prediction in R

In [1]:
# Sonar

# Binary classification, numeric inputs

# Dataset: https://archive.ics.uci.edu/ml/datasets/Connectionist+Bench+(Sonar,+Mines+vs.+Rocks)
# World-class results: http://www.is.umk.pl/projects/datasets.html#Sonar

library(mlbench)
library(caret)
library(doMC)
library(caretEnsemble)

# use multiple cores
registerDoMC(cores=8)

# 1. Load the dataset
data(Sonar)
dataset <- Sonar

# 2. Summarize data
# dimensions of dataaset
dim(dataset)
# split input and output
x <- dataset[,1:60]
y <- dataset[,61]
# class distribution
cbind(freq=table(y), percentage=prop.table(table(y))*100)
# summarize attribute distributions
summary(dataset)
# summarize correlations between input variables
cor(x)

# 3. Visualize Data
# box and whisker plots for each attribute
scales <- list(x=list(relation="free"), y=list(relation="free"))
featurePlot(x=x, y=y, plot="box", scales=scales)
# density plots for each attribute by class value
featurePlot(x=x, y=y, plot="density", scales=scales)

# 4 Data Transforms
dataset[,1:60] <- scale(dataset[,1:60])

# 5. Evaluate Algorithms
# Run algorithms using 10-fold cross validation
control <- trainControl(method="repeatedcv", number=10, repeats=3)
# GLM
set.seed(7)
fit.glm <- train(Class~., data=dataset, method="glm", metric="Accuracy", trControl=control)
# LDA
set.seed(7)
fit.lda <- train(Class~., data=dataset, method="lda", metric="Accuracy", trControl=control)
# SVM
set.seed(7)
grid <- expand.grid(.sigma=c(0.01,0.05,0.1), .C=c(1))
fit.svm <- train(Class~., data=dataset, method="svmRadial", metric="Accuracy", tuneGrid=grid, trControl=control)
# CART
set.seed(7)
grid <- expand.grid(.cp=c(0.01,0.05,0.1))
fit.cart <- train(Class~., data=dataset, method="rpart", metric="Accuracy", tuneGrid=grid, trControl=control)
# kNN
set.seed(7)
grid <- expand.grid(.k=c(1,3,5,7))
fit.knn <- train(Class~., data=dataset, method="knn", metric="Accuracy", tuneGrid=grid, trControl=control)
# Compare algorithms
results <- resamples(list(SVM=fit.svm, CART=fit.cart, kNN=fit.knn, glm=fit.glm, lda=fit.lda))
summary(results)
dotplot(results)

# 6. Improve Results
# ensemble
control <- trainControl(method="repeatedcv", number=10, repeats=3, savePredictions=TRUE, classProbs=TRUE)
models <- caretList(Class~., data=dataset, trControl=control, metric='Accuracy', methodList=c('glm', 'lda'),
  tuneList=list(
    svmRadial=caretModelSpec(method='svmRadial', tuneGrid=expand.grid(.sigma=c(0.05), .C=c(1))),
    rpart=caretModelSpec(method='rpart', tuneGrid=expand.grid(.cp=c(0.1))),
    knn=caretModelSpec(method='knn', tuneGrid=expand.grid(.k=c(1)))
  )
)
ensemble <- caretEnsemble(models)
summary(ensemble)
Loading required package: lattice
Loading required package: ggplot2
Loading required package: foreach
Loading required package: iterators
Loading required package: parallel

Attaching package: ‘caretEnsemble’

The following object is masked from ‘package:ggplot2’:

    autoplot

  1. 208
  2. 61
freqpercentage
M111 53.36538
R 97 46.63462
       V1                V2                V3                V4         
 Min.   :0.00150   Min.   :0.00060   Min.   :0.00150   Min.   :0.00580  
 1st Qu.:0.01335   1st Qu.:0.01645   1st Qu.:0.01895   1st Qu.:0.02438  
 Median :0.02280   Median :0.03080   Median :0.03430   Median :0.04405  
 Mean   :0.02916   Mean   :0.03844   Mean   :0.04383   Mean   :0.05389  
 3rd Qu.:0.03555   3rd Qu.:0.04795   3rd Qu.:0.05795   3rd Qu.:0.06450  
 Max.   :0.13710   Max.   :0.23390   Max.   :0.30590   Max.   :0.42640  
       V5                V6                V7               V8         
 Min.   :0.00670   Min.   :0.01020   Min.   :0.0033   Min.   :0.00550  
 1st Qu.:0.03805   1st Qu.:0.06703   1st Qu.:0.0809   1st Qu.:0.08042  
 Median :0.06250   Median :0.09215   Median :0.1070   Median :0.11210  
 Mean   :0.07520   Mean   :0.10457   Mean   :0.1217   Mean   :0.13480  
 3rd Qu.:0.10028   3rd Qu.:0.13412   3rd Qu.:0.1540   3rd Qu.:0.16960  
 Max.   :0.40100   Max.   :0.38230   Max.   :0.3729   Max.   :0.45900  
       V9               V10              V11              V12        
 Min.   :0.00750   Min.   :0.0113   Min.   :0.0289   Min.   :0.0236  
 1st Qu.:0.09703   1st Qu.:0.1113   1st Qu.:0.1293   1st Qu.:0.1335  
 Median :0.15225   Median :0.1824   Median :0.2248   Median :0.2490  
 Mean   :0.17800   Mean   :0.2083   Mean   :0.2360   Mean   :0.2502  
 3rd Qu.:0.23342   3rd Qu.:0.2687   3rd Qu.:0.3016   3rd Qu.:0.3312  
 Max.   :0.68280   Max.   :0.7106   Max.   :0.7342   Max.   :0.7060  
      V13              V14              V15              V16        
 Min.   :0.0184   Min.   :0.0273   Min.   :0.0031   Min.   :0.0162  
 1st Qu.:0.1661   1st Qu.:0.1752   1st Qu.:0.1646   1st Qu.:0.1963  
 Median :0.2640   Median :0.2811   Median :0.2817   Median :0.3047  
 Mean   :0.2733   Mean   :0.2966   Mean   :0.3202   Mean   :0.3785  
 3rd Qu.:0.3513   3rd Qu.:0.3862   3rd Qu.:0.4529   3rd Qu.:0.5357  
 Max.   :0.7131   Max.   :0.9970   Max.   :1.0000   Max.   :0.9988  
      V17              V18              V19              V20        
 Min.   :0.0349   Min.   :0.0375   Min.   :0.0494   Min.   :0.0656  
 1st Qu.:0.2059   1st Qu.:0.2421   1st Qu.:0.2991   1st Qu.:0.3506  
 Median :0.3084   Median :0.3683   Median :0.4350   Median :0.5425  
 Mean   :0.4160   Mean   :0.4523   Mean   :0.5048   Mean   :0.5630  
 3rd Qu.:0.6594   3rd Qu.:0.6791   3rd Qu.:0.7314   3rd Qu.:0.8093  
 Max.   :1.0000   Max.   :1.0000   Max.   :1.0000   Max.   :1.0000  
      V21              V22              V23              V24        
 Min.   :0.0512   Min.   :0.0219   Min.   :0.0563   Min.   :0.0239  
 1st Qu.:0.3997   1st Qu.:0.4069   1st Qu.:0.4502   1st Qu.:0.5407  
 Median :0.6177   Median :0.6649   Median :0.6997   Median :0.6985  
 Mean   :0.6091   Mean   :0.6243   Mean   :0.6470   Mean   :0.6727  
 3rd Qu.:0.8170   3rd Qu.:0.8320   3rd Qu.:0.8486   3rd Qu.:0.8722  
 Max.   :1.0000   Max.   :1.0000   Max.   :1.0000   Max.   :1.0000  
      V25              V26              V27              V28        
 Min.   :0.0240   Min.   :0.0921   Min.   :0.0481   Min.   :0.0284  
 1st Qu.:0.5258   1st Qu.:0.5442   1st Qu.:0.5319   1st Qu.:0.5348  
 Median :0.7211   Median :0.7545   Median :0.7456   Median :0.7319  
 Mean   :0.6754   Mean   :0.6999   Mean   :0.7022   Mean   :0.6940  
 3rd Qu.:0.8737   3rd Qu.:0.8938   3rd Qu.:0.9171   3rd Qu.:0.9003  
 Max.   :1.0000   Max.   :1.0000   Max.   :1.0000   Max.   :1.0000  
      V29              V30              V31              V32        
 Min.   :0.0144   Min.   :0.0613   Min.   :0.0482   Min.   :0.0404  
 1st Qu.:0.4637   1st Qu.:0.4114   1st Qu.:0.3456   1st Qu.:0.2814  
 Median :0.6808   Median :0.6071   Median :0.4904   Median :0.4296  
 Mean   :0.6421   Mean   :0.5809   Mean   :0.5045   Mean   :0.4390  
 3rd Qu.:0.8521   3rd Qu.:0.7352   3rd Qu.:0.6420   3rd Qu.:0.5803  
 Max.   :1.0000   Max.   :1.0000   Max.   :0.9657   Max.   :0.9306  
      V33              V34              V35              V36        
 Min.   :0.0477   Min.   :0.0212   Min.   :0.0223   Min.   :0.0080  
 1st Qu.:0.2579   1st Qu.:0.2176   1st Qu.:0.1794   1st Qu.:0.1543  
 Median :0.3912   Median :0.3510   Median :0.3127   Median :0.3211  
 Mean   :0.4172   Mean   :0.4032   Mean   :0.3926   Mean   :0.3848  
 3rd Qu.:0.5561   3rd Qu.:0.5961   3rd Qu.:0.5934   3rd Qu.:0.5565  
 Max.   :1.0000   Max.   :0.9647   Max.   :1.0000   Max.   :1.0000  
      V37              V38              V39              V40        
 Min.   :0.0351   Min.   :0.0383   Min.   :0.0371   Min.   :0.0117  
 1st Qu.:0.1601   1st Qu.:0.1743   1st Qu.:0.1740   1st Qu.:0.1865  
 Median :0.3063   Median :0.3127   Median :0.2835   Median :0.2781  
 Mean   :0.3638   Mean   :0.3397   Mean   :0.3258   Mean   :0.3112  
 3rd Qu.:0.5189   3rd Qu.:0.4405   3rd Qu.:0.4349   3rd Qu.:0.4244  
 Max.   :0.9497   Max.   :1.0000   Max.   :0.9857   Max.   :0.9297  
      V41              V42              V43              V44        
 Min.   :0.0360   Min.   :0.0056   Min.   :0.0000   Min.   :0.0000  
 1st Qu.:0.1631   1st Qu.:0.1589   1st Qu.:0.1552   1st Qu.:0.1269  
 Median :0.2595   Median :0.2451   Median :0.2225   Median :0.1777  
 Mean   :0.2893   Mean   :0.2783   Mean   :0.2465   Mean   :0.2141  
 3rd Qu.:0.3875   3rd Qu.:0.3842   3rd Qu.:0.3245   3rd Qu.:0.2717  
 Max.   :0.8995   Max.   :0.8246   Max.   :0.7733   Max.   :0.7762  
      V45               V46               V47               V48         
 Min.   :0.00000   Min.   :0.00000   Min.   :0.00000   Min.   :0.00000  
 1st Qu.:0.09448   1st Qu.:0.06855   1st Qu.:0.06425   1st Qu.:0.04512  
 Median :0.14800   Median :0.12135   Median :0.10165   Median :0.07810  
 Mean   :0.19723   Mean   :0.16063   Mean   :0.12245   Mean   :0.09142  
 3rd Qu.:0.23155   3rd Qu.:0.20037   3rd Qu.:0.15443   3rd Qu.:0.12010  
 Max.   :0.70340   Max.   :0.72920   Max.   :0.55220   Max.   :0.33390  
      V49               V50               V51                V52          
 Min.   :0.00000   Min.   :0.00000   Min.   :0.000000   Min.   :0.000800  
 1st Qu.:0.02635   1st Qu.:0.01155   1st Qu.:0.008425   1st Qu.:0.007275  
 Median :0.04470   Median :0.01790   Median :0.013900   Median :0.011400  
 Mean   :0.05193   Mean   :0.02042   Mean   :0.016069   Mean   :0.013420  
 3rd Qu.:0.06853   3rd Qu.:0.02527   3rd Qu.:0.020825   3rd Qu.:0.016725  
 Max.   :0.19810   Max.   :0.08250   Max.   :0.100400   Max.   :0.070900  
      V53                V54                V55               V56          
 Min.   :0.000500   Min.   :0.001000   Min.   :0.00060   Min.   :0.000400  
 1st Qu.:0.005075   1st Qu.:0.005375   1st Qu.:0.00415   1st Qu.:0.004400  
 Median :0.009550   Median :0.009300   Median :0.00750   Median :0.006850  
 Mean   :0.010709   Mean   :0.010941   Mean   :0.00929   Mean   :0.008222  
 3rd Qu.:0.014900   3rd Qu.:0.014500   3rd Qu.:0.01210   3rd Qu.:0.010575  
 Max.   :0.039000   Max.   :0.035200   Max.   :0.04470   Max.   :0.039400  
      V57               V58                V59                V60          
 Min.   :0.00030   Min.   :0.000300   Min.   :0.000100   Min.   :0.000600  
 1st Qu.:0.00370   1st Qu.:0.003600   1st Qu.:0.003675   1st Qu.:0.003100  
 Median :0.00595   Median :0.005800   Median :0.006400   Median :0.005300  
 Mean   :0.00782   Mean   :0.007949   Mean   :0.007941   Mean   :0.006507  
 3rd Qu.:0.01043   3rd Qu.:0.010350   3rd Qu.:0.010325   3rd Qu.:0.008525  
 Max.   :0.03550   Max.   :0.044000   Max.   :0.036400   Max.   :0.043900  
 Class  
 M:111  
 R: 97  
        
        
        
        
V1V2V3V4V5V6V7V8V9V10V51V52V53V54V55V56V57V58V59V60
V1 1.00000000 0.735895604 0.57153661 0.49143751 0.3447966545 0.23892107 0.260814529 0.35552318 0.353419921 0.318275772 0.2544496830 0.355298662 0.3117294686 0.32229896 0.312067442 0.22064249 0.31372502 0.368131995 0.357116489 0.347077554
V2 0.73589560 1.000000000 0.77991587 0.60668448 0.4196689664 0.33232920 0.279040345 0.33461516 0.316733233 0.270781717 0.3205383646 0.434547562 0.3460764258 0.38395991 0.380164516 0.26226316 0.28034105 0.353041818 0.352199776 0.358761201
V3 0.57153661 0.779915872 1.00000000 0.78178597 0.5461413777 0.34627494 0.190434227 0.23788409 0.252691067 0.219637372 0.2381103505 0.394075754 0.3329137037 0.36718590 0.289730569 0.28766110 0.38081870 0.334108454 0.425047017 0.373948254
V4 0.49143751 0.606684483 0.78178597 1.00000000 0.7269434669 0.35280540 0.246440252 0.24674201 0.247077711 0.237768599 0.1746757917 0.374650635 0.3647717582 0.33421088 0.284954988 0.28093758 0.34025409 0.344864663 0.420265745 0.400626132
V5 0.34479665 0.419668966 0.54614138 0.72694347 1.0000000000 0.59705274 0.335421814 0.20400559 0.177905776 0.183218648 0.1159361127 0.266617167 0.3149851131 0.20530650 0.196472149 0.19932264 0.21939544 0.238792772 0.290981629 0.253709871
V6 0.23892107 0.332329200 0.34627494 0.35280540 0.5970527386 1.00000000 0.702889254 0.47168336 0.327578386 0.288621164 0.1717670563 0.252287930 0.1624036973 0.16407338 0.133464316 0.16675809 0.16133321 0.203985594 0.220573014 0.178157645
V7 0.26081453 0.279040345 0.19043423 0.24644025 0.3354218138 0.70288925 1.000000000 0.67577391 0.470579816 0.425447589 0.1841522309 0.144050509 0.0464028902 0.16307350 0.195540766 0.17414317 0.18632403 0.242645518 0.183578101 0.222492825
V8 0.35552318 0.334615160 0.23788409 0.24674201 0.2040055949 0.47168336 0.675773905 1.00000000 0.778576885 0.652524801 0.2606918260 0.219037753 0.1024471525 0.23400829 0.239551179 0.27681852 0.26721176 0.287603028 0.194400112 0.146216011
V9 0.35341992 0.316733233 0.25269107 0.24707771 0.1779057756 0.32757839 0.470579816 0.77857689 1.000000000 0.877130726 0.1748728686 0.207995601 0.1053521942 0.20261501 0.179341841 0.23276385 0.19396344 0.231744665 0.097292793 0.095243111
V10 0.31827577 0.270781717 0.21963737 0.23776860 0.1832186481 0.28862116 0.425447589 0.65252480 0.877130726 1.000000000 0.1670961541 0.165536968 0.0975435898 0.14672537 0.175254268 0.15188887 0.14032657 0.212276583 0.058273306 0.097358118
V11 0.34405764 0.297064686 0.27461039 0.27188142 0.2316836674 0.33357015 0.396588198 0.58458333 0.728062543 0.853140191 0.1576151651 0.165748448 0.0848007045 0.14257177 0.228991200 0.12233172 0.10340512 0.193357860 0.067726119 0.089695289
V12 0.21086119 0.194102177 0.21480700 0.17538061 0.2116571016 0.34445130 0.274431820 0.32832892 0.363404422 0.485392006 0.1134177418 0.117698589 0.0422627087 0.07845663 0.164590062 0.11565820 0.03073237 0.065273243 0.044613744 0.071363676
V13 0.21072220 0.249595669 0.25876684 0.21575445 0.2990864387 0.41110666 0.365390857 0.32295071 0.316899047 0.405369994 0.2033473921 0.147479474 0.0585993174 0.16091632 0.272492318 0.18374288 0.05786973 0.171139576 0.151803914 0.061410521
V14 0.25627774 0.273170131 0.29172413 0.28670752 0.3590619268 0.39623344 0.409576141 0.38711385 0.329659423 0.345683719 0.1804642968 0.137442874 0.1331956381 0.21092465 0.326821083 0.25216613 0.19088648 0.258675241 0.209121827 0.120966309
V15 0.30487810 0.307599462 0.28566302 0.27852925 0.3180591864 0.36790784 0.411691671 0.39151445 0.299575195 0.294698944 0.1531616994 0.135270923 0.1034439236 0.21870310 0.261822280 0.21839483 0.20251122 0.225545159 0.193670535 0.171088686
V16 0.23907924 0.261844403 0.23701680 0.24824531 0.3287248282 0.35378282 0.363086022 0.32223717 0.241818874 0.242869475 0.0998923335 0.104039035 0.0963247673 0.20692218 0.240967690 0.21547817 0.19173571 0.198019275 0.182336895 0.158438349
V17 0.13784532 0.152169829 0.20109316 0.22320254 0.3264772001 0.29318975 0.250023865 0.14091227 0.100145858 0.121264326 0.0090361467 0.020312871 0.0356350738 0.12913823 0.168460108 0.12896832 0.14570835 0.148562980 0.121800111 0.093991989
V18 0.04181749 0.042870375 0.12058709 0.19499189 0.2992659908 0.23577840 0.208056627 0.06133332 0.027379524 0.063745438 -0.1046557328-0.057235815 -0.0066270165 0.07234421 0.093766845 0.08081248 0.05693014 0.096021680 0.028445569 0.046616986
V19 0.05522719 0.040910750 0.09930269 0.18940451 0.3405427387 0.22630485 0.215494622 0.06182527 0.067237280 0.099632336 -0.0509877706 0.011449859 0.0513672005 0.12015274 0.099081852 0.12133071 0.04520378 0.138364901 0.023019468 0.007467933
V20 0.15675978 0.102427625 0.10311719 0.18831690 0.2857371797 0.20684122 0.196496188 0.20494952 0.266455337 0.246923578 -0.0229602721 0.028754352 0.0696919793 0.17193583 0.157272444 0.17849783 0.06642524 0.132453166 -0.005363903 -0.028539727
V21 0.11766322 0.075255287 0.06399017 0.14227081 0.2050881801 0.17476804 0.165827397 0.20878526 0.264108676 0.240861713 -0.0242224153-0.034844913 -0.0002702881 0.16732747 0.059823404 0.13908911 0.03094278 0.079818139 -0.049413217 -0.025201109
V22-0.05697322 -0.074157218 -0.02681541 0.03600979 0.1528972039 0.12376980 0.063773315 0.02378624 0.019512459 0.070381163 -0.0610535572-0.092203770 -0.0942030006 0.04522386 -0.119719689 -0.03087705 -0.06990852 -0.035829198 -0.143208528 -0.085695991
V23-0.16342609 -0.179365290 -0.07340016 -0.02974889 0.0739338154 0.06408115 0.009359074 -0.09208701 -0.154752073 -0.094887196 -0.1081719234-0.108934392 -0.1526912199-0.05564119 -0.198577148 -0.13890040 -0.09829087 -0.105234569 -0.168148698 -0.163696053
V24-0.21809295 -0.196468706 -0.08538025 -0.10297545 -0.0006243906 0.02702615 0.011982111 -0.12442735 -0.189342965 -0.178303901 -0.1436504865-0.175021547 -0.2258970226-0.12541929 -0.229297087 -0.17832018 -0.11742943 -0.210556056 -0.186526814 -0.190876766
V25-0.29568341 -0.295302419 -0.21425552 -0.20667281 -0.0672964511-0.04328028 -0.057147475 -0.19635441 -0.198658365 -0.179890268 -0.2007524709-0.250478987 -0.2384784762-0.21981653 -0.276418588 -0.18778864 -0.15796678 -0.270221807 -0.303155464 -0.253232673
V26-0.34286494 -0.365748651 -0.29197382 -0.29135704 -0.1256746623-0.10030876 -0.126074007 -0.20317802 -0.137459493 -0.109050641 -0.1915537680-0.256165906 -0.2483996561-0.27716914 -0.353656920 -0.21589368 -0.25424001 -0.303426798 -0.385724552 -0.303949174
V27-0.34170284 -0.337045717 -0.26311108 -0.29474927 -0.1696177701-0.12909442 -0.179526311 -0.23333195 -0.119142867 -0.095819867 -0.1378855096-0.191706959 -0.2598246321-0.26955834 -0.347930875 -0.26340343 -0.26706865 -0.321868457 -0.360340113 -0.267595767
V28-0.22433952 -0.234385972 -0.25667412 -0.25607395 -0.2146921331-0.11864492 -0.116847564 -0.12034286 -0.028001864 -0.052302902 -0.0277503221-0.064729845 -0.1487914824-0.21329958 -0.262619580 -0.19809298 -0.19085377 -0.261442983 -0.275441847 -0.195129937
V29-0.19909875 -0.228490066 -0.29072811 -0.30047629 -0.2838627507-0.15608098 -0.129693787 -0.13975049 -0.093413256 -0.137173350 -0.0002514702-0.054778802 -0.1305268821-0.23511038 -0.246181081 -0.22127329 -0.22815453 -0.267937670 -0.247318043 -0.203776428
V30-0.07742953 -0.115300621 -0.19749312 -0.23660196 -0.2733503204-0.15118569 -0.068141797 -0.01765374 0.053397868 -0.043998029 0.0389278536 0.039052952 -0.0349372877-0.14956371 -0.127522520 -0.06340346 -0.07297596 -0.134302195 -0.129401947 -0.076100075
V31-0.04836991 -0.055861646 -0.10619814 -0.19008554 -0.2143362389-0.05413617 -0.096944533 -0.08107243 -0.041649214 -0.091193137 0.0489362037 0.087360266 0.0263002226-0.14648453 -0.080546351 -0.06737338 -0.01873301 -0.036092425 -0.044197208 -0.043014988
V32-0.03044373 -0.049682757 -0.10989504 -0.16998661 -0.1734847703-0.05193393 -0.115870627 -0.10811534 -0.028629257 -0.058492750 0.0595935160 0.090862565 0.0179967546-0.08930217 -0.012791726 0.01771449 0.01061119 0.018564136 0.013498847 -0.023862700
V33-0.03193868 -0.108271842 -0.17067139 -0.16465054 -0.2005858455-0.14439068 -0.127052467 -0.08724630 -0.017884783 -0.027244670 -0.0025908727 0.003084139 0.0291916172-0.03775250 0.000520324 0.03002718 0.04580611 0.003711916 0.054285417 -0.015803844
V34 0.03131891 -0.004247171 -0.09940851 -0.08396476 -0.1405589889-0.07033663 -0.077661838 -0.01457825 0.013594275 -0.021291159 0.0033863069 0.008363938 0.0951095750 0.06444974 0.089023598 0.10928811 0.10695926 0.083192303 0.138214094 0.075685645
V35 0.09811823 0.115823615 0.01705343 0.01520006 -0.0865286684-0.02881519 -0.015530540 0.03573257 0.015064530 -0.035765271 0.0183823223 0.052650445 0.1227983287 0.13835731 0.110775901 0.13148977 0.16836079 0.143897034 0.227782990 0.191193070
V36 0.08072167 0.132610847 0.05306989 0.03928237 -0.0734805606-0.02362072 0.002978761 0.08718687 0.036119699 -0.004459943 0.0061645795 0.023165278 0.0721816783 0.13671061 0.074314364 0.06995907 0.18947084 0.106275164 0.222683302 0.176982176
V37 0.11956546 0.169185954 0.10752983 0.06348570 -0.0646169136-0.06479768 -0.001375728 0.11073852 0.111768868 0.085071886 -0.0282905172 0.002078041 0.0797988842 0.13042749 0.086914414 0.11654872 0.18078889 0.110760434 0.163161660 0.166263051
V38 0.20987338 0.217493567 0.13027599 0.08988690 -0.0086204624-0.04874532 0.065900108 0.18660873 0.223982643 0.175717327 0.0942053770 0.134015075 0.1711038222 0.20693068 0.235457137 0.21758740 0.15632038 0.169710465 0.206000945 0.233287980
V39 0.20837105 0.186828029 0.11049866 0.08934585 0.0634082531 0.03059882 0.080941702 0.20614548 0.211897320 0.233832857 0.1240380780 0.108563890 0.1675993997 0.20011580 0.294578157 0.22313310 0.14313081 0.218912490 0.231149772 0.222610988
V40 0.09999307 0.098349865 0.07413698 0.04514050 0.0616156266 0.08111878 0.112673483 0.18441111 0.122734860 0.177357346 0.0666730272 0.042677450 0.1283098942 0.12138111 0.157434907 0.15070020 0.10560298 0.143717671 0.189058257 0.202033603
V41 0.12731315 0.188226222 0.18904675 0.14524144 0.0988318238 0.07579689 0.041070798 0.09751670 0.019589175 -0.002522934 0.2774710588 0.255774004 0.2540642017 0.18157896 0.177850711 0.22066960 0.19353186 0.196281933 0.304520537 0.281889287
V42 0.21359185 0.261345046 0.23344170 0.14469337 0.1251807346 0.04876348 -0.028720429 0.07605353 -0.005784689 -0.018880428 0.4287514995 0.359438999 0.2836220229 0.21457973 0.175504684 0.15719166 0.15764637 0.201077225 0.276761594 0.220597476
V43 0.20605736 0.186368171 0.11392033 0.05062897 0.0637057610 0.03438018 -0.025727075 0.11472051 0.052409087 0.076137748 0.3971902594 0.302861357 0.2532032712 0.15533870 0.097670527 0.12357400 0.10412032 0.210814096 0.199333537 0.161415854
V44 0.15794920 0.133017765 0.07194583 -0.00840668 0.0315748470 0.04886977 0.061404446 0.13542578 0.215710231 0.216742239 0.3165006121 0.217849189 0.1395438218 0.09520963 0.097255372 0.13316910 0.10818488 0.109166117 0.154546632 0.108189976
V45 0.27996783 0.285715977 0.18073379 0.08782352 0.0892019954 0.08546800 0.110813334 0.24017633 0.320573040 0.287459073 0.4169733623 0.350208464 0.1812921421 0.16287941 0.242756595 0.17074981 0.14428119 0.167336863 0.178401730 0.157181367
V46 0.31935417 0.304246991 0.17364947 0.08001232 0.0819636737 0.02952413 0.076537392 0.16909883 0.195446821 0.138446740 0.5053040085 0.429308856 0.2369707642 0.18796426 0.269119020 0.17818183 0.16212509 0.237890366 0.205290771 0.180690938
V47 0.23034309 0.255797259 0.17952794 0.04610851 0.0414192669 0.01664050 0.098924921 0.10974413 0.084190934 0.090661567 0.5705747748 0.398599815 0.2069700885 0.15992002 0.194223424 0.14604206 0.15781492 0.240470822 0.209045200 0.139726958
V48 0.20323377 0.265278656 0.23489648 0.12106456 0.0844349723 0.06719581 0.155221107 0.22278309 0.225666705 0.268122843 0.5735720676 0.365148730 0.2063756422 0.20908420 0.210949556 0.21905218 0.19681363 0.270197973 0.221425138 0.123666138
V49 0.24756021 0.313995237 0.22307411 0.13329406 0.0881278448 0.08072878 0.194719797 0.27142187 0.222135267 0.264885244 0.5260948048 0.319286248 0.1508706679 0.19582594 0.230032724 0.15518623 0.17309819 0.328238383 0.209151854 0.088640372
V50 0.26928723 0.245868166 0.08109560 0.07792476 0.0667506532 0.01729957 0.166111635 0.19161507 0.150526708 0.162009743 0.4479256923 0.341667245 0.2796813697 0.28047707 0.287611769 0.23505309 0.20160902 0.342865811 0.178117857 0.139944497
V51 0.25444968 0.320538365 0.23811035 0.17467579 0.1159361127 0.17176706 0.184152231 0.26069183 0.174872869 0.167096154 1.0000000000 0.627038053 0.3303960805 0.38405170 0.278935117 0.20975155 0.19140706 0.325665197 0.317941636 0.246764485
V52 0.35529866 0.434547562 0.39407575 0.37465063 0.2666171669 0.25228793 0.144050509 0.21903775 0.207995601 0.165536968 0.6270380526 1.000000000 0.5404144542 0.34318972 0.337580658 0.20312074 0.19126402 0.309673309 0.298710741 0.195378585
V53 0.31172947 0.346076426 0.33291370 0.36477176 0.3149851131 0.16240370 0.046402890 0.10244715 0.105352194 0.097543590 0.3303960805 0.540414454 1.0000000000 0.41233745 0.315655586 0.42158848 0.30819693 0.370763799 0.346094935 0.280780235
V54 0.32229896 0.383959913 0.36718590 0.33421088 0.2053064968 0.16407338 0.163073504 0.23400829 0.202615010 0.146725370 0.3840516964 0.343189722 0.4123374486 1.00000000 0.455058910 0.39737788 0.36144280 0.404116676 0.447117864 0.283470795
V55 0.31206744 0.380164516 0.28973057 0.28495499 0.1964721487 0.13346432 0.195540766 0.23955118 0.179341841 0.175254268 0.2789351170 0.337580658 0.3156555863 0.45505891 1.000000000 0.42994818 0.38720438 0.503464861 0.453658123 0.264399201
V56 0.22064249 0.262263156 0.28766110 0.28093758 0.1993226385 0.16675809 0.174143165 0.27681852 0.232763850 0.151888872 0.2097515511 0.203120735 0.4215884810 0.39737788 0.429948175 1.00000000 0.51515432 0.463659327 0.430803621 0.349449360
V57 0.31372502 0.280341046 0.38081870 0.34025409 0.2193954389 0.16133321 0.186324030 0.26721176 0.193963443 0.140326569 0.1914070616 0.191264022 0.3081969253 0.36144280 0.387204379 0.51515432 1.00000000 0.509804942 0.431295271 0.287218633
V58 0.36813200 0.353041818 0.33410845 0.34486466 0.2387927721 0.20398559 0.242645518 0.28760303 0.231744665 0.212276583 0.3256651968 0.309673309 0.3707637990 0.40411668 0.503464861 0.46365933 0.50980494 1.000000000 0.550234975 0.329826737
V59 0.35711649 0.352199776 0.42504702 0.42026575 0.2909816293 0.22057301 0.183578101 0.19440011 0.097292793 0.058273306 0.3179416363 0.298710741 0.3460949347 0.44711786 0.453658123 0.43080362 0.43129527 0.550234975 1.000000000 0.642872023
V60 0.34707755 0.358761201 0.37394825 0.40062613 0.2537098705 0.17815765 0.222492825 0.14621601 0.095243111 0.097358118 0.2467644850 0.195378585 0.2807802354 0.28347080 0.264399201 0.34944936 0.28721863 0.329826737 0.642872023 1.000000000
Warning message:
“glm.fit: algorithm did not converge”Warning message:
“glm.fit: fitted probabilities numerically 0 or 1 occurred”
Call:
summary.resamples(object = results)

Models: SVM, CART, kNN, glm, lda 
Number of resamples: 30 

Accuracy 
          Min.   1st Qu.    Median      Mean   3rd Qu.      Max. NA's
SVM  0.7142857 0.8023810 0.8571429 0.8506638 0.9035714 0.9523810    0
CART 0.5500000 0.6666667 0.7142857 0.7157576 0.7619048 0.9047619    0
kNN  0.6500000 0.8196429 0.9000000 0.8699495 0.9090909 1.0000000    0
glm  0.5238095 0.6666667 0.7000000 0.7070635 0.7619048 0.9047619    0
lda  0.5714286 0.6666667 0.7500000 0.7444372 0.8095238 0.9523810    0

Kappa 
           Min.   1st Qu.    Median      Mean   3rd Qu.      Max. NA's
SVM  0.41121495 0.5934994 0.7096774 0.6950280 0.8049995 0.9049774    0
CART 0.04255319 0.3241273 0.4246455 0.4221056 0.5183179 0.8108108    0
kNN  0.30000000 0.6355114 0.7958971 0.7372650 0.8166667 1.0000000    0
glm  0.04545455 0.3273841 0.3999400 0.4113976 0.5234729 0.8090909    0
lda  0.13698630 0.3287671 0.5129665 0.4866521 0.6173061 0.9049774    0
Warning message in trControlCheck(x = trControl, y = target):
“x$savePredictions == TRUE is depreciated. Setting to 'final' instead.”Warning message in trControlCheck(x = trControl, y = target):
“indexes not defined in trControl.  Attempting to set them ourselves, so each model in the ensemble will have the same resampling indexes.”Warning message:
“glm.fit: algorithm did not converge”Warning message:
“glm.fit: fitted probabilities numerically 0 or 1 occurred”
The following models were ensembled: svmRadial, rpart, knn, glm, lda 
They were weighted: 
4.0191 -5.7612 0.085 -1.4433 -0.6825 0.2702
The resulting Accuracy is: 0.8778
The fit for each individual model on the Accuracy is: 
    method  Accuracy AccuracySD
 svmRadial 0.8669336 0.06281815
     rpart 0.7125397 0.09536742
       knn 0.8729004 0.06495796
       glm 0.7123521 0.11792499
       lda 0.7353752 0.09269090
In [ ]: