NNS.stack | R Documentation |
Prediction model using the predictions of the NNS base models NNS.reg as features (i.e. meta-features) for the stacked model.
NNS.stack(
IVs.train,
DV.train,
IVs.test = NULL,
type = NULL,
obj.fn = expression(sum((predicted - actual)^2)),
objective = "min",
optimize.threshold = TRUE,
dist = "L2",
CV.size = NULL,
balance = FALSE,
ts.test = NULL,
folds = 5,
order = NULL,
norm = NULL,
method = c(1, 2),
stack = TRUE,
dim.red.method = "cor",
pred.int = NULL,
status = TRUE,
ncores = NULL
)
IVs.train |
a vector, matrix or data frame of variables of numeric or factor data types. |
DV.train |
a numeric or factor vector with compatible dimensions to |
IVs.test |
a vector, matrix or data frame of variables of numeric or factor data types with compatible dimensions to |
type |
|
obj.fn |
expression; |
objective |
options: ("min", "max") |
optimize.threshold |
logical; |
dist |
options:("L1", "L2", "DTW", "FACTOR") the method of distance calculation; Selects the distance calculation used. |
CV.size |
numeric [0, 1]; |
balance |
logical; |
ts.test |
integer; NULL (default) Sets the length of the test set for time-series data; typically |
folds |
integer; |
order |
options: (integer, "max", NULL); |
norm |
options: ("std", "NNS", NULL); |
method |
numeric options: (1, 2); Select the NNS method to include in stack. |
stack |
logical; |
dim.red.method |
options: ("cor", "NNS.dep", "NNS.caus", "equal", "all") method for determining synthetic X* coefficients. |
pred.int |
numeric [0,1]; |
status |
logical; |
ncores |
integer; value specifying the number of cores to be used in the parallelized subroutine NNS.reg. If NULL (default), the number of cores to be used is equal to the number of cores of the machine - 1. |
Returns a vector of fitted values for the dependent variable test set for all models.
"NNS.reg.n.best"
returns the optimum "n.best"
parameter for the NNS.reg multivariate regression. "SSE.reg"
returns the SSE for the NNS.reg multivariate regression.
"OBJfn.reg"
returns the obj.fn
for the NNS.reg regression.
"NNS.dim.red.threshold"
returns the optimum "threshold"
from the NNS.reg dimension reduction regression.
"OBJfn.dim.red"
returns the obj.fn
for the NNS.reg dimension reduction regression.
"probability.threshold"
returns the optimum probability threshold for classification, else 0.5 when set to FALSE
.
"reg"
returns NNS.reg output.
"reg.pred.int"
returns the prediction intervals for the regression output.
"dim.red"
returns NNS.reg dimension reduction regression output.
"dim.red.pred.int"
returns the prediction intervals for the dimension reduction regression output.
"stack"
returns the output of the stacked model.
"pred.int"
returns the prediction intervals for the stacked model.
Incorporate any objective function from external packages (such as Metrics::mape
) via NNS.stack(..., obj.fn = expression(Metrics::mape(actual, predicted)), objective = "min")
Like a logistic regression, the (type = "CLASS")
setting is not necessary for target variable of two classes e.g. [0, 1]. The response variable base category should be 1 for multiple class problems.
Missing data should be handled prior as well using na.omit or complete.cases on the full dataset.
If error received:
"Error in is.data.frame(x) : object 'RP' not found"
reduce the CV.size
.
Fred Viole, OVVO Financial Systems
Viole, F. (2016) "Classification Using NNS Clustering Analysis" \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2139/ssrn.2864711")}
## Using 'iris' dataset where test set [IVs.test] is 'iris' rows 141:150.
## Not run:
NNS.stack(iris[1:140, 1:4], iris[1:140, 5], IVs.test = iris[141:150, 1:4], type = "CLASS")
## Using 'iris' dataset to determine [n.best] and [threshold] with no test set.
NNS.stack(iris[ , 1:4], iris[ , 5], type = "CLASS")
## Selecting NNS.reg and dimension reduction techniques.
NNS.stack(iris[1:140, 1:4], iris[1:140, 5], iris[141:150, 1:4], method = c(1, 2), type = "CLASS")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.