R/predict_iris.R

Defines functions predict_iris

Documented in predict_iris

#' Iris classification on trained xgboost model
#'
#' @export
predict_iris <- function(Sepal.Length = 0, Sepal.Width = 0, Petal.Length = 0, Petal.Width = 0) {
  data_pred <- c(Sepal.Length, Sepal.Width, Petal.Length, Petal.Width)
  data_pred <- matrix(data_pred, nrow = 1)
  prob <- predict(object = model_iris, newdata = data_pred)
  label = iris_levels[which.max(prob)]
  return(list(label = label, prob = prob))
}
jeremiedb/PredictionEngine documentation built on Jan. 13, 2018, 12:09 p.m.