Make predictions from a fitted MLP or MONMLP model
Make predictions from a fitted MLP or MONMLP model
Make predictions from a fitted model or ensemble of MLP or MONMLP models.
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.
Returns
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.
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 nodesw.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 membersmatlines(x = x, y = do.call(cbind, attr(p.mon,"ensemble")), col ="cyan", lty =2)## Plot ensemble meanlines(x, p.mon, col ="blue", lwd =3)