Parikshit Sanyal
09 Sep 18
The iris dataset contains the following parameters to describe the flower of a particular species
data(iris)
names(iris)
[1] "Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width"
[5] "Species"
This applications inputs the four parameters as slider values, and makes a scatter plot
plot(c(1,2,3,4),ylab='Params',pch=19,col='red')
The model is trained by the rpart method
inTrain <- createDataPartition(y=iris$Species,p=0.75,list=FALSE)
tr <- iris[inTrain,]
ts <- iris[-inTrain,]
mod_rpart <- train(Species ~ .,tr,method='rpart')
The outputs is generated by taking the inputs and passing them as a dataframe
output$species <- reactive(predict(mod_rpart,data.frame(Sepal.Length=input$Sepal.Length, Sepal.Width=input$Sepal.Width, Petal.Length=input$Petal.Length,
Petal.Width=input$Petal.Width)))
})