| predict.nmfae | R Documentation |
predict.nmfae computes fitted or predicted values from a three-layer NMF model.
Without newY2, returns the in-sample fitted values X_1 \Theta X_2 Y_2.
With newY2, computes out-of-sample predictions X_1 \Theta X_2 \cdot \mathrm{newY2}.
When type = "class", each column is classified to the row with the
maximum predicted value (useful when Y_1 is a one-hot class matrix
from nmfkc.class).
If Y1 (actual values) is provided, it is stored as an attribute so that
plot.predict.nmfae can produce an observed-vs-predicted scatter plot
(for type = "response") or a confusion matrix heatmap
(for type = "class").
## S3 method for class 'nmfae'
predict(object, newY2 = NULL, Y1 = NULL, type = c("response", "class"), ...)
object |
An object of class |
newY2 |
Optional new input matrix (P2 x M) for prediction.
If |
Y1 |
Optional actual output matrix for comparison plotting. |
type |
Character. |
... |
Not used. |
For type = "response": a matrix of class "predict.nmfae".
For type = "class": a factor of class "predict.nmfae" with
predicted class labels. If Y1 was provided, actual classes are stored
in attr(result, "actual").
nmfae, plot.predict.nmfae,
nmfkc.class
set.seed(1)
Y <- matrix(runif(20), nrow = 4)
res <- nmf.rrr(Y, rank1 = 2)
pred <- predict(res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.