predict.osmultinom: Predict New Examples Based on Observation Specific...

Description Usage Arguments Details Value See Also Examples

View source: R/osmultinom.R

Description

Predict new examples in conjunction with osmultinom.

Usage

1
predict.osmultinom(object, newdata, type = c("class", "probs"), ...)

Arguments

object

Object of class "osmultinom".

newdata

A data.frame of cases to be classified or, if object has a formula, a data.frame with columns of the same names as the variables used. A vector will be interpreted as a row vector. If newdata is missing, an attempt will be made to retrieve the data used in osmultinom.

type

Type of output.

...

Arguments passed to or from other methods.

Details

This function is a method for the generic function predict() for class "osmultinom". It can be invoked by calling predict(x) for an object x of the appropriate class, or directly by calling predict.osmultinom(x) regardless of the class of the object.

Value

If type = "class", a factor containing the predicted class labels; if type = "probs", a matrix of class posterior probabilities. In case of a binary classification problem the matrix contains only the posteriors for the second factor level.

See Also

osmultinom, osnnet, predict.osnnet, predict.nnet, nnet.

Other observation_specific multinom: osmultinom

Examples

1
2
3
4
    fit <- osmultinom(Species ~ Sepal.Length + Sepal.Width, data = iris,
                      wf = "gaussian", bw = 0.5)
    pred <- predict(fit)
    mean(pred != iris$Species)

schiffner/locClass documentation built on May 29, 2019, 3:39 p.m.