Today, I finished the computing part and did exercises 4.1 and 4.2.
Computing:
#between-model comparisons
#set.seed(1056)
#logisticreg=train(Class~ ., data=GermanCreditTrain, method="glm",
# trcontrol=trainControl(method="repeatedcv", repeats=5))
#logisticreg
#resamp=resamples(list(SVM=svmfit, Logistic=logisticreg))
#summary(resamp)
#modeldifferences=diff(resamp)
#summary(modeldifference)
#kappa: sensitivity of output to changes or errors of input
Exercises 4.1 4.2
#choose data splitting method:
#nonrandom approaches
#random approaches: simple random sampling, stratified random sampling, maximum dissimilarity sampling
library(AppliedPredictiveModeling)
data(twoClassData)
str(predictors)
str(classes)
set.seed(1)
library(caret)
trainingrows=createDataPartition(classes, p=0.8, list=FALSE)
head(trainingrows)
trainpredictors=predictors[trainingrows, ]
trainclasses=classes[trainingrows]
testpredictors=predictors[-trainingrows, ]
testclasses=classes[-trainingrows]
trainpredictors
trainclasses
testpredictors
testclasses
Tomorrow, I will continue to do exercises of Chapter 4.
No comments:
Post a Comment