# Predict function to be used with redda output ------------------------
# Consistent with Conventions for R Modeling Packages
# https://tidymodels.github.io/model-implementation-principles/index.html
predict.redda <- function(object, new_data, ...){
if (!inherits(object, "redda"))
stop("object not of class \"redda\"")
classLabel <- names(object$Best$parameters$pro)
fite <- estep(
modelName = object$Best$model_name,
data = new_data,
parameters = object$Best$parameters
)
z <- fite$z
cl <-
factor(sapply(mclust::map(z), function(i)
classLabel[i]), levels = classLabel)
out <- list(class = cl, prob = z)
out
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.