data(irismod)
i.TRAIN <- sample(1:nrow(irismod), 100)
model.logreg <- sofia(Is.Virginica ~ ., data=irismod[i.TRAIN,], learner_type="logreg-pegasos")
p <- predict(model.logreg, newdata=irismod[-1*i.TRAIN,], prediction_type = "logistic")
table(predicted=p>0.5, actual=irismod[-1*i.TRAIN,]$Is.Virginica)
model.pegasos <- sofia(Is.Virginica ~ ., data=irismod[i.TRAIN,], learner_type="pegasos")
d <- predict(model.pegasos, newdata=irismod[-1*i.TRAIN,], prediction_type = "linear")
table(predicted=d>0, actual=irismod[-1*i.TRAIN,]$Is.Virginica)
Run the code above in your browser using DataLab