monmlp.predict {monmlp}R Documentation

Make predictions from a fitted MLP or MONMLP model

Description

Make predictions from a fitted model or ensemble of MLP or MONMLP models.

Usage

monmlp.predict(x, weights)

Arguments

x

covariate matrix with number of rows equal to the number of samples and number of columns equal to the number of covariates.

weights

list containing weight matrices and other parameters from monmlp.fit.

Value

a matrix with number of rows equal to the number of samples and number of columns equal to the number of response variables. If weights is from an ensemble of models, the matrix is the ensemble mean and the attribute ensemble contains a list with predictions for each ensemble member.

See Also

monmlp.fit

Examples

set.seed(123)
x <- as.matrix(seq(-10, 10, length = 100))
y <- logistic(x) + rnorm(100, sd = 0.2)

dev.new()
plot(x, y)
lines(x, logistic(x), lwd = 10, col = "gray")

## Ensemble of MONMLP models w/ 3 hidden nodes
w.mon <- monmlp.fit(x = x, y = y, hidden1 = 3, monotone = 1,
                    n.ensemble = 15, bag = TRUE, iter.max = 500,
                    control = list(trace = 0))
p.mon <- monmlp.predict(x = x, weights = w.mon)

## Plot predictions from ensemble members
matlines(x = x, y = do.call(cbind, attr(p.mon, "ensemble")),
         col = "cyan", lty = 2)

## Plot ensemble mean
lines(x, p.mon, col = "blue", lwd = 3)

[Package monmlp version 1.1.5 Index]