mlp: MLP neural network.

Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/mlp.R

Description

Fit MLP neural network.

Usage

1
2
3
4
5
6
mlp(y,m=frequency(y),hd=NULL,reps=20,comb=c("median","mean","mode"),
    lags=NULL,keep=NULL,difforder=NULL,outplot=c(FALSE,TRUE),
    sel.lag=c(TRUE,FALSE),allow.det.season=c(TRUE,FALSE),
    det.type=c("auto","bin","trg"),xreg=NULL, xreg.lags=NULL,
    xreg.keep=NULL,hd.auto.type=c("set","valid","cv","elm"),
    hd.max=NULL, ...)

Arguments

y

Input time series. Can be ts or msts object.

m

Frequency of the data.

hd

Number of hidden nodes. This can be a vector.

reps

Number of networks to train.

comb

Combination operator for forecasts when reps > 1. Can be "median", "mode" (based on KDE estimation) and "mean".

lags

Lags of y to use as inputs. If none provided then 1:frequency(y) is used. Use 0 for no univariate lags.

keep

Logical vector to force lags to stay in the model if sel.lag == TRUE. If NULL then it keep = rep(FALSE,length(lags)).

difforder

Vector including the differencing lags. For example c(1,12) will apply first and seasonal (12) differences. For no differencing use 0. For automatic selection use NULL.

outplot

Provide plot of model fit. Can be TRUE or FALSE.

sel.lag

Use selective lags only. Can be TRUE or FALSE.

allow.det.season

Permit modelling seasonality with deterministic dummies.

det.type

Type of deterministic seasonality dummies to use. This can be "bin" for binary or "trg" for a sine-cosine pair. With "auto" if ony a single seasonality is used and periodicity is up to 12 then "bin" is used, otherwise "trg".

xreg

Exogenous regressors. Each column is a different regressor and the sample size must be at least as long as the target in-sample set, but can be longer.

xreg.lags

This is a list containing the lags for each exogenous variable. Each list is a numeric vector containing lags. If xreg has 3 columns then the xreg.lags list must contain three elements. If NULL then it is automatically specified.

xreg.keep

List of logical vectors to force lags of xreg to stay in the model if sel.lag == TRUE. If NULL then all exogenous lags can be removed.

hd.auto.type

Used only if hd==NULL. "set" fixes hd=5. "valid" uses a 20% validation set (randomly) sampled to find the best number of hidden nodes. "cv" uses 5-fold cross-validation. "elm" uses ELM to estimate the number of hidden nodes (experimental).

hd.max

When hd.auto.type is set to either "valid" or "cv" then this argument can be used to set the maximum number of hidden nodes to evaluate, otherwise the maximum is set automatically.

...

Additional inputs for neuralnet function.

Value

An object of class "mlp". The function plot produces a plot the network architecture. An object of class "mlp" is a list containing the following elements:

net

MLP networks.

hd

Number of hidden nodes.

lags

Input lags used.

xreg.lags

xreg lags used.

difforder

Differencing used.

sdummy

Use of deterministic seasonality.

ff

Seasonal frequencies detected in data (taken from ts or msts object).

ff.det

Seasonal frequencies coded using deterministic dummies.

det.type

Type of determistic seasonality.

y

Input time series.

minmax

Scaling structure.

xreg.minmax

Scaling structure for xreg variables.

comb

Combination operator used.

fitted

Fitted values.

MSE

In-sample Mean Squared Error.

MSEH

If hd.auto.type is set to either "valid" or "cv" an array of the MSE error for each network size is provided. Otherwise this is NULL.

Note

To use mlp with Temporal Hierarchies (thief package) see mlp.thief.

Author(s)

Nikolaos Kourentzes, [email protected]

References

See Also

forecast.mlp, plot.mlp, mlp.thief, elm.

Examples

1
2
3
4
5
fit <- mlp(AirPassengers)
print(fit)
plot(fit)
frc <- forecast(fit,h=36)
plot(frc)

trnnick/TStools documentation built on Aug. 12, 2018, 4:31 a.m.