Make predictions from a fitted MONMLP model

Description

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

Usage

1

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 MONMLP 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 predictand 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
set.seed(123)
x <- as.matrix(seq(-10, 10, length = 100))
y <- logistic(x) + rnorm(100, sd = 0.2)

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)
p.mon <- monmlp.predict(x = x, weights = w.mon)

## Plot predictions from ensemble members
for(i in 1:15)
    lines(x, attr(p.mon, "ensemble")[[i]], col = "cyan")

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