| predict.nmfkc | R Documentation |
nmfkcpredict.nmfkc generates predictions from an object of class nmfkc,
either using the fitted covariates or a new covariate matrix.
When the model was fitted using a formula (Formula Mode), a newdata
data frame can be supplied instead of newA; the covariate matrix is
then constructed automatically from the stored formula metadata.
## S3 method for class 'nmfkc'
predict(object, newA = NULL, newdata = NULL, type = "response", ...)
object |
An object of class |
newA |
Optional. A new covariate matrix to be used for prediction. |
newdata |
Optional data frame. Only available when the model was fitted
using a formula. Covariate columns are extracted automatically using the
stored formula metadata. If both |
type |
Type of prediction to return. Options are "response" (fitted values matrix), "prob" (soft-clustering probabilities), or "class" (hard-clustering labels based on row names of X). |
... |
Further arguments passed to or from other methods. |
Depending on type: a numeric matrix ("response" or "prob")
or a character vector of class labels ("class").
nmfkc, nmfkc.cv
# Prediction with newA
Y <- matrix(cars$dist, nrow = 1)
A <- rbind(1, cars$speed)
result <- nmfkc(Y, A, rank = 1)
newA <- rbind(1, c(10, 20, 30))
predict(result, newA = newA)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.