CompactRegressionNeuralNetwork
statistics: CompactRegressionNeuralNetwork
Compact neural network regression
A CompactRegressionNeuralNetwork object holds a neural network
regression model that has dropped its training data.
Create a CompactRegressionNeuralNetwork object by using the
compact method of a RegressionNeuralNetwork object.
The compact model keeps what is needed to answer about new data, the layer
weights and biases, the activations, the standardization and the response
transform, and drops what only describes the fit: the predictor and
response data, the observation weights, the rows used, the number of
observations and the iteration by iteration training history.
predict and loss therefore agree with the full model to the
last digit, while resubPredict and resubLoss do not exist
here, there being no training data left to resubstitute.
See also: RegressionNeuralNetwork, fitrnet
Source Code: CompactRegressionNeuralNetwork
The CompactRegressionNeuralNetwork class contains the following properties:
A positive integer scalar. This property is read-only.
A cell array of character vectors. This property is read-only.
A character vector. This property is read-only.
A row vector with one entry per predictor, used for standardization. Empty when the predictor data were not standardized. This property is read-only.
A row vector with one entry per predictor, used for standardization. Empty when the predictor data were not standardized. This property is read-only.
A row vector of positive integers, one per hidden layer. This property is read-only.
A character vector, or a cell array of character vectors with one entry per hidden layer. This property is read-only.
A character vector. 'none' applies the identity, so a
prediction is an unrestricted real number. This property is read-only.
A cell array with one entry per layer, the output layer included. This property is read-only.
A cell array with one entry per layer, the output layer included. This property is read-only.
A numeric vector of column indices, and empty when none is. This property is read-only.
A cell array of character vectors. This property is read-only.
A function handle, applied by predict to the network’s output.
It may be set after construction, either to a handle or to the name of
a supported transformation.
The CompactRegressionNeuralNetwork class offers the following public methods:
CompactRegressionNeuralNetwork: yFit = predict (obj, XC)
yFit = predict (obj, XC) returns a column
vector holding the predicted response for each row of XC. It
agrees with the full model this object was compacted from.
CompactRegressionNeuralNetwork class object.
The new data may be a table, whose variables are matched to the predictors the model was fitted on by name and not by position: one the model was not fitted on is passed over, one it needs and cannot find is named, and a value holding a level is coded as that level was coded at fitting.
See also: CompactRegressionNeuralNetwork, RegressionNeuralNetwork
CompactRegressionNeuralNetwork: L = loss (obj, X, Y)
CompactRegressionNeuralNetwork: L = loss (obj, Tbl, ResponseVarName)
CompactRegressionNeuralNetwork: L = loss (obj, Tbl)
CompactRegressionNeuralNetwork: L = loss (…, name, value)
L = loss (obj, X, Y) returns the
weighted mean squared error between the response Y and the
response the model predicts for X.
CompactRegressionNeuralNetwork class object.
X may also be a table Tbl, whose variables are matched to
the predictors the model was fitted on by name and not by position.
loss (obj, Tbl, ResponseVarName) takes the
response from the variable ResponseVarName names, and
loss (obj, Tbl) from the variable the model was
fitted on. The response may also be given beside the table as
Y.
L = loss (…, name, value) accepts the
following Name-Value pairs.
| Name | Value |
|---|---|
'LossFun' | 'mse', the default, or a function
handle called as lossfun (Y, yFit, W)
and returning a scalar. |
'Weights' | A numeric vector of observation weights with one entry per row of X. It defaults to a uniform weight. The weights are normalized to sum to one before the loss is formed. |
See also: CompactRegressionNeuralNetwork, RegressionNeuralNetwork
CompactRegressionNeuralNetwork: savemodel (obj, filename)
savemodel (obj, filename) saves every property of
the CompactRegressionNeuralNetwork object obj into
filename in binary format, so that it can be read back with
loadmodel.
See also: loadmodel, CompactRegressionNeuralNetwork