# doc-cache created by Octave 11.2.0
# name: cache
# type: cell
# rows: 3
# columns: 841
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
ClassificationDiscriminant


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1448
statistics: ClassificationDiscriminant

Discriminant analysis classification

The ClassificationDiscriminant class implements a
discriminant analysis classifier object, which can predict responses for
new data using the predict method.

Discriminant analysis classification is a statistical method used to
classify observations into predefined groups based on their
characteristics. It estimates the parameters of different distributions
for each class and predicts the class of new observations by finding the
one with the smallest misclassification cost.

Create a ClassificationDiscriminant object by using the
fitcdiscr function or the class constructor.

Six discriminant types are available, in two families. The linear family,
'linear' , 'diagLinear' and 'pseudoLinear' , pools
one covariance across the classes and separates them with a hyperplane.
The quadratic family, 'quadratic' , 'diagQuadratic' and
'pseudoQuadratic' , estimates a covariance per class and separates
them with a quadric. A 'diag' type keeps only the variances,
which is the same model as a Gamma of 1, and a 'pseudo'
type inverts a singular covariance rather than refusing it.

DiscrimType may be assigned after fitting, but only within
its own family : the family is fixed when the model is fitted, because it
decides which covariances the fit has to estimate. Assigning it, or
Gamma , re-derives Sigma , LogDetSigma and
Coeffs without refitting.

See also:
fitcdiscr


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
Discriminant analysis classification



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
ClassificationDiscriminant.BetweenSigma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 750
ClassificationDiscriminant: property BetweenSigma

Between-class covariance matrix

A P -by- P matrix holding the covariance of the class means
about the overall mean, weighted by how many observations each class
contributes. With n_k observations in class k ,
p_k = n_k / n and \bar{\mu} = \sum_k p_k \mu_k , it is

BetweenSigma = sum_k n_k (Mu(k,:) - mubar)' * (Mu(k,:) - mubar)
/ (n * (1 - sum_k p_k^2))

The denominator is the unbiased one for a weighted covariance, so a
balanced fit divides by n (K-1) / K . It reads the class
sizes , not Prior : assigning a prior leaves it where it was. It
is estimated for every discriminant type, the quadratic family included,
since it describes the classes rather than the fit. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Between-class covariance matrix



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
ClassificationDiscriminant.BinEdges


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 374
ClassificationDiscriminant: property BinEdges

Bin edges of the predictors

A cell array with one entry per predictor, holding that predictor&rsquo;s bin
edges where the learner discretized it before fitting. It is empty here
and stays empty: this learner fits the predictors as they are, and
MATLAB&rsquo;s reports an empty cell for it as well.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Bin edges of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
ClassificationDiscriminant.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 238
ClassificationDiscriminant: property CategoricalPredictors

Indices of the categorical predictors

A numeric vector of column indices into X naming the predictors
treated as categorical, and empty when none is. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
ClassificationDiscriminant.ClassNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 354
ClassificationDiscriminant: property ClassNames

Names of classes in the response variable

An array of unique values of the response variable Y , which has the
same data types as the data in Y . This property is read-only.
ClassNames can have any of the following datatypes:

Cell array of character vectors
Character array
Logical vector
Numeric vector


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Names of classes in the response variable



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 53
ClassificationDiscriminant.ClassificationDiscriminant


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3156
statistics: obj = ClassificationDiscriminant ( X , Y )
statistics: obj = ClassificationDiscriminant (&hellip;, name , value )

Create a ClassificationDiscriminant class object containing a
discriminant analysis model.

obj = ClassificationDiscriminant ( X , Y ) returns
a ClassificationDiscriminant object, with X as the predictor data
and Y containing the class labels of observations in X .

X must be a N&times;P numeric matrix of input data where rows
correspond to observations and columns correspond to features or
variables. X will be used to train the discriminant model.

Y is N&times;1 matrix or cell matrix containing the class labels
of corresponding predictor data in X . Y can contain any type
of categorical data. Y must have the same number of rows as
X .

obj = ClassificationDiscriminant (&hellip;, name ,
value ) returns a ClassificationDiscriminant object with parameters
specified by the following name , value paired input
arguments:

Name Value
'PredictorNames' A cell array of character
vectors specifying the names of the predictors. The length of this array
must match the number of columns in X .
'ResponseName' A character vector specifying the
name of the response variable.
'ClassNames' Names of the classes in the class
labels, Y , used for fitting the Discriminant model.
ClassNames are of the same type as the class labels in Y .
'Cost' An N&times;R numeric matrix containing
misclassification cost for the corresponding instances in X , where
R is the number of unique categories in Y . If an instance
is correctly classified into its category the cost is calculated to be 1,
otherwise 0. The cost matrix can be altered by using
Mdl .cost = somecost . By default, its value is
cost = ones (rows (X), numel (unique (Y))) .
'Prior' A numeric vector specifying the prior
probabilities for each class. The order of the elements in Prior
corresponds to the order of the classes in ClassNames .
Alternatively, you can specify 'empirical' to use the empirical
class probabilities or 'uniform' to assume equal class
probabilities.
'ScoreTransform' A user-defined function handle
or a character vector specifying one of the following builtin functions
specifying the transformation applied to predicted classification scores.
Supported values include 'doublelogit' , 'invlogit' ,
'ismax' , 'logit' , 'none' , 'identity' ,
'sign' , 'symmetric' , 'symmetricismax' , and
'symmetriclogit' .
'DiscrimType' A character vector or string scalar
specifying the type of discriminant analysis to perform. The only
supported value is 'linear' .
'FillCoeffs' A character vector or string scalar
with values 'on' or 'off' specifying whether to fill the
coefficients after fitting. If set to 'on' , the coefficients are
computed during model fitting, which can be useful for prediction.
'Gamma' A numeric scalar specifying the
regularization parameter for the covariance matrix. It adjusts the linear
discriminant analysis to make the model more stable in the presence of
multicollinearity or small sample sizes. A value of 0 corresponds to no
regularization, while a value of 1 corresponds to
a completely regularized model.

See also:
fitcdiscr


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 90
Create a ClassificationDiscriminant class object containing a discriminant analysis model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
ClassificationDiscriminant.Coeffs


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 872
ClassificationDiscriminant: property Coeffs

Coefficient matrices

A K&times;K structure containing the coefficient matrices, where
K is the number of classes. If the 'FillCoeffs' parameter
was set to 'off' in either the fitcdiscr function or the
ClassificationDiscriminant constructor, then Coeffs is
empty ([]) . This property is read-only.

Coeffs(i,j) contains the coefficients of the boundary between
the classes i and j in the following fields:

DiscrimType - A character vector
Class1 - ClassNames (i)
Class2 - ClassNames (j)
Const - A scalar
Linear - A vector with length as the number of predictors.
Quadratic - The quadratic family only. A PxP
matrix, or a 1xP vector for 'diagQuadratic' , following
the shape of Sigma .

The diagonal entries carry the two class names and nothing else. The
structure is rebuilt whenever DiscrimType , Gamma or
Prior is assigned.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Coefficient matrices



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
ClassificationDiscriminant.Cost


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1205
ClassificationDiscriminant: property Cost

Cost of Misclassification

A square matrix specifying the cost of misclassification of a point.
Cost(i,j) is the cost of classifying a point into class j
if its true class is i (that is, the rows correspond to the true
class and the columns correspond to the predicted class). The order of
the rows and columns in Cost corresponds to the order of the
classes in ClassNames . The number of rows and columns in
Cost is the number of unique classes in the response. By
default, Cost(i,j) = 1 if i != j , and
Cost(i,j) = 0 if i = j . In other words, the cost is 0
for correct classification and 1 for incorrect classification.

Add or change the Cost property using dot notation as in:

obj .Cost = costMatrix

A cost may also be given as a struct with the fields
ClassNames and ClassificationCosts , which names the
order its own matrix is written in. That matrix is permuted into the
order of ClassNames above, so a caller need not know which
order the classes were sorted into. It must name every class.

A cost must be floating point, not sparse, not complex, non-negative
and zero down its diagonal, and must hold no NaN or
Inf . A single is widened to double .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
Cost of Misclassification



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
ClassificationDiscriminant.Delta


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 809
ClassificationDiscriminant: property Delta

Delta threshold for the linear coefficients

A nonnegative scalar that eliminates predictors. A per-class linear
coefficient is set to zero when it falls below Delta , and the
comparison is made on the standardized coefficient, the
coefficient times the within-class standard deviation of its predictor.
Scaling matters here: a threshold on the raw coefficients would depend
on the units each predictor is measured in, so the same model in
centimetres and in metres would drop different predictors.

DeltaPredictor reports, per predictor, the value at which it
drops out of every class at once.

It applies to the linear family only, a quadratic discriminant having no
linear coefficients to eliminate. Assigning it rebuilds Coeffs
and changes what predict answers.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
Delta threshold for the linear coefficients



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
ClassificationDiscriminant.DeltaPredictor


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 482
ClassificationDiscriminant: property DeltaPredictor

Minimum Delta at which each predictor drops out

A row vector with one entry per predictor, the value of Delta at
which that predictor&rsquo;s coefficient is zero for every class and the
predictor leaves the model altogether. It is all zeros for the
quadratic family, which has no linear coefficients to eliminate.

This property is read-only, and it describes the fit rather than the
threshold: assigning Delta does not move it.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
Minimum Delta at which each predictor drops out



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
ClassificationDiscriminant.DiscrimType


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 796
ClassificationDiscriminant: property DiscrimType

Discriminant type

A character vector naming the discriminant model, one of
'linear' , 'quadratic' , 'diagLinear' ,
'diagQuadratic' , 'pseudoLinear' or
'pseudoQuadratic' . A linear type pools one covariance across
the classes; a quadratic type estimates one per class. A
'diag' type keeps only the variances, and a 'pseudo'
type inverts a singular covariance instead of refusing it.

This property may be assigned, but only within its own family :
the three linear types interchange freely and so do the three quadratic
ones, while no assignment moves a model between the two. The family is
fixed when the model is fitted, because it decides which covariances the
fit has to estimate. Assigning re-derives Sigma ,
LogDetSigma , Gamma and Coeffs .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
Discriminant type



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
ClassificationDiscriminant.ExpandedPredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 271
ClassificationDiscriminant: property ExpandedPredictorNames

Names of the predictors as the model expanded them

A cell array of character vectors. It matches PredictorNames
unless a categorical predictor was expanded into indicator variables.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
Names of the predictors as the model expanded them



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
ClassificationDiscriminant.Gamma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 513
ClassificationDiscriminant: property Gamma

Gamma regularization parameter

A scalar from 0 to 1 shrinking the covariance towards its diagonal.
Gamma and DiscrimType are one state: a value of 1 is the
diagonal type, so assigning it renames DiscrimType to
'diagLinear' or 'diagQuadratic' , and assigning a
diagonal type sets Gamma to 1.

The quadratic family admits 0 and 1 only. A value below
MinGamma is refused, since it would leave the covariance
singular. Assigning re-derives Sigma , LogDetSigma and
Coeffs .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
Gamma regularization parameter



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 60
ClassificationDiscriminant.HyperparameterOptimizationResults


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 369
ClassificationDiscriminant: property HyperparameterOptimizationResults

Results of the hyperparameter optimization

Always empty. It is declared for MATLAB compatibility, where
it holds what an automatic search over the hyperparameters found. This
class fits the parameters it is given and runs no such search, so there
is nothing to report. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Results of the hyperparameter optimization



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
ClassificationDiscriminant.LogDetSigma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 618
ClassificationDiscriminant: property LogDetSigma

Logarithm of the determinant of the within-class covariance matrix

A scalar for the linear family and a Kx1 vector for the quadratic
one, one entry per class. It is computed in correlation space, as the
sum of the logarithms of the predictor variances plus the log
determinant of the correlation matrix, which is far better conditioned
than the covariance when the data are nearly collinear. A predictor
with no variance contributes nothing rather than an infinity, and the
'pseudo' types sum only over the directions that carry variance.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 66
Logarithm of the determinant of the within-class covariance matrix



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
ClassificationDiscriminant.MinGamma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 444
ClassificationDiscriminant: property MinGamma

Minimum value for the Gamma regularization parameter

A scalar from 0 to 1, the least regularization that leaves the
correlation matrix invertible. It is 0 when the matrix is already
invertible, and positive when the predictors are collinear, in which
case a plain 'linear' or 'quadratic' fit is raised to it
rather than failing. Assigning a Gamma below it is refused.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 52
Minimum value for the Gamma regularization parameter



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
ClassificationDiscriminant.ModelParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 477
ClassificationDiscriminant: property ModelParameters

Fitting options, as they were given

A structure holding the parameters of the fit: DiscrimType ,
Gamma , Delta , FillCoeffs , and the
Version , Method and Type tags.

MATLAB reports a SaveMemory field beside these. This class
has no such option and always stores the full covariance, so there is
no setting to report and the field is absent rather than answering for
a knob that does not exist. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
Fitting options, as they were given



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
ClassificationDiscriminant.Mu


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 271
ClassificationDiscriminant: property Mu

Class means

A K&times;P numeric matrix specifying the mean of the multivariate
normal distribution of each corresponding class, where K is the
number of classes and P is the number of predictors in X .
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
Class means



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
ClassificationDiscriminant.NumObservations


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 248
ClassificationDiscriminant: property NumObservations

Number of observations

A positive integer value specifying the number of observations in the
training dataset used for training the ClassificationDiscriminant model.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Number of observations



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
ClassificationDiscriminant.NumPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 242
ClassificationDiscriminant: property NumPredictors

Number of predictors

A positive integer value specifying the number of predictors in the
training dataset used for training the ClassificationDiscriminant model.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Number of predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
ClassificationDiscriminant.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 266
ClassificationDiscriminant: property PredictorNames

Names of predictor variables

A cell array of character vectors specifying the names of the predictor
variables. The names are in the order in which they appear in the
training dataset. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
Names of predictor variables



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
ClassificationDiscriminant.Prior


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 619
ClassificationDiscriminant: property Prior

Prior probability for each class

A numeric vector specifying the prior probabilities for each class. The
order of the elements in Prior corresponds to the order of the
classes in ClassNames .

Add or change the Prior property using dot notation as in:

obj .Prior = priorVector

Specified as a row vector with one entry per class, in the order of
ClassNames , and rescaled to sum to one. It may be given as
'empirical' , 'uniform' , a numeric vector, or a
structure with ClassNames and ClassProbs fields, which
assigns each probability by class name rather than by position.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Prior probability for each class



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
ClassificationDiscriminant.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 170
ClassificationDiscriminant: property ResponseName

Response variable name

A character vector specifying the name of the response variable Y .
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Response variable name



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
ClassificationDiscriminant.RowsUsed


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 404
ClassificationDiscriminant: property RowsUsed

Rows used for fitting

A logical column vector with the same length as the observations in the
original predictor data X , true for each row that was used for
fitting the ClassificationDiscriminant model. It is empty, [] ,
when every observation was used, so a non-empty value means that rows
holding missing values were dropped. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
Rows used for fitting



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
ClassificationDiscriminant.ScoreTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1006
ClassificationDiscriminant: property ScoreTransform

Transformation function for classification scores

Specified as a function handle for transforming the classification
scores. Add or change the ScoreTransform property using dot
notation as in:

obj .ScoreTransform = 'function_name'
obj .ScoreTransform = @function_handle

When specified as a character vector, it can be any of the following
built-in functions. Nevertheless, the ScoreTransform property
always stores their function handle equivalent.

Value Description
'doublelogit' 1 ./ (1 + exp (-2 &times; x))
'invlogit' log (x ./ (1 - x))
'ismax' Sets the score for the class with the
largest score to 1, and for all other classes to 0
'logit' 1 ./ (1 + exp (-x))
'none' x (no transformation)
'identity' x (no transformation)
'sign' -1 for x < 0, 0 for x = 0, 1 for x >
0
'symmetric' 2 &times; x - 1
'symmetricismax' Sets the score for the class
with the largest score to 1, and for all other classes to -1
'symmetriclogit' 2 ./ (1 + exp (-x)) - 1


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Transformation function for classification scores



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
ClassificationDiscriminant.Sigma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 512
ClassificationDiscriminant: property Sigma

Within-class covariance

A numeric array whose shape follows DiscrimType , with P
predictors and K classes:

DiscrimType Sigma LogDetSigma
'linear' , 'pseudoLinear' PxP
scalar
'quadratic' , 'pseudoQuadratic' PxPxK
Kx1
'diagLinear' 1xP scalar
'diagQuadratic' 1xPxK Kx1

The linear family pools one covariance across the classes and the
quadratic family estimates one per class. This property is read-only,
but it is re-derived whenever DiscrimType or Gamma is
assigned.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
Within-class covariance



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
ClassificationDiscriminant.W


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 231
ClassificationDiscriminant: property W

Observation weights

A numeric column vector with one entry per observation used for fitting.
Every observation carries the same weight, so the vector sums
to one. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
Observation weights



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
ClassificationDiscriminant.X


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 241
ClassificationDiscriminant: property X

Predictor data

A numeric matrix containing the unstandardized predictor data. Each
column of X represents one predictor (variable), and each row
represents one observation. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
Predictor data



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
ClassificationDiscriminant.XCentered


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 217
ClassificationDiscriminant: property XCentered

Predictor data with class means subtracted

A matrix of the same size as X and the values in X with the
corresponding class means subtracted. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Predictor data with class means subtracted



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
ClassificationDiscriminant.Y


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 318
ClassificationDiscriminant: property Y

Class labels

Specified as a logical or numeric column vector, or as a character array
or a cell array of character vectors with the same number of rows as the
predictor data. Each row in Y is the observed class label for
the corresponding row in X . This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
Class labels



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
ClassificationDiscriminant.compact


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 286
ClassificationDiscriminant: CVMdl = compact ( obj )

Create a CompactClassificationDiscriminant object.

CVMdl = compact ( obj ) creates a compact version of the
ClassificationDiscriminant object, obj .

See also:
fitcdiscr,
ClassificationDiscriminant,
CompactClassificationDiscriminant


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
Create a CompactClassificationDiscriminant object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
ClassificationDiscriminant.crossval


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1076
ClassificationDiscriminant: CVMdl = crossval ( obj )
ClassificationDiscriminant: CVMdl = crossval (&hellip;, Name , Value )

Cross Validate a Discriminant classification object.

CVMdl = crossval ( obj ) returns a cross-validated model
object, CVMdl , from a trained model, obj , using 10-fold
cross-validation by default.

CVMdl = crossval ( obj , name , value )
specifies additional name-value pair arguments to customize the
cross-validation process.

Name Value
'KFold' Specify the number of folds to use in
k-fold cross-validation. "KFold", k , where k is an
integer greater than 1.
'Holdout' Specify the fraction of the data to
hold out for testing. "Holdout", p , where p is a
scalar in the range (0,1) .
'Leaveout' Specify whether to perform
leave-one-out cross-validation. "Leaveout", Value , where
Value is &rsquo;on&rsquo; or &rsquo;off&rsquo;.
'CVPartition' Specify a cvpartition
object used for cross-validation. "CVPartition", cv , where
isa ( cv , "cvpartition") = 1.

See also:
fitcdiscr,
ClassificationDiscriminant,
cvpartition,
ClassificationPartitionedModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 52
Cross Validate a Discriminant classification object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
ClassificationDiscriminant.cvshrink


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1862
ClassificationDiscriminant: err = cvshrink ( obj )
ClassificationDiscriminant: [ err , gamma ] = cvshrink ( obj )
ClassificationDiscriminant: [ err , gamma , delta ] = cvshrink ( obj )
ClassificationDiscriminant: [ err , gamma , delta , numpred ] = cvshrink ( obj )
ClassificationDiscriminant: [&hellip;] = cvshrink (&hellip;, Name , Value )

Cross validate the regularization of a discriminant.

err = cvshrink ( obj ) cross validates obj over a
grid of Gamma values and returns the misclassification rate at
each of them, so that a regularization can be chosen by what it costs
on held-out data rather than on the data it was fitted to.

[ err , gamma , delta , numpred ] = cvshrink
( obj ) also returns the grid itself and the number of predictors
surviving at each point of it. gamma is a column with one entry
per Gamma ; err , delta and numpred carry one
row per Gamma and one column per Delta .

Name Value
'NumGamma' The number of Gamma intervals, a
positive integer, 10 by default, giving NumGamma + 1 values
evenly spaced from 0 to 1.
'NumDelta' The number of Delta intervals, a
non-negative integer, 0 by default. For each Gamma the
Delta values run from 0 to the point at which every predictor
has been eliminated, so the grid is not the same in every row.
'Gamma' The Gamma values to try, given
explicitly as a vector, in place of 'NumGamma' .
'Delta' The Delta values to try, given
explicitly, in place of 'NumDelta' : a vector used for every
Gamma , or a matrix with one row per Gamma .

Every point of the grid is cross validated against the same partition,
so the errors differ by the regularization and not by the split. The
partition is drawn at random, so err is not reproducible across
runs and does not match MATLAB&rsquo;s; gamma , delta and
numpred are deterministic and do.

See also:
ClassificationDiscriminant,
fitcdiscr,
nLinearCoeffs


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 52
Cross validate the regularization of a discriminant.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
ClassificationDiscriminant.edge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 617
ClassificationDiscriminant: e = edge ( obj , X , Y )
ClassificationDiscriminant: e = edge (&hellip;, "Weights" , w )

Classification edge, the mean of the classification margins.

e = edge ( obj , X , Y ) reduces the vector
that margin returns to a single number, the mean margin over the
rows of X . It says how far the model puts the true class ahead of
its nearest rival on average, so a larger edge is a better model, and
unlike a loss it is not bounded above and rewards confidence rather than
bare correctness.

e = edge (&hellip;, "Weights" , w ) takes the
weighted mean instead, with one weight per row of X .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 60
Classification edge, the mean of the classification margins.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
ClassificationDiscriminant.logp


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 690
ClassificationDiscriminant: lp = logp ( obj , X )

Log unconditional probability density of the observations.

lp = logp ( obj , X ) returns an Nx1
vector holding, for each row of X , the natural logarithm of
P(x) = sum_k P(k) P(x|k) , the density of the observation summed
over the classes with each class weighted by its prior P(k) .
Each P(x|k) is the multivariate normal density of class
k .

obj must be a ClassificationDiscriminant object.

X must be an NxP numeric matrix with one column per
predictor of the trained model.

An unusually low value marks an observation the model finds unlikely
under every class, which is what makes this an outlier test rather
than a classification.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 58
Log unconditional probability density of the observations.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
ClassificationDiscriminant.loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1930
ClassificationDiscriminant: L = loss ( obj , X , Y )
ClassificationDiscriminant: L = loss (&hellip;, name , value )

Compute loss for a trained ClassificationDiscriminant object.

L = loss ( obj , X , Y ) computes the loss,
L , using the default loss function 'mincost' .

obj is a ClassificationDiscriminant object trained on
X and Y .

X must be a N&times;P numeric matrix of input data where rows
correspond to observations and columns correspond to features or
variables.

Y is N&times;1 matrix or cell matrix containing the class labels
of corresponding predictor data in X . Y must have same
numbers of Rows as X .

L = loss (&hellip;, name , value ) allows
additional options specified by name - value pairs:

Name Value
'LossFun' Specifies the loss function to use.
Can be a function handle with four input arguments (C, S, W, Cost)
which returns a scalar value or one of:
&rsquo;binodeviance&rsquo;, &rsquo;classifcost&rsquo;, &rsquo;classiferror&rsquo;, &rsquo;exponential&rsquo;,
&rsquo;hinge&rsquo;, &rsquo;logit&rsquo;,&rsquo;mincost&rsquo;, &rsquo;quadratic&rsquo;.

C is a logical matrix of size N&times;K , where N is the
number of observations and K is the number of classes.
The element C(i,j) is true if the class label of the i-th
observation is equal to the j-th class.

S is a numeric matrix of size N&times;K , where each element
represents the classification score for the corresponding class.

W is a numeric vector of length N , representing
the observation weights.

Cost is a K&times;K matrix representing the misclassification
costs.

'Weights' Specifies observation weights, must be
a numeric vector of length equal to the number of rows in X.
Default is ones (size (X, 1)) . loss normalizes the weights so that
observation weights in each class sum to the prior probability of that
class. When you supply Weights, loss computes the weighted
classification loss.

See also:
ClassificationDiscriminant


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 61
Compute loss for a trained ClassificationDiscriminant object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
ClassificationDiscriminant.mahal


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1013
ClassificationDiscriminant: M = mahal ( obj , X )
ClassificationDiscriminant: M = mahal (&hellip;, 'ClassLabels' , labels )

Squared Mahalanobis distance to the class means.

M = mahal ( obj , X ) returns an NxK
matrix whose element (i,j) is the squared Mahalanobis distance
from observation i to the mean of class j , measured
against the covariance that class carries: the one shared covariance
for a linear discriminant and the class&rsquo;s own for a quadratic one.

obj must be a ClassificationDiscriminant object.

X must be an NxP numeric matrix with one column per
predictor of the trained model.

M = mahal (&hellip;, 'ClassLabels' , labels )
returns an Nx1 vector instead, holding for each observation the
distance to the mean of the class labels names for it.
labels must have one entry per row of X , each of them one
of ClassNames .

The distance is measured against the covariance the model reports, so
a regularized model is measured against its regularized covariance.
The prior does not enter it.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Squared Mahalanobis distance to the class means.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
ClassificationDiscriminant.margin


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 842
ClassificationDiscriminant: m = margin ( obj , X , Y )

Classification margins for discriminant analysis classifier.

m = margin ( obj , X , Y ) returns
the classification margins for obj with data X and
classification Y . m is a numeric vector of length size (X,1).

obj is a ClassificationDiscriminant object trained on
X
and Y .

X must be a N&times;P numeric matrix of input data where rows
correspond to observations and columns correspond to features or
variables.

Y is N&times;1 matrix or cell matrix containing the class labels
of corresponding predictor data in X . Y must have same
numbers of Rows as X .

The classification margin for each observation is the difference between
the classification score for the true class and the maximal
classification score for the false classes.

See also:
fitcdiscr,
ClassificationDiscriminant


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 60
Classification margins for discriminant analysis classifier.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
ClassificationDiscriminant.nLinearCoeffs


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 887
ClassificationDiscriminant: n = nLinearCoeffs ( obj )
ClassificationDiscriminant: n = nLinearCoeffs ( obj , delta )

Number of nonzero linear coefficients at a regularization threshold.

n = nLinearCoeffs ( obj ) returns the number of
predictors the discriminant keeps at its own Delta .

n = nLinearCoeffs ( obj , delta ) returns the
number it would keep at each threshold in delta , as a column
vector however delta is shaped.

A predictor survives a threshold when its DeltaPredictor reaches
it, the comparison including equality, so delta at exactly a
predictor&rsquo;s own value still counts it. A threshold above every
DeltaPredictor therefore leaves nothing and returns zero.

The count is taken whatever the DiscrimType , as MATLAB takes it,
even though Delta regularizes the linear types alone.

See also:
fitcdiscr,
ClassificationDiscriminant,
CompactClassificationDiscriminant


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 68
Number of nonzero linear coefficients at a regularization threshold.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
ClassificationDiscriminant.predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1430
ClassificationDiscriminant: label = predict ( obj , XC )
ClassificationDiscriminant: [ label , score , cost ] = predict ( obj , XC )

Classify new data points into categories using the discriminant
analysis model from a ClassificationDiscriminant object.

label = predict ( obj , XC ) returns the vector of
labels predicted for the corresponding instances in XC , using the
predictor data in obj.X and corresponding labels, obj.Y ,
stored in the ClassificationDiscriminant model, obj .

obj must be a ClassificationDiscriminant class object.

XC must be an M&times;P numeric matrix with the same number of
features P as the corresponding predictors of the discriminant
model in obj .

[ label , score , cost ] = predict ( obj ,
XC ) also returns score , which contains the predicted class
scores or posterior probabilities for each instance of the corresponding
unique classes, and cost , which is a matrix containing the expected
cost of the classifications.

The score matrix contains the posterior probabilities for each
class, calculated using the multivariate normal probability density
function and the prior probabilities of each class. These scores are
normalized to ensure they sum to 1 for each observation.

The cost matrix contains the expected classification cost for each
class, computed based on the posterior probabilities and the specified
misclassification costs.

See also:
ClassificationDiscriminant,
fitcdiscr


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 120
Classify new data points into categories using the discriminant analysis model from a ClassificationDiscriminant object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
ClassificationDiscriminant.resubEdge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 219
ClassificationDiscriminant: e = resubEdge ( obj )

Classification edge of the model on its own training data.

e = resubEdge ( obj ) is edge applied to the
observations the model was fitted on, the mean of resubMargin .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 58
Classification edge of the model on its own training data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
ClassificationDiscriminant.resubLoss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 594
ClassificationDiscriminant: L = resubLoss ( obj )
ClassificationDiscriminant: L = resubLoss (&hellip;, name , value )

Classification loss of the model on its own training data.

L = resubLoss ( obj ) is loss applied to the
observations the model was fitted on, defaulting to
'mincost' , and it accepts the same Name-Value pairs.

Being a resubstitution quantity it is a lower bound on the error rather
than an estimate of it. It is worth least on a lazy learner: a
one-neighbour ClassificationKNN has a resubstitution loss of
exactly zero, every training point being its own nearest neighbour.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 58
Classification loss of the model on its own training data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
ClassificationDiscriminant.resubMargin


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 296
ClassificationDiscriminant: m = resubMargin ( obj )

Classification margins of the model on its own training data.

m = resubMargin ( obj ) is margin applied to the
observations the model was fitted on, one number per observation. Being
a resubstitution quantity it is optimistic by construction.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 61
Classification margins of the model on its own training data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
ClassificationDiscriminant.resubPredict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 630
ClassificationDiscriminant: label = resubPredict ( obj )
ClassificationDiscriminant: [ label , score , cost ] = resubPredict ( obj )

Classify the training data with the model fitted to it.

label = resubPredict ( obj ) is predict applied
to the observations the model was fitted on, which it holds in
X . Handing them over yourself is not the same thing: a row
dropped for a missing response is not in X , so the original
matrix and the model&rsquo;s own are different data.

The result measures fit and not generalization, and is optimistic by
construction. crossval is what estimates performance on data the
model has not seen.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 55
Classify the training data with the model fitted to it.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
ClassificationDiscriminant.savemodel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 510
ClassificationDiscriminant: savemodel ( obj , filename )

Save a ClassificationDiscriminant object.

savemodel ( obj , filename ) saves each property of a
ClassificationDiscriminant object into an Octave binary file, the name of
which is specified in filename , along with an extra variable, which
defines the type classification object these variables constitute. Use
loadmodel in order to load a classification object into Octave&rsquo;s
workspace.

See also:
loadmodel,
fitcdiscr,
ClassificationDiscriminant


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Save a ClassificationDiscriminant object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
ClassificationGAM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2023
statistics: ClassificationGAM

Generalized additive model classification

The ClassificationGAM class implements a gradient boosting
algorithm for classification. This approach allows the model to capture
non-linear relationships between predictors and the binary response
variable.

Generalized additive model classification is a statistical method that
extends linear models by allowing non-linear relationships between each
predictor and the response variable through smooth functions. It combines
the interpretability of linear models with the flexibility of
non-parametric methods.

Create a ClassificationGAM object by using the fitcgam
function or the class constructor.

Two weak learners are available, selected by FitMethod .

'boostedtrees' , the default, boosts one shallow decision tree per
predictor in each round, which is the scheme MATLAB&rsquo;s generalized
additive model uses. A second phase then boosts trees over pairs of
predictors, where interactions are asked for.

'splines' boosts a smoothing spline per predictor over
NumIterations passes. It has no MATLAB counterpart and is an
Octave extension, kept because a smooth additive fit is a genuinely
different and often better answer than a staircase of stumps.

The two take different arguments, and an argument meant for one is
refused by the other rather than ignored.

The choice is visible in the properties. Knots , Order ,
DoF , Formula , LearningRate , NumIterations ,
BaseModel , ModelwInt and IntMatrix describe a spline
fit and are empty under the boosted-tree engine, while
ModelParameters , ReasonForTermination , BinEdges ,
PairDetectionBinEdges and TreeModel describe a tree fit and
are empty under the spline engine.

Fitted values are not expected to equal MATLAB&rsquo;s even under
'boostedtrees' . The stopping rule and the step-reduction limit
are not recoverable from anything MATLAB reports, so this engine
documents its own; what the two share is the estimator and the reported
surface, not the arithmetic.

See also:
fitcgam


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Generalized additive model classification



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
ClassificationGAM.BaseModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 288
ClassificationGAM: property BaseModel

Base model parameters

A structure containing the parameters of the base model without any
interaction terms. The base model represents the generalized additive
model with only the main effects (predictor terms) included.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
Base model parameters



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
ClassificationGAM.BinEdges


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 475
ClassificationGAM: property BinEdges

Bin edges of the predictors

A cell array with one entry per predictor, holding that predictor&rsquo;s bin
edges where the model discretized it before fitting. It is empty here
and stays empty: this generalized additive model is built from splines,
which take the predictors as they are, where MATLAB&rsquo;s is built from
boosted trees and bins them. That difference is described in the class
documentation.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Bin edges of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
ClassificationGAM.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 219
ClassificationGAM: property CategoricalPredictors

Indices of the categorical predictors

A numeric vector holding the column of each predictor treated as
categorical, and empty when none is. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
ClassificationGAM.ClassNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 345
ClassificationGAM: property ClassNames

Names of classes in the response variable

An array of unique values of the response variable Y , which has the
same data types as the data in Y . This property is read-only.
ClassNames can have any of the following datatypes:

Cell array of character vectors
Character array
Logical vector
Numeric vector


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Names of classes in the response variable



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
ClassificationGAM.ClassificationGAM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3603
statistics: obj = ClassificationGAM ( X , Y )
statistics: obj = ClassificationGAM (&hellip;, name , value )

Create a ClassificationGAM class object containing a generalized
additive classification model.

obj = ClassificationGAM ( X , Y ) returns
a ClassificationGAM object, with X as the predictor data
and Y containing the class labels of observations in X .

X must be a N&times;P numeric matrix of input data where rows
correspond to observations and columns correspond to features or
variables. X will be used to train the GAM model.

Y is N&times;1 matrix or cell matrix containing the class labels
of corresponding predictor data in X . Y can contain any type
of categorical data. Y must have the same number of rows as
X .

obj = ClassificationGAM (&hellip;, name ,
value ) returns a ClassificationGAM object with parameters
specified by the following name , value paired input
arguments:

Name Value
'PredictorNames' A cell array of character
vectors specifying the names of the predictors. The length of this array
must match the number of columns in X .
'ResponseName' A character vector specifying the
name of the response variable.
'ClassNames' Names of the classes in the class
labels, Y , used for fitting the GAM model.
ClassNames are of the same type as the class labels in Y .
'Cost' An N&times;R numeric matrix containing
misclassification cost for the corresponding instances in X , where
R is the number of unique categories in Y . If an instance
is correctly classified into its category the cost is calculated to be 1,
otherwise 0. The cost matrix can be altered by using
Mdl .cost = somecost . By default, its value is
cost = ones (rows (X), numel (unique (Y))) .
'Prior' A numeric vector specifying the prior
probabilities for each class. The order of the elements in Prior
corresponds to the order of the classes in ClassNames .
Alternatively, you can specify 'empirical' to use the empirical
class probabilities or 'uniform' to assume equal class
probabilities.
'ScoreTransform' A user-defined function handle
or a character vector specifying one of the following builtin functions
specifying the transformation applied to predicted classification scores.
Supported values include 'doublelogit' , 'invlogit' ,
'ismax' , 'logit' , 'none' , 'identity' ,
'sign' , 'symmetric' , 'symmetricismax' , and
'symmetriclogit' .
'Formula' (spline option) A character vector
specifying the model
formula in the form 'Y ~ terms' where Y represents the
response variable and terms specifies the predictor variables and
interaction terms.
'Interactions' A logical matrix, a positive
integer scalar, or the string 'all' for defining the interactions
between predictor variables.
'Knots' (spline option) A scalar or row vector
specifying the
number of knots for each predictor variable in the spline fitting.
'Order' (spline option) A scalar or row vector
specifying the
order of the spline for each predictor variable.
'DoF' (spline option) A scalar or row vector
specifying the
degrees of freedom for each predictor variable in the spline fitting.
'LearningRate' (spline option) A scalar value between
0 and 1
specifying the learning rate used in the gradient boosting algorithm.
'NumIterations' (spline option) A positive integer
specifying
the maximum number of iterations for the gradient boosting algorithm.

A row marked (spline option) belongs to the spline
engine and requires 'FitMethod', 'splines' ; passing one
under the default boosted-tree engine is an error rather than
being ignored. The boosted-tree engine&rsquo;s own options are
documented under fitcgam .

See also:
fitcgam


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 95
Create a ClassificationGAM class object containing a generalized additive classification model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
ClassificationGAM.Cost


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1196
ClassificationGAM: property Cost

Cost of Misclassification

A square matrix specifying the cost of misclassification of a point.
Cost(i,j) is the cost of classifying a point into class j
if its true class is i (that is, the rows correspond to the true
class and the columns correspond to the predicted class). The order of
the rows and columns in Cost corresponds to the order of the
classes in ClassNames . The number of rows and columns in
Cost is the number of unique classes in the response. By
default, Cost(i,j) = 1 if i != j , and
Cost(i,j) = 0 if i = j . In other words, the cost is 0
for correct classification and 1 for incorrect classification.

Add or change the Cost property using dot notation as in:

obj .Cost = costMatrix

A cost may also be given as a struct with the fields
ClassNames and ClassificationCosts , which names the
order its own matrix is written in. That matrix is permuted into the
order of ClassNames above, so a caller need not know which
order the classes were sorted into. It must name every class.

A cost must be floating point, not sparse, not complex, non-negative
and zero down its diagonal, and must hold no NaN or
Inf . A single is widened to double .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
Cost of Misclassification



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
ClassificationGAM.DoF


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 207
ClassificationGAM: property DoF

Degrees of freedom for spline fitting

A scalar or row vector specifying the degrees of freedom for each
predictor variable in the spline fitting. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Degrees of freedom for spline fitting



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
ClassificationGAM.ExpandedPredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 294
ClassificationGAM: property ExpandedPredictorNames

Names of the expanded predictor variables

A cell array of character vectors naming the predictors as the model
sees them. It matches PredictorNames unless a categorical
predictor was expanded into dummy variables. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Names of the expanded predictor variables



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
ClassificationGAM.FitMethod


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 717
ClassificationGAM: property FitMethod

Which engine fitted the model

A character vector, either 'boostedtrees' or
'splines' . The default is 'boostedtrees' , which is the
scheme MATLAB&rsquo;s generalized additive model uses and the one the
tree-shaped properties above describe.

'splines' selects the penalised-spline engine instead, which is
an Octave extension with no MATLAB counterpart. It is the scheme this
class fitted before version 1.9.0, and it is kept because a smooth
additive fit is a genuinely different and often better answer than a
staircase of stumps. The two engines take different arguments and an
argument meant for one is refused by the other rather than ignored.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Which engine fitted the model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
ClassificationGAM.Formula


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 273
ClassificationGAM: property Formula

Model specification formula

A character vector specifying the model formula in the form
'Y ~ terms' where Y represents the response variable and
terms specifies the predictor variables and interaction terms.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Model specification formula



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51
ClassificationGAM.HyperparameterOptimizationResults


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 360
ClassificationGAM: property HyperparameterOptimizationResults

Results of the hyperparameter optimization

Always empty. It is declared for MATLAB compatibility, where
it holds what an automatic search over the hyperparameters found. This
class fits the parameters it is given and runs no such search, so there
is nothing to report. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Results of the hyperparameter optimization



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
ClassificationGAM.IntMatrix


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 557
ClassificationGAM: property IntMatrix

Every term the model fits

A logical matrix with one row per term and one column per predictor,
true wherever the term multiplies that predictor. A row naming one
predictor is a main effect, two an interaction, and three or more a
higher-order term. This property is read-only.

It is the complete record, where Interactions reports only the
two-way terms, in the form MATLAB reports them. It is also the form
the 'Interactions' option takes back, so passing it to the
constructor rebuilds a model over the same terms.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
Every term the model fits



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
ClassificationGAM.Interactions


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 598
ClassificationGAM: property Interactions

Two-way interaction terms of the fitted model

A Kx2 matrix of predictor index pairs, one row per two-way term
the model carries, and zeros (0, 2) when it carries none. It
reports what was fitted rather than what was asked for, so a count of
terms, 'all' , a logical matrix and a formula all leave the same
kind of value behind. This property is read-only.

A main effect names one predictor and a higher-order term names three
or more, and neither has a two-column form, so neither appears here.
IntMatrix remains the complete record of every term fitted.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
Two-way interaction terms of the fitted model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
ClassificationGAM.Intercept


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 197
ClassificationGAM: property Intercept

Intercept of the fitted model

A numeric scalar, the log-odds of the response mean, which every
additive term is measured against. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Intercept of the fitted model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
ClassificationGAM.Knots


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 193
ClassificationGAM: property Knots

Knots for spline fitting

A scalar or row vector specifying the number of knots for each predictor
variable in the spline fitting. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
Knots for spline fitting



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
ClassificationGAM.LearningRate


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 207
ClassificationGAM: property LearningRate

Learning rate for gradient boosting

A scalar value between 0 and 1 specifying the learning rate used in the
gradient boosting algorithm. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
Learning rate for gradient boosting



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
ClassificationGAM.ModelParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 818
ClassificationGAM: property ModelParameters

Parameters the model was fitted with

A structure holding the fitting parameters. Under the boosted-tree
engine it carries MATLAB&rsquo;s own fields: NumPrint ,
MaxPValue , InitialLearnRateForPredictors ,
InitialLearnRateForInteractions ,
NumTreesPerPredictor , NumTreesPerInteraction ,
MaxNumSplitsPerPredictor , MaxNumSplitsPerInteraction ,
VerbosityLevel , Interactions , Version ,
Method and Type . Interactions here is the
request as it was made, a count or 'all' , where the
Interactions property of the model is the pairs actually
selected.

Under the spline engine it describes that scheme instead, carrying
Knots , Order , DoF , Formula ,
Interactions , LearningRate and NumIterations ,
since none of the tree vocabulary applies to it.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
Parameters the model was fitted with



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
ClassificationGAM.ModelwInt


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 268
ClassificationGAM: property ModelwInt

Model parameters with interactions

A structure containing the parameters of the model that includes
interaction terms. This model extends the base model by adding
interaction terms between predictors. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
Model parameters with interactions



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
ClassificationGAM.NumIterations


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 200
ClassificationGAM: property NumIterations

Maximum number of iterations

A positive integer specifying the maximum number of iterations for the
gradient boosting algorithm. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
Maximum number of iterations



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
ClassificationGAM.NumObservations


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 230
ClassificationGAM: property NumObservations

Number of observations

A positive integer value specifying the number of observations in the
training dataset used for training the ClassificationGAM model.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Number of observations



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
ClassificationGAM.NumPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 224
ClassificationGAM: property NumPredictors

Number of predictors

A positive integer value specifying the number of predictors in the
training dataset used for training the ClassificationGAM model.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Number of predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
ClassificationGAM.Order


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 174
ClassificationGAM: property Order

Order of spline fitting

A scalar or row vector specifying the order of the spline for each
predictor variable. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
Order of spline fitting



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
ClassificationGAM.PairDetectionBinEdges


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 487
ClassificationGAM: property PairDetectionBinEdges

Bin edges used to detect interactions

A cell array with one row vector per predictor, holding the coarse cut
points the residuals of the predictor phase were laid on while pairs
were being tested. The grid is eight equal-frequency bins whatever the
sample size, as MATLAB&rsquo;s is. It is empty when the model carries no
interaction terms, and empty throughout under the spline engine, which
does not bin.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Bin edges used to detect interactions



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
ClassificationGAM.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 257
ClassificationGAM: property PredictorNames

Names of predictor variables

A cell array of character vectors specifying the names of the predictor
variables. The names are in the order in which they appear in the
training dataset. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
Names of predictor variables



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
ClassificationGAM.Prior


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 562
ClassificationGAM: property Prior

Prior probability for each class

A 2-element numeric vector specifying the prior probabilities for each
class. The order of the elements in Prior corresponds to the
order of the classes in ClassNames . This property is read-only.

Specified as a row vector with one entry per class, in the order of
ClassNames , and rescaled to sum to one. It may be given as
'empirical' , 'uniform' , a numeric vector, or a
structure with ClassNames and ClassProbs fields, which
assigns each probability by class name rather than by position.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Prior probability for each class



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
ClassificationGAM.ReasonForTermination


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 539
ClassificationGAM: property ReasonForTermination

Why each fitting phase stopped

A structure with the fields PredictorTrees and
InteractionTrees , each a character vector saying why that phase
of the fit ended: that it trained the trees it was asked for, or that
it could no longer improve the model. A phase that never ran reports
an empty character vector, which is what a model with no interaction
terms shows for the second field.

It is empty under the spline engine, which has no tree budget to
exhaust.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
Why each fitting phase stopped



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
ClassificationGAM.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 161
ClassificationGAM: property ResponseName

Response variable name

A character vector specifying the name of the response variable Y .
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Response variable name



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
ClassificationGAM.RowsUsed


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 386
ClassificationGAM: property RowsUsed

Rows used for fitting

A logical column vector with the same length as the observations in the
original predictor data X , true for each row that was used for
fitting the ClassificationGAM model. It is empty, [] ,
when every observation was used, so a non-empty value means that rows
holding missing values were dropped. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
Rows used for fitting



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
ClassificationGAM.ScoreTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1350
ClassificationGAM: property ScoreTransform

Transformation function for classification scores

Specified as a function handle for transforming the classification
scores. Add or change the ScoreTransform property using dot
notation as in:

obj .ScoreTransform = 'function_name'
obj .ScoreTransform = @function_handle

When specified as a character vector, it can be any of the following
built-in functions. Nevertheless, the ScoreTransform property
always stores their function handle equivalent.

Value Description
'doublelogit' 1 ./ (1 + exp (-2 &times; x))
'invlogit' log (x ./ (1 - x))
'ismax' Sets the score for the class with the
largest score to 1, and for all other classes to 0
'logit' 1 ./ (1 + exp (-x))
'none' x (no transformation)
'identity' x (no transformation)
'sign' -1 for x < 0, 0 for x = 0, 1 for x >
0
'symmetric' 2 &times; x - 1
'symmetricismax' Sets the score for the class
with the largest score to 1, and for all other classes to -1
'symmetriclogit' 2 ./ (1 + exp (-x)) - 1

The default is 'logit' , as in MATLAB. This model&rsquo;s raw
score is a log-odds, reported as the pair [-f, f] whose two
columns sum to zero, and the transform is what turns it into the
posterior probabilities that sum to one. Every transform therefore
composes on the log-odds and not on the probabilities, so
'none' returns the log-odds themselves.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Transformation function for classification scores



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
ClassificationGAM.TreeModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 778
ClassificationGAM: property TreeModel

The fitted shape functions and interaction surfaces

A structure holding what the boosted-tree engine fitted, with fields
ShapeValues , one column vector per predictor giving that
predictor&rsquo;s contribution in each of its bins, PairValues , one
matrix per selected pair, and Pairs , the predictor indices those
matrices belong to. A shape function is a step function, so these are
the whole of the fit however many trees produced them.

MATLAB exposes no equivalent: it reports the bin edges but never the
values on them, so its shape functions can only be reached through
predict . This property is an Octave extension, and it is empty
under the spline engine, whose fit lives in BaseModel and
ModelwInt .

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51
The fitted shape functions and interaction surfaces



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
ClassificationGAM.W


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 355
ClassificationGAM: property W

Observation weights

A numeric column vector with one entry per observation used for
training, normalised to sum to one. This property is read-only.

Each class carries its prior spread evenly over its own observations,
so an observation of a class weighs Prior for that class
divided by the number of observations it holds.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
Observation weights



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
ClassificationGAM.X


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 232
ClassificationGAM: property X

Predictor data

A numeric matrix containing the unstandardized predictor data. Each
column of X represents one predictor (variable), and each row
represents one observation. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
Predictor data



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
ClassificationGAM.Y


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 309
ClassificationGAM: property Y

Class labels

Specified as a logical or numeric column vector, or as a character array
or a cell array of character vectors with the same number of rows as the
predictor data. Each row in Y is the observed class label for
the corresponding row in X . This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
Class labels



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
ClassificationGAM.addInteractions


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1087
ClassificationGAM: obj = addInteractions ( obj , interactions )

Add interaction terms to a fitted model.

obj = addInteractions ( obj , interactions ) fits
the interaction terms named by interactions on top of the terms
the model already carries and returns the updated model. The univariate
fit is left alone, so predict with
'IncludeInteractions' set false answers exactly as it
answered before.

interactions takes the forms the constructor&rsquo;s
'Interactions' option takes: a nonnegative integer count of
terms, a logical matrix with a column per predictor, or 'all' .

A model already carrying interaction terms is not extended, which is
what MATLAB refuses too. A model fitted from a 'Formula' names
every term it has, interactions among them, and is refused for the same
reason.

Which terms a count selects is this implementation&rsquo;s own: they are
taken in the order nchoosek lists the pairs, where MATLAB ranks
them by how much each contributes. The constructor&rsquo;s option chooses
the same way, so the two agree with each other.

See also:
fitcgam,
ClassificationGAM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
Add interaction terms to a fitted model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
ClassificationGAM.compact


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 239
ClassificationGAM: CVMdl = compact ( obj )

Create a CompactClassificationGAM object.

CVMdl = compact ( obj ) creates a compact version of the
ClassificationGAM object, obj .

See also:
fitcgam,
ClassificationGAM,
CompactClassificationGAM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Create a CompactClassificationGAM object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
ClassificationGAM.crossval


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1061
ClassificationGAM: CVMdl = crossval ( obj )
ClassificationGAM: CVMdl = crossval (&hellip;, name , value )

Cross Validate a Generalized Additive Model classification object.

CVMdl = crossval ( obj ) returns a cross-validated model
object, CVMdl , from a trained model, obj , using 10-fold
cross-validation by default.

CVMdl = crossval ( obj , name , value )
specifies additional name-value pair arguments to customize the
cross-validation process.

Name Value
'KFold' Specify the number of folds to use in
k-fold cross-validation. "KFold", k , where k is an
integer greater than 1.
'Holdout' Specify the fraction of the data to
hold out for testing. "Holdout", p , where p is a
scalar in the range (0,1) .
'Leaveout' Specify whether to perform
leave-one-out cross-validation. "Leaveout", Value , where
Value is &rsquo;on&rsquo; or &rsquo;off&rsquo;.
'CVPartition' Specify a cvpartition
object used for cross-validation. "CVPartition", cv , where
isa ( cv , "cvpartition") = 1.

See also:
fitcgam,
ClassificationGAM,
cvpartition,
ClassificationPartitionedModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 66
Cross Validate a Generalized Additive Model classification object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
ClassificationGAM.edge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 399
ClassificationGAM: e = edge ( obj , X , Y )
ClassificationGAM: e = edge (&hellip;, "Weights" , w )

Classification edge of a generalized additive model.

e = edge ( obj , X , Y ) returns the mean of
the classification margins over the rows of X .

e = edge (&hellip;, "Weights" , w ) takes the
weighted mean instead, with one weight per row of X .

See also:
ClassificationGAM,
margin,
loss,
predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 52
Classification edge of a generalized additive model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
ClassificationGAM.loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 898
ClassificationGAM: L = loss ( obj , X , Y )
ClassificationGAM: L = loss (&hellip;, name , value )

Classification loss of a generalized additive model.

L = loss ( obj , X , Y ) returns the loss of
the model on the rows of X against the true labels Y .

L = loss (&hellip;, name , value ) accepts the
following name-value pairs:

"LossFun" selects the loss. Supported values are
"mincost" , the default, "binodeviance" ,
"classifcost" , "classiferror" , "exponential" ,
"hinge" , "logit" and "quadratic" .
"mincost" assigns each observation to the class of least
expected cost and charges what that assignment costs, so it reads the
scores as a posterior, which is what this model returns;
"classifcost" charges what the model&rsquo;s own prediction costs.

"Weights" holds one weight per row of X , normalised to
sum to one before it is applied.

See also:
ClassificationGAM,
margin,
edge,
predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 52
Classification loss of a generalized additive model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
ClassificationGAM.margin


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 430
ClassificationGAM: m = margin ( obj , X , Y )

Classification margin of a generalized additive model.

m = margin ( obj , X , Y ) returns a column
vector holding, for each row of X , the score the model gives its
true class in Y less the score it gives the other class. A
positive margin means the observation is classified correctly, and the
larger it is the more confidently so.

See also:
ClassificationGAM,
edge,
loss,
predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 54
Classification margin of a generalized additive model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
ClassificationGAM.predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1117
ClassificationGAM: label = predict ( obj , XC )
ClassificationGAM: [ label , score ] = predict ( obj , XC )
ClassificationGAM: [ label , score ] = predict (&hellip;, 'IncludeInteractions' , includeInteractions )

Predict labels for new data using the Generalized Additive Model (GAM)
stored in a ClassificationGAM object.

label = predict ( obj , XC ) returns the predicted
labels for the data in XC based on the model stored in the
ClassificationGAM object, obj .

[ label , score ] = predict ( obj , XC ) also
returns score , which contains the predicted class scores or
posterior probabilities for each observation.

[ label , score ] = predict ( obj , XC ,
'IncludeInteractions', includeInteractions ) allows you to specify
whether interaction terms should be included when making predictions.

obj must be a ClassificationGAM class object.

XC must be an M&times;P numeric matrix where each row is an
observation and each column corresponds to a predictor variable.

includeInteractions is a logical scalar indicating whether to
include interaction terms in the predictions.

See also:
ClassificationGAM,
fitcgam


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 108
Predict labels for new data using the Generalized Additive Model (GAM) stored in a ClassificationGAM object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
ClassificationGAM.resubEdge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 150
ClassificationGAM: e = resubEdge ( obj )

Classification edge of a generalized additive model on its training
data.

See also:
ClassificationGAM,
edge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 73
Classification edge of a generalized additive model on its training data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
ClassificationGAM.resubLoss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 209
ClassificationGAM: L = resubLoss ( obj )
ClassificationGAM: L = resubLoss (&hellip;, name , value )

Classification loss of a generalized additive model on its training
data.

See also:
ClassificationGAM,
loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 73
Classification loss of a generalized additive model on its training data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
ClassificationGAM.resubMargin


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 156
ClassificationGAM: m = resubMargin ( obj )

Classification margin of a generalized additive model on its training
data.

See also:
ClassificationGAM,
margin


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 75
Classification margin of a generalized additive model on its training data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
ClassificationGAM.resubPredict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 321
ClassificationGAM: label = resubPredict ( obj )
ClassificationGAM: [ label , score ] = resubPredict ( obj )

Classify the training data with the generalized additive model it was
fitted on.

label = resubPredict ( obj ) is predict applied
to the observations the model was fitted on.

See also:
ClassificationGAM,
predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
Classify the training data with the generalized additive model it was fitted on.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
ClassificationGAM.resume


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 939
ClassificationGAM: Mdl = resume ( obj , numTrees )

Resume training a generalized additive model.

Mdl = resume ( obj , numTrees ) adds
numTrees more trees to obj and returns the result. The
original model is not modified.

Training continues in the phase that ran last, which is what MATLAB
does: a model carrying interaction terms gains interaction trees and
its predictor shape functions are left alone, while a model without
them gains predictor trees. A round starts at its initial learning
rate whatever its number, so the model this returns is the model a
single fit of the combined budget would have produced.

numTrees must be a positive integer scalar. Resuming raises
where there is nothing left to gain, rather than returning the model
unchanged, and it is not available under
'FitMethod', 'splines' : a backfit that has converged to its
tolerance has no budget to extend.

See also:
ClassificationGAM,
fitcgam,
addInteractions


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
Resume training a generalized additive model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
ClassificationGAM.savemodel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 472
ClassificationGAM: savemodel ( obj , filename )

Save a ClassificationGAM object.

savemodel ( obj , filename ) saves each property of a
ClassificationGAM object into an Octave binary file, the name of which is
specified in filename , along with an extra variable, which defines
the type classification object these variables constitute. Use
loadmodel in order to load a classification object into Octave&rsquo;s
workspace.

See also:
loadmodel,
fitcgam,
ClassificationGAM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Save a ClassificationGAM object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
ClassificationKNN


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 707
statistics: ClassificationKNN

K-nearest neighbors classification

The ClassificationKNN class implements a K-nearest neighbor
classifier object, which can predict responses for new data using the
predict method. The implemented algorithm allows you choose a range
of different distance metrics, the number of nearest neighbors, as well as
the searching algorithm.

The K-nearest neighbors (k-NN) classifier is a simple, non-parametric
machine learning algorithm used for classification tasks. It classifies a
data point based on the majority class of its k closest neighbors in the
feature space.

Create a ClassificationKNN object by using the fitcknn
function or the class constructor.

See also:
fitcknn


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
K-nearest neighbors classification



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
ClassificationKNN.BinEdges


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 365
ClassificationKNN: property BinEdges

Bin edges of the predictors

A cell array with one entry per predictor, holding that predictor&rsquo;s bin
edges where the learner discretized it before fitting. It is empty here
and stays empty: this learner fits the predictors as they are, and
MATLAB&rsquo;s reports an empty cell for it as well.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Bin edges of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
ClassificationKNN.BreakTies


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 949
ClassificationKNN: property BreakTies

Tie-breaking algorithm

A character vector specifying the tie-breaking algorithm used by the
predict method, when multiple classes have the same smallest cost.
It can be one of the following:

'smallest' (default), which favors the class with the
smallest index among the tied groups, i.e. the one that appears first in
the training labelled data.
'nearest' , which favors the class with the nearest neighbor
among the tied groups, i.e. the class with the closest member point
according to the distance metric used.
'random' , which randomly picks one class among the tied
groups.

The tie-breaking algorithm is only used when IncludeTies is
false . Change the BreakTies property using dot notation
as in:

obj .BreakTies = algorithm

This property may be assigned after fitting. It decides the label
when two classes hold the same weight among the neighbours, and it
applies whether or not IncludeTies is set.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Tie-breaking algorithm



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
ClassificationKNN.BucketSize


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 326
ClassificationKNN: property BucketSize

Maximum data points in each node

A positive integer scalar specifying the maximum number of data points in
the leaf node of the Kd-tree. BucketSize only applies when the
NSMethod property is 'kdtree' .

Change the BucketSize property using dot notation as in:

obj .BucketSize = maxnum


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Maximum data points in each node



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
ClassificationKNN.CacheSize


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 663
ClassificationKNN: property CacheSize

Size of the Gram matrix cache

A positive scalar giving the cache size in megabytes, 1000 by default.
Change the CacheSize property using dot notation as in:

obj .CacheSize = newCacheSize

This property is stored and reported for compatibility and
does not affect the fit or any prediction . A nearest-neighbour
model keeps no Gram matrix to cache: it holds the training data and
computes each distance when asked. Assigning it changes nothing but
the value read back.

MATLAB carries the same property and hides it from properties ,
where this package reports it, so that a value a user may set is a
value a user can find.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Size of the Gram matrix cache



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
ClassificationKNN.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 229
ClassificationKNN: property CategoricalPredictors

Indices of the categorical predictors

A numeric vector of column indices into X naming the predictors
treated as categorical, and empty when none is. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
ClassificationKNN.ClassNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 345
ClassificationKNN: property ClassNames

Names of classes in the response variable

An array of unique values of the response variable Y , which has the
same data types as the data in Y . This property is read-only.
ClassNames can have any of the following datatypes:

Cell array of character vectors
Character array
Logical vector
Numeric vector


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Names of classes in the response variable



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
ClassificationKNN.ClassificationKNN


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 5143
statistics: obj = ClassificationKNN ( X , Y )
statistics: obj = ClassificationKNN (&hellip;, name , value )

Create a ClassificationKNN class object containing a k-Nearest
Neighbor classification model.

obj = ClassificationKNN ( X , Y ) returns a
ClassificationKNN object, with X as the predictor data and Y
containing the class labels of observations in X .

X must be a N&times;P numeric matrix of input data where rows
correspond to observations and columns correspond to features or
variables. X will be used to train the kNN model.

Y is N&times;1 matrix or cell matrix containing the class labels
of corresponding predictor data in X . Y can contain any type
of categorical data. Y must have same numbers of Rows as X .

obj = ClassificationKNN (&hellip;, name , value )
returns a ClassificationKNN object with parameters specified by the
following name , value paired input arguments:

Name Value
'PredictorNames' A cell array of character
vectors specifying the names of the predictors. The length of this array
must match the number of columns in X .
'ResponseName' A character vector specifying the
name of the response variable.
'ClassNames' Names of the classes in the class
labels, Y , used for fitting the GAM model.
ClassNames are of the same type as the class labels in Y .
'Cost' An N&times;R numeric matrix containing
misclassification cost for the corresponding instances in X , where
R is the number of unique categories in Y . If an instance
is correctly classified into its category the cost is calculated to be 1,
otherwise 0. The cost matrix can be altered by using
Mdl .cost = somecost . By default, its value is
cost = ones (rows (X), numel (unique (Y))) .
'Prior' A numeric vector specifying the prior
probabilities for each class. The order of the elements in Prior
corresponds to the order of the classes in ClassNames .
Alternatively, you can specify 'empirical' to use the empirical
class probabilities or 'uniform' to assume equal class
probabilities.
'ScoreTransform' A user-defined function handle
or a character vector specifying one of the following builtin functions
specifying the transformation applied to predicted classification scores.
Supported values include 'doublelogit' , 'invlogit' ,
'ismax' , 'logit' , 'none' , 'identity' ,
'sign' , 'symmetric' , 'symmetricismax' , and
'symmetriclogit' .
'BreakTies' A character vector specifying the
tie-breaking algorithm used by predict method, when multiple
classes have the same smallest cost. Available options are
'smallest' (default), which uses the smallest index among tied
groups, 'nearest' , which uses the class with the nearest neighbor
among tied groups, and 'random' , which randomly selects one of
the tied groups.
'NumNeighbors' A positive integer value that
specifies the number of nearest neighbors to be found in the kNN search
algorithm for classifying each point during prediction. By default,
it is 1.
'Distance' Any valid distance metric supported by
the pdist2 function. Note that the allowable distance metrics
depend on the selected nearest neighbor search method.
'DistanceWeight' Either a distance weighting
function, specified either as a function handle, which accepts a matrix
of nonnegative distances and returns a matrix the same size containing
nonnegative distance weights, or a character vector with one of the
following values: 'equal' , which corresponds to no weighting;
'inverse' , which corresponds to a weight equal to
1/distance ; 'squaredinverse' , which corresponds to a
weight equal to 1/distance^2 .
'Cov' A square matrix with the same number of
columns X specifying the covariance matrix for computing the
mahalanobis distance. This must be a positive definite matrix matching.
This argument is only valid when the selected distance metric is
'mahalanobis' .
'Exponent' A positive scalar (usually an integer)
specifying the Minkowski distance exponent. This argument is only valid
when the selected distance metric is 'minkowski' . By default,
it is 2.
'Scale' A nonnegative numeric vector specifying
the scale parameters for the standardized Euclidean distance. The vector
length must be equal to the number of columns in X . This argument
is only valid when the selected distance metric is 'seuclidean' ,
in which case each coordinate of X is scaled by the corresponding
element of 'scale' , as is each query point in Y . By
default, the scale parameter is the standard deviation of each coordinate
in X . If a variable in X is constant, i.e. zero variance,
this value is forced to 1 to avoid division by zero. This is the
equivalent of this variable not being standardized.
'NSMethod' A character vector specifying the
nearest neighbor search method used by knnsearch , which can be
'kdtree' or 'exhaustive' . See knnsearch for more
information about default values and allowable distance metrics for each
search method.
'BucketSize' A positive integer value specifying
the maximum number of data points in the leaf node of the Kd-tree. This
argument is meaningful only when the selected nearest neighbor search
method is 'kdtree' . By default, it is 50.

See also:
fitcknn,
knnsearch,
rangesearch,
pdist2


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 93
Create a ClassificationKNN class object containing a k-Nearest Neighbor classification model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
ClassificationKNN.Cost


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1196
ClassificationKNN: property Cost

Cost of Misclassification

A square matrix specifying the cost of misclassification of a point.
Cost(i,j) is the cost of classifying a point into class j
if its true class is i (that is, the rows correspond to the true
class and the columns correspond to the predicted class). The order of
the rows and columns in Cost corresponds to the order of the
classes in ClassNames . The number of rows and columns in
Cost is the number of unique classes in the response. By
default, Cost(i,j) = 1 if i != j , and
Cost(i,j) = 0 if i = j . In other words, the cost is 0
for correct classification and 1 for incorrect classification.

Add or change the Cost property using dot notation as in:

obj .Cost = costMatrix

A cost may also be given as a struct with the fields
ClassNames and ClassificationCosts , which names the
order its own matrix is written in. That matrix is permuted into the
order of ClassNames above, so a caller need not know which
order the classes were sorted into. It must name every class.

A cost must be floating point, not sparse, not complex, non-negative
and zero down its diagonal, and must hold no NaN or
Inf . A single is widened to double .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
Cost of Misclassification



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
ClassificationKNN.DistParameter


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1265
ClassificationKNN: property DistParameter

Parameter for distance metric

A positive definite covariance matrix, a positive scalar, or a vector of
positive scale values specifying the parameter for the corresponding
distance metric as shown below:

'mahalanobis' accepts a positive definite covariance
matrix.
'minkowski' accepts a positive scalar as the Minkowski
distance exponent.
'seuclidean' accepts a vector of positive scale values of
equal length as the number of predictors in X .

For any other distance metric, DistParameter is empty
([]) . Change the DistParameter property using dot
notation as in:

obj .DistParameter = distParam

This property may be assigned after fitting, but only under the three
metrics that carry one: 'minkowski' , 'seuclidean' and
'mahalanobis' . Under any other metric there is nothing for it
to mean and the assignment is refused.

Deviation from MATLAB. A 'seuclidean' scale of zeros
is refused here. MATLAB accepts it, then warns from inside its distance
routine at predict time and answers anyway, which contradicts its own
message that the scale must hold positive values. A zero scale divides
that predictor by nothing, so it is rejected where it is given rather
than surfacing later as a warning attached to an answer.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Parameter for distance metric



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
ClassificationKNN.Distance


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1069
ClassificationKNN: property Distance

Distance metric

A character vector specifying the distance metric used by the
neighbor-searcher method, or a function handle to a custom distance
function. See the available distance metrics in knnsearch for
more info. A custom distance function must have the form
D2 = distfun ( ZI , ZJ ) , where
ZI is a 1&times;N vector containing one row of the predictor
data, ZJ is an M2&times;N matrix containing multiple rows of the
predictor data, and D2 is an M2&times;1 vector of distances
whose k -th element is the distance between the observations
ZI and ZJ ( k ,:) . A custom distance function
carries no DistParameter . Change the Distance
property using dot notation as in:

obj .Distance = newDistance

This property may be assigned after fitting. NSMethod is
read-only and constrains it: a 'kdtree' model takes
'euclidean' , 'cityblock' , 'chebychev' and
'minkowski' only, and never a function handle. Assigning a
different metric recomputes DistParameter , since a parameter
belonging to one metric means nothing under another.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
Distance metric



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
ClassificationKNN.DistanceWeight


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 725
ClassificationKNN: property DistanceWeight

Distance weighting function

A character vector or a function handle specifying the distance weighting
function, which can be any of the following values:

'equal' , which corresponds to @(d) d .
'inverse' , which corresponds to @(d) 1/d .
'squaredinverse' , which corresponds to @(d) 1/d.^2 .
@fcn , which is a function handle that accepts a matrix of
nonnegative distances, and returns a matrix the same size containing
nonnegative distance weights.

Change the DistanceWeight property
using dot notation as in:

obj .DistanceWeight = newDistanceWeight

A character vector naming the weight, or the func2str form of a
supplied handle. This property may be assigned after fitting.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Distance weighting function



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
ClassificationKNN.ExpandedPredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 262
ClassificationKNN: property ExpandedPredictorNames

Names of the predictors as the model expanded them

A cell array of character vectors. It matches PredictorNames
unless a categorical predictor was expanded into indicator variables.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
Names of the predictors as the model expanded them



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51
ClassificationKNN.HyperparameterOptimizationResults


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 360
ClassificationKNN: property HyperparameterOptimizationResults

Results of the hyperparameter optimization

Always empty. It is declared for MATLAB compatibility, where
it holds what an automatic search over the hyperparameters found. This
class fits the parameters it is given and runs no such search, so there
is nothing to report. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Results of the hyperparameter optimization



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
ClassificationKNN.IncludeTies


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 448
ClassificationKNN: property IncludeTies

Flag for handling ties

A logical scalar specifying whether prediction includes all the neighbors
whose distance values are equal to the k^th smallest distance. If
IncludeTies is true , prediction includes all of these
neighbors. Otherwise, prediction uses exactly k neighbors.

Change the IncludeTies property using dot notation as in:

obj .IncludeTies = flag

This property may be assigned after fitting.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Flag for handling ties



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
ClassificationKNN.ModelParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 800
ClassificationKNN: property ModelParameters

Fitting options, as they were given

A structure holding the parameters of the fit: NumNeighbors ,
NSMethod , Distance , BucketSize ,
IncludeTies , DistanceWeight , BreakTies ,
Exponent , Cov , Scale , StandardizeData ,
and the Version , Method and Type tags.

Each of the three distance parameters belongs to one metric and is
empty under the others: Exponent to 'minkowski' ,
Cov to 'mahalanobis' and Scale to
'seuclidean' . Cov and Scale hold what was
passed and stay empty otherwise, while Exponent carries its
default of 2 for a 'minkowski' fit that did not name one.
What the fit used in every case is the DistParameter property.
BucketSize is likewise empty unless the search is
'kdtree' , the only method that reads it. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
Fitting options, as they were given



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
ClassificationKNN.Mu


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 436
ClassificationKNN: property Mu

Predictor means

A numeric vector of the same length as the columns in X with the
mean values corresponding to each predictor. If the predictor variables
have not been standardized, then 'obj.Mu' is empty. This
property is read-only.

Each predictor is summarized from every observation where that
predictor is present, so a row holding a missing value in another
predictor still contributes to this one.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
Predictor means



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
ClassificationKNN.NSMethod


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 406
ClassificationKNN: property NSMethod

Nearest neighbor search method

A character vector specified as either 'kdtree' , which creates
and uses a Kd-tree to find nearest neighbors, or 'exhaustive' ,
which uses the exhaustive search algorithm by computing the distance
values from all points in X to find nearest neighbors.

Change the NSMethod property using dot notation as in:

obj .NSMethod = newNSMethod


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
Nearest neighbor search method



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
ClassificationKNN.NumNeighbors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 401
ClassificationKNN: property NumNeighbors

Number of nearest neighbors

A positive integer value specifyingNumber of nearest neighbors in X
used to classify each point during prediction. Change the
NumNeighbors property using dot notation as in:

obj .NumNeighbors = newNumNeighbors

This property may be assigned after fitting. A value larger than
NumObservations is reduced to it rather than refused.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Number of nearest neighbors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
ClassificationKNN.NumObservations


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 230
ClassificationKNN: property NumObservations

Number of observations

A positive integer value specifying the number of observations in the
training dataset used for training the ClassificationKNN model.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Number of observations



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
ClassificationKNN.NumPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 224
ClassificationKNN: property NumPredictors

Number of predictors

A positive integer value specifying the number of predictors in the
training dataset used for training the ClassificationKNN model.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Number of predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
ClassificationKNN.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 257
ClassificationKNN: property PredictorNames

Names of predictor variables

A cell array of character vectors specifying the names of the predictor
variables. The names are in the order in which they appear in the
training dataset. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
Names of predictor variables



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
ClassificationKNN.Prior


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 610
ClassificationKNN: property Prior

Prior probability for each class

A numeric vector specifying the prior probabilities for each class. The
order of the elements in Prior corresponds to the order of the
classes in ClassNames .

Add or change the Prior property using dot notation as in:

obj .Prior = priorVector

Specified as a row vector with one entry per class, in the order of
ClassNames , and rescaled to sum to one. It may be given as
'empirical' , 'uniform' , a numeric vector, or a
structure with ClassNames and ClassProbs fields, which
assigns each probability by class name rather than by position.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Prior probability for each class



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
ClassificationKNN.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 161
ClassificationKNN: property ResponseName

Response variable name

A character vector specifying the name of the response variable Y .
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Response variable name



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
ClassificationKNN.RowsUsed


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 386
ClassificationKNN: property RowsUsed

Rows used for fitting

A logical column vector with the same length as the observations in the
original predictor data X , true for each row that was used for
fitting the ClassificationKNN model. It is empty, [] ,
when every observation was used, so a non-empty value means that rows
holding missing values were dropped. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
Rows used for fitting



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
ClassificationKNN.ScoreTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 997
ClassificationKNN: property ScoreTransform

Transformation function for classification scores

Specified as a function handle for transforming the classification
scores. Add or change the ScoreTransform property using dot
notation as in:

obj .ScoreTransform = 'function_name'
obj .ScoreTransform = @function_handle

When specified as a character vector, it can be any of the following
built-in functions. Nevertheless, the ScoreTransform property
always stores their function handle equivalent.

Value Description
'doublelogit' 1 ./ (1 + exp (-2 &times; x))
'invlogit' log (x ./ (1 - x))
'ismax' Sets the score for the class with the
largest score to 1, and for all other classes to 0
'logit' 1 ./ (1 + exp (-x))
'none' x (no transformation)
'identity' x (no transformation)
'sign' -1 for x < 0, 0 for x = 0, 1 for x >
0
'symmetric' 2 &times; x - 1
'symmetricismax' Sets the score for the class
with the largest score to 1, and for all other classes to -1
'symmetriclogit' 2 ./ (1 + exp (-x)) - 1


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Transformation function for classification scores



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
ClassificationKNN.Sigma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 464
ClassificationKNN: property Sigma

Predictor standard deviations

A numeric vector of the same length as the columns in X with the
standard deviations corresponding to each predictor. If the predictor
variables have not been standardized, then 'obj.Sigma' is empty.
This property is read-only.

Each predictor is summarized from every observation where that
predictor is present, so a row holding a missing value in another
predictor still contributes to this one.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Predictor standard deviations



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
ClassificationKNN.W


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 496
ClassificationKNN: property W

Observation weights

A numeric column vector with one entry per observation used for fitting.
Each class carries its prior spread evenly over its own
observations, so an observation of class k weighs
Prior(k) divided by the number of observations in that class. This property is read-only.

Each class carries its prior spread evenly over its own observations,
so an observation of a class weighs Prior for that class
divided by the number of observations it holds.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
Observation weights



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
ClassificationKNN.X


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 232
ClassificationKNN: property X

Predictor data

A numeric matrix containing the unstandardized predictor data. Each
column of X represents one predictor (variable), and each row
represents one observation. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
Predictor data



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
ClassificationKNN.Y


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 309
ClassificationKNN: property Y

Class labels

Specified as a logical or numeric column vector, or as a character array
or a cell array of character vectors with the same number of rows as the
predictor data. Each row in Y is the observed class label for
the corresponding row in X . This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
Class labels



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
ClassificationKNN.crossval


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1037
ClassificationKNN: CVMdl = crossval ( obj )
ClassificationKNN: CVMdl = crossval (&hellip;, Name , Value )

Cross Validate a ClassificationKNN object.

CVMdl = crossval ( obj ) returns a cross-validated model
object, CVMdl , from a trained model, obj , using 10-fold
cross-validation by default.

CVMdl = crossval ( obj , name , value )
specifies additional name-value pair arguments to customize the
cross-validation process.

Name Value
'KFold' Specify the number of folds to use in
k-fold cross-validation. "KFold", k , where k is an
integer greater than 1.
'Holdout' Specify the fraction of the data to
hold out for testing. "Holdout", p , where p is a
scalar in the range (0,1) .
'Leaveout' Specify whether to perform
leave-one-out cross-validation. "Leaveout", Value , where
Value is &rsquo;on&rsquo; or &rsquo;off&rsquo;.
'CVPartition' Specify a cvpartition
object used for cross-validation. "CVPartition", cv , where
isa ( cv , "cvpartition") = 1.

See also:
fitcknn,
ClassificationKNN,
cvpartition,
ClassificationPartitionedModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Cross Validate a ClassificationKNN object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
ClassificationKNN.edge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 599
ClassificationKNN: e = edge ( obj , X , Y )
ClassificationKNN: e = edge (&hellip;, "Weights" , w )

Classification edge, the mean of the classification margins.

e = edge ( obj , X , Y ) reduces the vector
that margin returns to a single number, the mean margin over the
rows of X . It says how far the model puts the true class ahead of
its nearest rival on average, so a larger edge is a better model, and
unlike a loss it is not bounded above and rewards confidence rather than
bare correctness.

e = edge (&hellip;, "Weights" , w ) takes the
weighted mean instead, with one weight per row of X .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 60
Classification edge, the mean of the classification margins.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
ClassificationKNN.loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1894
ClassificationKNN: L = loss ( obj , X , Y )
ClassificationKNN: L = loss (&hellip;, name , value )

Compute loss for a trained ClassificationKNN object.

L = loss ( obj , X , Y ) computes the loss,
L , using the default loss function 'mincost' .

obj is a ClassificationKNN object trained on X and
Y .

X must be a N&times;P numeric matrix of input data where rows
correspond to observations and columns correspond to features or
variables.

Y is N&times;1 matrix or cell matrix containing the class labels
of corresponding predictor data in X . Y must have same
numbers of Rows as X .

L = loss (&hellip;, name , value ) allows
additional options specified by name - value pairs:

Name Value
'LossFun' Specifies the loss function to use.
Can be a function handle with four input arguments (C, S, W, Cost)
which returns a scalar value or one of:
&rsquo;binodeviance&rsquo;, &rsquo;classifcost&rsquo;, &rsquo;classiferror&rsquo;, &rsquo;exponential&rsquo;,
&rsquo;hinge&rsquo;, &rsquo;logit&rsquo;,&rsquo;mincost&rsquo;, &rsquo;quadratic&rsquo;.

C is a logical matrix of size N&times;K , where N is the
number of observations and K is the number of classes.
The element C(i,j) is true if the class label of the i-th
observation is equal to the j-th class.

S is a numeric matrix of size N&times;K , where each element
represents the classification score for the corresponding class.

W is a numeric vector of length N , representing
the observation weights.

Cost is a K&times;K matrix representing the misclassification
costs.

'Weights' Specifies observation weights, must be
a numeric vector of length equal to the number of rows in X.
Default is ones (size (X, 1)) . loss normalizes the weights so that
observation weights in each class sum to the prior probability of that
class. When you supply Weights, loss computes the weighted
classification loss.

See also:
fitcknn,
ClassificationKNN


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 52
Compute loss for a trained ClassificationKNN object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
ClassificationKNN.margin


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 751
ClassificationKNN: m = margin ( obj , X , Y )

m = margin ( obj , X , Y ) returns
the classification margins for obj with data X and
classification Y . m is a numeric vector of length size (X,1).

obj is a ClassificationKNN object trained on X
and Y .

X must be a N&times;P numeric matrix of input data where rows
correspond to observations and columns correspond to features or
variables.

Y is N&times;1 matrix or cell matrix containing the class labels
of corresponding predictor data in X . Y must have same
numbers of Rows as X .

The classification margin for each observation is the difference between
the classification score for the true class and the maximal
classification score for the false classes.

See also:
fitcknn,
ClassificationKNN


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 99
m = margin (obj, X, Y) returns the classification margins for obj with data X and classification Y.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
ClassificationKNN.partialDependence


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1730
ClassificationKNN: [pd, x, y] = partialDependence ( obj , Vars , Labels )
ClassificationKNN: [pd, x, y] = partialDependence (&hellip;, Data )
ClassificationKNN: [pd, x, y] = partialDependence (&hellip;, name , value )

Compute partial dependence for a trained ClassificationKNN object.

[pd, x, y] = partialDependence ( obj , Vars ,
Labels )
computes the partial dependence of the classification scores on the
variables Vars for the specified class Labels .

obj is a trained ClassificationKNN object.

Vars is a vector of positive integers, character vector,
string array, or cell array of character
vectors representing predictor variables (it can be indices of
predictor variables in obj.X ).

Labels is a character vector, logical vector, numeric vector,
or cell array of character vectors representing class
labels. (column vector)

[pd, x, y] = partialDependence (&hellip;, Data )
specifies new predictor data to use for computing the partial dependence.

[pd, x, y] = partialDependence (&hellip;, name ,
value ) allows additional options specified by name-value pairs:

Name Value
'NumObservationsToSample' Number of
observations to sample. Must be a positive integer. Defaults to the
number of observations in the training data.
'QueryPoints' Points at which to evaluate
the partial dependence.
Must be a numeric column vector, numeric two-column matrix, or
cell array of character column vectors.
'UseParallel' Logical value indicating
whether to perform computations in parallel.
Defaults to false .

Return Values

pd : Partial dependence values.
x : Query points for the first predictor variable in Vars.
y : Query points for the second predictor variable in
Vars (if applicable).

See also:
fitcknn,
ClassificationKNN


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 66
Compute partial dependence for a trained ClassificationKNN object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
ClassificationKNN.predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1290
ClassificationKNN: labels = predict ( obj , XC )
ClassificationKNN: [ labels , scores , cost ] = predict ( obj , XC )

Classify new data points into categories using the kNN algorithm from a
k-Nearest Neighbor classification model.

labels = predict ( obj , XC ) returns the matrix of
labels predicted for the corresponding instances in XC , using the
predictor data in obj.X and corresponding labels, obj.Y ,
stored in the k-Nearest Neighbor classification model, obj .

obj must be a ClassificationKNN class object.

XC must be an M&times;P numeric matrix with the same number of
features P as the corresponding predictors of the SVM model in
obj .

[ labels , scores , cost ] = predict ( obj ,
XC ) also returns scores , which contains the predicted class
scores or posterior probabilities for each instance of the corresponding
unique classes, and cost , which is a matrix containing the expected
cost of the classifications. By default, scores returns the
posterior probabilities for KNN models, unless a specific ScoreTransform
function has been specified. See fitcknn for more info.

Note! predict is explicitly using 'exhaustive' as the
nearest search method due to the very slow implementation of
'kdtree' in the knnsearch function.

See also:
fitcknn,
ClassificationKNN,
knnsearch


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 112
Classify new data points into categories using the kNN algorithm from a k-Nearest Neighbor classification model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
ClassificationKNN.resubEdge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 210
ClassificationKNN: e = resubEdge ( obj )

Classification edge of the model on its own training data.

e = resubEdge ( obj ) is edge applied to the
observations the model was fitted on, the mean of resubMargin .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 58
Classification edge of the model on its own training data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
ClassificationKNN.resubLoss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 576
ClassificationKNN: L = resubLoss ( obj )
ClassificationKNN: L = resubLoss (&hellip;, name , value )

Classification loss of the model on its own training data.

L = resubLoss ( obj ) is loss applied to the
observations the model was fitted on, defaulting to
'mincost' , and it accepts the same Name-Value pairs.

Being a resubstitution quantity it is a lower bound on the error rather
than an estimate of it. It is worth least on a lazy learner: a
one-neighbour ClassificationKNN has a resubstitution loss of
exactly zero, every training point being its own nearest neighbour.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 58
Classification loss of the model on its own training data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
ClassificationKNN.resubMargin


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 287
ClassificationKNN: m = resubMargin ( obj )

Classification margins of the model on its own training data.

m = resubMargin ( obj ) is margin applied to the
observations the model was fitted on, one number per observation. Being
a resubstitution quantity it is optimistic by construction.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 61
Classification margins of the model on its own training data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
ClassificationKNN.resubPredict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 612
ClassificationKNN: label = resubPredict ( obj )
ClassificationKNN: [ label , score , cost ] = resubPredict ( obj )

Classify the training data with the model fitted to it.

label = resubPredict ( obj ) is predict applied
to the observations the model was fitted on, which it holds in
X . Handing them over yourself is not the same thing: a row
dropped for a missing response is not in X , so the original
matrix and the model&rsquo;s own are different data.

The result measures fit and not generalization, and is optimistic by
construction. crossval is what estimates performance on data the
model has not seen.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 55
Classify the training data with the model fitted to it.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
ClassificationKNN.savemodel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 472
ClassificationKNN: savemodel ( obj , filename )

Save a ClassificationKNN object.

savemodel ( obj , filename ) saves each property of a
ClassificationKNN object into an Octave binary file, the name of which is
specified in filename , along with an extra variable, which defines
the type classification object these variables constitute. Use
loadmodel in order to load a classification object into Octave&rsquo;s
workspace.

See also:
loadmodel,
fitcknn,
ClassificationKNN


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Save a ClassificationKNN object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
ClassificationKernel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1308
statistics: ClassificationKernel

Gaussian kernel binary classifier for large data.

A ClassificationKernel object maps the predictors into a
randomized feature space whose inner product approximates a Gaussian
kernel, and then fits a linear model there. A kernel classifier is
therefore as nonlinear as a support vector machine with a Gaussian kernel,
while costing what a linear fit costs: nothing of size NxN is ever
formed.

The expansion is the random Fourier basis of Rahimi and Recht, drawn once
when the model is fitted and kept with it, so predict maps new data
through the same basis. MATLAB approximates the same kernel by the
Fastfood construction, which reaches the same distribution more cheaply;
the two are interchangeable in distribution but not draw by draw, and the
draws come from different generators in any case, so the scores of a model
fitted here and one fitted in MATLAB differ even from the same seed.
What does not differ is what they estimate.

Like ClassificationLinear the object holds no copy of the training
data. It does hold the basis and the coefficients, so it is bounded by
the number of expansion dimensions rather than by the number of
observations.

Create a ClassificationKernel object with fitckernel .

See also:
fitckernel,
ClassificationLinear,
ClassificationSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Gaussian kernel binary classifier for large data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
ClassificationKernel.BoxConstraint


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 310
ClassificationKernel: property BoxConstraint

Box constraint of the support vector machine

A positive scalar. It is the reciprocal of the product of
Lambda and the number of observations, so setting either of
the two in the constructor fixes the other, and giving both is an
error. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 44
Box constraint of the support vector machine



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
ClassificationKernel.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 191
ClassificationKernel: property CategoricalPredictors

Indices of the categorical predictors

A row vector of column indices, empty when every predictor is
numeric. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
ClassificationKernel.ClassNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 249
ClassificationKernel: property ClassNames

Names of the two classes

A column of the same type as the response supplied to the constructor.
The second of the two is the positive class, the one a positive score
belongs to. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
Names of the two classes



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
ClassificationKernel.ClassificationKernel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2113
ClassificationKernel: obj = ClassificationKernel ( X , Y )
ClassificationKernel: obj = ClassificationKernel (&hellip;, name , value )

Fit a Gaussian kernel binary classifier.

obj = ClassificationKernel ( X , Y ) fits a
support vector machine in a randomized Gaussian kernel space to the
NxP predictor matrix X and the Nx1 response
Y , which must name exactly two classes.

obj = ClassificationKernel (&hellip;, name ,
value ) takes the following Name-Value pairs.

Name Value
'Learner' 'svm' , the default, or
'logistic' .
'NumExpansionDimensions' 'auto' , the
default, or a positive integer.
'KernelScale' 1 by default, a positive
scalar, or 'auto' , which takes the median distance between the
observations.
'Lambda' 'auto' , the default, which is the
reciprocal of the number of observations, or a nonnegative scalar. It
cannot be given beside 'BoxConstraint' .
'BoxConstraint' A positive scalar, 1 by
default. It applies to a support vector machine alone.
'Standardize' Whether to centre and scale the
predictors, false by default.
'BetaTolerance' Relative tolerance on the
coefficients, 1e-4 by default.
'GradientTolerance' Absolute tolerance on the
gradient&rsquo;s infinity norm, 1e-6 by default.
'IterationLimit' Largest number of iterations,
1000 by default.
'HessianHistorySize' Number of curvature pairs the
solver keeps, 15 by default.
'BlockSize' Memory the expansion may occupy, in
megabytes, 4e3 by default.
'ClassNames' The classes to keep, given in the type
of Y .
'Cost' A square misclassification cost matrix.
'Prior' 'empirical' , the default,
'uniform' , a vector of probabilities, or a structure with
ClassNames and ClassProbs fields.
'ScoreTransform' A transformation applied to the
scores, named or given as a function handle.
'Weights' One nonnegative weight per observation.
'PredictorNames' One name per predictor.
'ResponseName' A name for the response.
'CategoricalPredictors' Indices of the categorical
predictors.

The fit is always by limited-memory BFGS, the only solver MATLAB
offers a kernel model, and always under a ridge penalty.

See also:
fitckernel,
ClassificationLinear


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
Fit a Gaussian kernel binary classifier.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
ClassificationKernel.Cost


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 596
ClassificationKernel: property Cost

Cost of misclassifying an observation

A square numeric matrix with one row and one column per class, whose
(i,j) element is the cost of classifying an observation of
class i into class j . It defaults to one everywhere
except the diagonal, which is zero. This property is read-only, as it
is in MATLAB; a cost matrix is given to the constructor instead.

The costs are folded into the prior before the observations are
weighted, so a class that is costlier to misclassify weighs more in
the fit. They are read again by the 'mincost' and
'classifcost' losses.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Cost of misclassifying an observation



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
ClassificationKernel.ExpandedPredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 249
ClassificationKernel: property ExpandedPredictorNames

Names of the predictors as the fit saw them

A cell array of character vectors. These name the original
predictors, not the expansion dimensions, which have no names. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
Names of the predictors as the fit saw them



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
ClassificationKernel.FittedLoss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 179
ClassificationKernel: property FittedLoss

Loss function the fit minimized

'hinge' for a support vector machine and 'logit' for a
logistic regression. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Loss function the fit minimized



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
ClassificationKernel.KernelScale


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 236
ClassificationKernel: property KernelScale

Scale of the Gaussian kernel

A positive scalar dividing every predictor before the expansion, so a
larger scale makes the kernel wider and the classifier smoother. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
Scale of the Gaussian kernel



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
ClassificationKernel.Lambda


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 192
ClassificationKernel: property Lambda

Regularization strength

A nonnegative scalar, the reciprocal of the product of
BoxConstraint and the number of observations. This property
is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
Regularization strength



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
ClassificationKernel.Learner


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 139
ClassificationKernel: property Learner

Linear model fitted in the expanded space

Either 'svm' or 'logistic' . This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Linear model fitted in the expanded space



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
ClassificationKernel.ModelParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 237
ClassificationKernel: property ModelParameters

Fitting options, as they were given

A structure holding every parameter of the fit, with the
'auto' values as they were given rather than as they were
resolved. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
Fitting options, as they were given



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
ClassificationKernel.Mu


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 202
ClassificationKernel: property Mu

Predictor means used to standardize

A row vector with one element per predictor, or empty when the model
was fitted without standardizing. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
Predictor means used to standardize



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
ClassificationKernel.NumExpansionDimensions


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 345
ClassificationKernel: property NumExpansionDimensions

Number of dimensions of the expanded space

A positive integer scalar. It defaults to
2 .^ ceil (min (log2 ( p ) + 5, 15)) for p
predictors, so four predictors give 128 dimensions. More dimensions
approximate the kernel more closely and cost proportionally more.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Number of dimensions of the expanded space



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
ClassificationKernel.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 217
ClassificationKernel: property PredictorNames

Names of the predictors

A cell array of character vectors with one name per column of the
training data, defaulting to 'x1' , 'x2' and so on.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
Names of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
ClassificationKernel.Prior


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 253
ClassificationKernel: property Prior

Prior probability of each class

A numeric row vector with one element per class, in the order of
ClassNames and summing to one. It defaults to the class
frequencies of the training data. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Prior probability of each class



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
ClassificationKernel.Regularization


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 213
ClassificationKernel: property Regularization

Penalty on the coefficients

Always 'ridge (L2)' : a kernel model fits in the expanded
space, where a lasso penalty has nothing to select. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Penalty on the coefficients



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
ClassificationKernel.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 134
ClassificationKernel: property ResponseName

Name of the response

A character vector, defaulting to 'Y' . This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Name of the response



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
ClassificationKernel.ScoreTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 314
ClassificationKernel: property ScoreTransform

Transformation applied to the predicted scores

A character vector naming a transformation, or the text of the
function handle that was supplied. Assigning to it accepts either.
It defaults to 'logit' for a logistic learner and to
'none' for a support vector machine.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
Transformation applied to the predicted scores



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
ClassificationKernel.Sigma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 219
ClassificationKernel: property Sigma

Predictor standard deviations used to standardize

A row vector with one element per predictor, or empty when the model
was fitted without standardizing. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Predictor standard deviations used to standardize



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
ClassificationKernel.edge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 249
ClassificationKernel: e = edge ( obj , X , Y )
ClassificationKernel: e = edge (&hellip;, 'Weights' , W )

Weighted mean of the classification margins.

The weights are normalized within each class to that class&rsquo;s prior
before they are applied.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 44
Weighted mean of the classification margins.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
ClassificationKernel.loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 390
ClassificationKernel: l = loss ( obj , X , Y )
ClassificationKernel: l = loss (&hellip;, name , value )

Classification loss on new data.

l = loss ( obj , X , Y ) returns the
misclassification rate.

l = loss (&hellip;, name , value ) takes
'LossFun' , one of 'binodeviance' ,
'classifcost' , 'classiferror' , 'exponential' ,
'hinge' , 'logit' , 'mincost' and
'quadratic' , and 'Weights' .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Classification loss on new data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
ClassificationKernel.margin


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 236
ClassificationKernel: m = margin ( obj , X , Y )

Classification margin of each observation.

m = margin ( obj , X , Y ) returns the
score of the true class less the score of the other one. A positive
margin is a correct classification.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Classification margin of each observation.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
ClassificationKernel.predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 424
ClassificationKernel: labels = predict ( obj , XC )
ClassificationKernel: [ labels , scores ] = predict ( obj , XC )

Classify new observations.

labels = predict ( obj , XC ) maps each row of
XC through the model&rsquo;s own random basis and returns the class of
largest score.

[ labels , scores ] = predict ( obj , XC )
also returns the Nx2 scores, whose columns follow
ClassNames , after ScoreTransform has been applied.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
Classify new observations.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
ClassificationKernel.resume


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 877
ClassificationKernel: obj = resume ( obj , X , Y )
ClassificationKernel: obj = resume (&hellip;, name , value )

Continue fitting a kernel classifier.

obj = resume ( obj , X , Y ) restarts the
optimization from the coefficients the model already carries, through
the basis it already holds, and returns the model it reaches. It
takes 'BetaTolerance' , 'GradientTolerance' and
'IterationLimit' , each defaulting to what the model was
fitted with, and 'Weights' .

X and Y must be the data the model was fitted to; the
object keeps no copy of them, which is what makes it small. Neither
does it keep the observation weights, so a model fitted with
'Weights' must be given them again here or it will resume
against uniform ones. MATLAB behaves the same way: measured on
R2024a, resuming a weighted fit without passing the weights back
reaches the objective of the unweighted fit.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Continue fitting a kernel classifier.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
ClassificationKernel.savemodel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 213
ClassificationKernel: savemodel ( obj , filename )

Save a kernel classifier to a file.

savemodel ( obj , filename ) saves the model
obj into filename in a form loadmodel can read
back, the random basis included.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
Save a kernel classifier to a file.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
ClassificationLinear


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1087
statistics: ClassificationLinear

Linear binary classifier for high dimensional data.

A ClassificationLinear object fits a linear model,
X * Beta + Bias , to a two class problem by minimizing a
regularized average loss. The loss is the hinge loss for a support vector
machine and the deviance for a logistic regression, and the penalty is
either a ridge or a lasso one.

Unlike the other classifiers of this package the object holds no copy of
the training data: the coefficients, the intercept and the fitting options
are the whole model. That is what makes it suited to data with more
predictors than an in memory kernel matrix could carry, and it is why the
class has no compact method and no resubstitution methods.

A vector of regularization strengths fits one model per value in a single
object. Beta is then a PxL matrix and Bias a
1xL row, every method returns one column per strength, and
selectModels narrows the object down to the strengths worth
keeping.

Create a ClassificationLinear object with fitclinear .

See also:
fitclinear,
ClassificationKernel,
ClassificationSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51
Linear binary classifier for high dimensional data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
ClassificationLinear.Beta


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 199
ClassificationLinear: property Beta

Fitted linear coefficients

A Px1 column, or a PxL matrix with one column per
regularization strength when Lambda holds more than one. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
Fitted linear coefficients



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
ClassificationLinear.Bias


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 228
ClassificationLinear: property Bias

Fitted intercept

A scalar, or a 1xL row with one element per regularization
strength. It is zero throughout when the model was fitted with
'FitBias' set to false. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
Fitted intercept



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
ClassificationLinear.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 191
ClassificationLinear: property CategoricalPredictors

Indices of the categorical predictors

A row vector of column indices, empty when every predictor is
numeric. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
ClassificationLinear.ClassNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 342
ClassificationLinear: property ClassNames

Names of the two classes

A column of the same type as the response supplied to the constructor:
a cell array of character vectors, a numeric vector, a logical vector
or a character matrix. The second of the two is the positive class,
the one a positive score belongs to. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
Names of the two classes



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
ClassificationLinear.ClassificationLinear


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3647
ClassificationLinear: obj = ClassificationLinear ( X , Y )
ClassificationLinear: obj = ClassificationLinear (&hellip;, name , value )

Fit a linear binary classifier.

obj = ClassificationLinear ( X , Y ) fits a
linear support vector machine to the NxP predictor matrix
X and the Nx1 response Y , which must name exactly
two classes.

obj = ClassificationLinear (&hellip;, name ,
value ) takes the following Name-Value pairs.

Name Value
'Learner' 'svm' , the default, or
'logistic' . The first minimizes the hinge loss and the second
the deviance.
'Regularization' 'ridge' or
'lasso' . It defaults to 'lasso' when the solver is
'sparsa' and to 'ridge' otherwise.
'Lambda' 'auto' , the default, which is the
reciprocal of the number of observations, or a nonnegative scalar, or
a vector of them. A vector fits one model per value.
'Solver' One of 'sgd' , 'asgd' ,
'dual' , 'bfgs' , 'lbfgs' and 'sparsa' ,
or a cell array of them applied in turn, each warm starting the next.
The default depends on the data and the penalty, as described below.
'Beta' Initial coefficients, a Px1 column or
a PxL matrix. It defaults to zeros.
'Bias' Initial intercept, a scalar or a 1xL
row. It defaults to the weighted average of the class labels for a
logistic learner and to zero for a support vector machine.
'FitBias' Whether to fit an intercept at all, true
by default.
'PostFitBias' Whether to refit the intercept once
the coefficients are settled, false by default.
'ObservationsIn' 'rows' , the default, or
'columns' , which transposes X before fitting.
'BetaTolerance' Relative tolerance on the
coefficients, 1e-4 by default.
'GradientTolerance' Absolute tolerance on the
gradient&rsquo;s infinity norm, 1e-6 by default.
'DeltaGradientTolerance' Tolerance on the
complementarity gap of the 'dual' solver, 1 by
default for a hinge loss. MathWorks documents 0.1 , which is
the default of the regression counterpart; R2024a and R2026a
both report 1 here.
'IterationLimit' Largest number of iterations,
1000 by default.
'PassLimit' Largest number of passes over the data
for the stochastic solvers, 1 by default, and 10 for
'dual' .
'BatchSize' Mini-batch size of the stochastic
solvers, 10 by default.
'BatchLimit' Largest number of mini-batches.
'LearnRate' Step size of the stochastic solvers.
'OptimizeLearnRate' Whether to halve the step size
when the objective rises, true by default.
'TruncationPeriod' Number of mini-batches between
soft thresholdings under a lasso penalty, 10 by default.
'NumCheckConvergence' Number of passes between
convergence checks of the 'dual' solver, 2 by
default. MathWorks documents 5 ; R2024a and R2026a both
report 2 , so the documentation is stale rather than the
releases being inconsistent.
'HessianHistorySize' Number of curvature pairs the
quasi-Newton solvers keep, 15 by default.
'ClassNames' The classes to keep, given in the type
of Y . Observations of any other class are dropped.
'Cost' A square misclassification cost matrix.
'Prior' 'empirical' , the default,
'uniform' , a vector of probabilities, or a structure with
ClassNames and ClassProbs fields.
'ScoreTransform' A transformation applied to the
scores, named or given as a function handle.
'Weights' One nonnegative weight per observation.
'PredictorNames' One name per predictor.
'ResponseName' A name for the response.
'CategoricalPredictors' Indices of the categorical
predictors.

The default solver is 'sparsa' under a lasso penalty. Under a
ridge penalty it is 'bfgs' when there are no more than 100
predictors, and beyond that 'dual' for a support vector
machine and 'sgd' for a logistic regression.

See also:
fitclinear,
ClassificationKernel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Fit a linear binary classifier.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
ClassificationLinear.Cost


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 634
ClassificationLinear: property Cost

Cost of misclassifying an observation

A square numeric matrix with one row and one column per class, whose
(i,j) element is the cost of classifying an observation of
class i into class j . It defaults to one everywhere
except the diagonal, which is zero. This property is read-only:
MATLAB refuses an assignment into it on this class, as it does on the
support vector machine, so a cost matrix is given to the constructor
instead.

The cost matrix takes no part in the fit and none in predict ,
which returns the class of largest score. It is read by the
'mincost' and 'classifcost' losses alone.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Cost of misclassifying an observation



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
ClassificationLinear.ExpandedPredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 257
ClassificationLinear: property ExpandedPredictorNames

Names of the predictors as the fit saw them

A cell array of character vectors. It equals PredictorNames
unless categorical predictors were expanded into indicator variables.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
Names of the predictors as the fit saw them



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
ClassificationLinear.FittedLoss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 273
ClassificationLinear: property FittedLoss

Loss function the fit minimized

'hinge' for a support vector machine and 'logit' for a
logistic regression. This is the loss of the objective, which is not
the loss loss reports unless it is asked for. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Loss function the fit minimized



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
ClassificationLinear.Lambda


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 239
ClassificationLinear: property Lambda

Regularization strength

A nonnegative scalar, or a 1xL row of them in ascending order.
It defaults to the reciprocal of the number of observations used to
train the model. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
Regularization strength



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
ClassificationLinear.Learner


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 141
ClassificationLinear: property Learner

Linear classification model that was fitted

Either 'svm' or 'logistic' . This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
Linear classification model that was fitted



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
ClassificationLinear.ModelParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 268
ClassificationLinear: property ModelParameters

Fitting options, as they were given

A structure holding every parameter of the fit, including the ones
that a different solver would have used and the 'auto' values
before they were resolved. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
Fitting options, as they were given



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
ClassificationLinear.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 217
ClassificationLinear: property PredictorNames

Names of the predictors

A cell array of character vectors with one name per column of the
training data, defaulting to 'x1' , 'x2' and so on.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
Names of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
ClassificationLinear.Prior


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 253
ClassificationLinear: property Prior

Prior probability of each class

A numeric row vector with one element per class, in the order of
ClassNames and summing to one. It defaults to the class
frequencies of the training data. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Prior probability of each class



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
ClassificationLinear.Regularization


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 134
ClassificationLinear: property Regularization

Penalty on the coefficients

'ridge (L2)' or 'lasso (L1)' . This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Penalty on the coefficients



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
ClassificationLinear.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 134
ClassificationLinear: property ResponseName

Name of the response

A character vector, defaulting to 'Y' . This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Name of the response



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
ClassificationLinear.ScoreTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 368
ClassificationLinear: property ScoreTransform

Transformation applied to the predicted scores

A character vector naming a transformation, or the text of the
function handle that was supplied. Assigning to it accepts either.
It defaults to 'logit' for a logistic learner, which turns the
scores into posterior probabilities, and to 'none' for a
support vector machine.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
Transformation applied to the predicted scores



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
ClassificationLinear.edge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 321
ClassificationLinear: e = edge ( obj , X , Y )
ClassificationLinear: e = edge (&hellip;, 'Weights' , W )

Weighted mean of the classification margins.

e = edge ( obj , X , Y ) returns one value
per regularization strength. The weights are normalized within each
class to that class&rsquo;s prior before they are applied.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 44
Weighted mean of the classification margins.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
ClassificationLinear.loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 429
ClassificationLinear: l = loss ( obj , X , Y )
ClassificationLinear: l = loss (&hellip;, name , value )

Classification loss on new data.

l = loss ( obj , X , Y ) returns the
misclassification rate, one value per regularization strength.

l = loss (&hellip;, name , value ) takes
'LossFun' , one of 'binodeviance' ,
'classifcost' , 'classiferror' , 'exponential' ,
'hinge' , 'logit' , 'mincost' and
'quadratic' , and 'Weights' .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Classification loss on new data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
ClassificationLinear.margin


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 304
ClassificationLinear: m = margin ( obj , X , Y )

Classification margin of each observation.

m = margin ( obj , X , Y ) returns the
score of the true class less the score of the other one, one row per
observation and one column per regularization strength. A positive
margin is a correct classification.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Classification margin of each observation.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
ClassificationLinear.predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 608
ClassificationLinear: labels = predict ( obj , XC )
ClassificationLinear: [ labels , scores ] = predict ( obj , XC )

Classify new observations.

labels = predict ( obj , XC ) returns the class
of largest score for each row of XC , in the type of the
response the model was fitted to. With L regularization
strengths labels has one column per strength.

[ labels , scores ] = predict ( obj , XC )
also returns the scores, an Nx2 matrix whose columns follow
ClassNames , or an Nx2xL array with more than one
strength. The scores are -f and +f for the raw model
value f , after ScoreTransform has been applied.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
Classify new observations.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
ClassificationLinear.savemodel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 186
ClassificationLinear: savemodel ( obj , filename )

Save a linear classifier to a file.

savemodel ( obj , filename ) saves the model
obj into filename in a form loadmodel can read
back.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
Save a linear classifier to a file.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
ClassificationLinear.selectModels


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 259
ClassificationLinear: sub = selectModels ( obj , idx )

Keep a subset of the fitted regularization strengths.

sub = selectModels ( obj , idx ) returns a model
holding only the strengths idx names, which may be indices into
Lambda or a logical vector over it.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 53
Keep a subset of the fitted regularization strengths.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
ClassificationNaiveBayes


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1219
statistics: ClassificationNaiveBayes

Naive Bayes classification

The ClassificationNaiveBayes class implements a naive Bayes
classifier object, which can predict responses for new data using the
predict method.

A naive Bayes classifier estimates one univariate density per class and
per predictor, and treats the predictors as conditionally independent
given the class. The joint likelihood of an observation is therefore the
product of its per-predictor densities, and the posterior follows from
the class prior by Bayes&rsquo; rule. The independence assumption is rarely
true, but it costs only one density per predictor rather than one joint
density over all of them, which is what makes the model usable when the
predictors are many and the observations few.

Create a ClassificationNaiveBayes object by using the
fitcnb function or the class constructor.

Each predictor carries its own distribution, named in
DistributionNames , and the fitted parameters of class k and
predictor j are held in DistributionParameters{k,j} . A
'normal' predictor stores a two element column vector, the class
conditional mean and standard deviation; a 'kernel' predictor
stores a prob.KernelDistribution object.

See also:
fitcnb


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
Naive Bayes classification



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
ClassificationNaiveBayes.BinEdges


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 494
ClassificationNaiveBayes: property BinEdges

Bin edges

A cell array with one entry per predictor, holding that predictor&rsquo;s bin
edges where the learner discretized it before fitting. A naive Bayes
model fits a density to each predictor as it stands and bins nothing, so
this is always an empty cell. It is kept because the cross-validated
model carries it across, and because code that reaches into it with
cellfun must find a cell rather than an empty matrix. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
Bin edges



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
ClassificationNaiveBayes.CategoricalLevels


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 247
ClassificationNaiveBayes: property CategoricalLevels

Levels of the categorical predictors

A cell array with one entry per predictor, holding the distinct levels
of each categorical predictor and empty for every other. This property
is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
Levels of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
ClassificationNaiveBayes.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 211
ClassificationNaiveBayes: property CategoricalPredictors

Categorical predictor indices

A numeric row vector of the column indices of X treated as
categorical, or empty when none is. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Categorical predictor indices



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
ClassificationNaiveBayes.ClassNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 304
ClassificationNaiveBayes: property ClassNames

Class labels of the fitted model

A cell array of character vectors, a logical or numeric column vector,
or a character array, holding the distinct classes the model was fitted
on, in the order the other per-class properties use. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Class labels of the fitted model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
ClassificationNaiveBayes.ClassificationNaiveBayes


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 441
ClassificationNaiveBayes: obj = ClassificationNaiveBayes ( X , Y )
ClassificationNaiveBayes: obj = ClassificationNaiveBayes (&hellip;, name , value )

Create a ClassificationNaiveBayes object.

obj = ClassificationNaiveBayes ( X , Y ) fits a
naive Bayes classifier to the predictor data X and the class
labels Y . The supported Name / Value pairs are
those of fitcnb , which is the documented way to reach this
constructor.

See also:
fitcnb


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Create a ClassificationNaiveBayes object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
ClassificationNaiveBayes.Cost


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 396
ClassificationNaiveBayes: property Cost

Misclassification cost

A square numeric matrix with one row and column per class, in the order
of ClassNames . Cost(i,j) is the cost of classifying an
observation of class i into class j , and the default is
one off the diagonal and zero on it. It may be assigned after fitting,
as a matrix or as a structure carrying ClassNames and
ClassificationCosts .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Misclassification cost



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
ClassificationNaiveBayes.DistributionNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 231
ClassificationNaiveBayes: property DistributionNames

Predictor distributions

A cell array of character vectors with one entry per predictor, naming
the distribution fitted to it: 'normal' or 'kernel' .
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
Predictor distributions



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
ClassificationNaiveBayes.DistributionParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 421
ClassificationNaiveBayes: property DistributionParameters

Fitted distribution parameters

A cell array with one row per class and one column per predictor.
DistributionParameters{k,j} holds the parameters fitted to
predictor j within class k : a two element column vector,
the mean and the standard deviation, for a 'normal' predictor,
and a prob.KernelDistribution object for a 'kernel' one.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
Fitted distribution parameters



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
ClassificationNaiveBayes.ExpandedPredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 301
ClassificationNaiveBayes: property ExpandedPredictorNames

Expanded predictor variable names

A cell array of character vectors naming the predictors as the model
sees them. It equals PredictorNames unless a categorical
predictor has been expanded into indicator variables. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
Expanded predictor variable names



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 58
ClassificationNaiveBayes.HyperparameterOptimizationResults


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 367
ClassificationNaiveBayes: property HyperparameterOptimizationResults

Results of the hyperparameter optimization

Always empty. It is declared for MATLAB compatibility, where
it holds what an automatic search over the hyperparameters found. This
class fits the parameters it is given and runs no such search, so there
is nothing to report. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Results of the hyperparameter optimization



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
ClassificationNaiveBayes.Kernel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 225
ClassificationNaiveBayes: property Kernel

Kernel smoothing functions

A cell array with one entry per predictor naming the smoothing kernel
used by a 'kernel' predictor, and empty for every other. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
Kernel smoothing functions



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
ClassificationNaiveBayes.ModelParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 584
ClassificationNaiveBayes: property ModelParameters

What was fitted, and how

A structure carrying DistributionNames , Kernel ,
Support , Width , StandardizeData ,
Version , Method and Type .

It records the arguments as they were given , where the
properties of the same name record what they were resolved to: a model
fitted with no 'DistributionNames' argument reports the single
name 'normal' here and one name per predictor there. The
kernel settings are filled in with their defaults when a kernel density
was asked for, and left empty when none was. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
What was fitted, and how



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
ClassificationNaiveBayes.Mu


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 265
ClassificationNaiveBayes: property Mu

Predictor means

The means used to center the predictors, when the model standardizes
them, and empty otherwise. These are not the class conditional
means, which are held in DistributionParameters . This property
is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
Predictor means



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
ClassificationNaiveBayes.NumObservations


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 241
ClassificationNaiveBayes: property NumObservations

Number of observations

A positive integer specifying the number of observations used to train
the model, after any row holding a missing value has been dropped. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Number of observations



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
ClassificationNaiveBayes.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 249
ClassificationNaiveBayes: property PredictorNames

Predictor variable names

A cell array of character vectors naming the predictors, in the order in
which they appear in X . The default names are 'x1' ,
'x2' , and so on. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
Predictor variable names



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
ClassificationNaiveBayes.Prior


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 328
ClassificationNaiveBayes: property Prior

Class prior probabilities

A numeric row vector with one entry per class, in the order of
ClassNames , summing to one. It may be assigned after fitting,
as a numeric vector, as a structure carrying ClassNames and
ClassProbs , or as 'empirical' or 'uniform' .
Assigning it re-derives W .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
Class prior probabilities



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
ClassificationNaiveBayes.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 165
ClassificationNaiveBayes: property ResponseName

Response variable name

A character vector naming the response variable, 'Y' by default.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Response variable name



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
ClassificationNaiveBayes.RowsUsed


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 375
ClassificationNaiveBayes: property RowsUsed

Rows used for fitting

A logical column vector with the same length as the observations in the
original predictor data X , true for each row that was used for
fitting the model. It is empty, [] , when every observation was
used, so a non-empty value means that rows holding missing values were
dropped. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
Rows used for fitting



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
ClassificationNaiveBayes.ScoreTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 281
ClassificationNaiveBayes: property ScoreTransform

Score transformation

A character vector naming the function applied to the posterior returned
by predict , or a function handle taking and returning a matrix of
the same size. The default, 'none' , leaves the posterior
untouched.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Score transformation



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
ClassificationNaiveBayes.Sigma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 309
ClassificationNaiveBayes: property Sigma

Predictor standard deviations

The standard deviations used to scale the predictors, when the model
standardizes them, and empty otherwise. These are not the class
conditional standard deviations, which are held in
DistributionParameters . This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Predictor standard deviations



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
ClassificationNaiveBayes.Support


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 227
ClassificationNaiveBayes: property Support

Kernel smoothing supports

A cell array with one entry per predictor giving the support of a
'kernel' predictor&rsquo;s density, and empty for every other. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
Kernel smoothing supports



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
ClassificationNaiveBayes.W


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 262
ClassificationNaiveBayes: property W

Observation weights

A numeric column vector with one entry per observation used for fitting,
summing to one. Each class contributes its prior, spread evenly over
the observations belonging to it. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
Observation weights



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
ClassificationNaiveBayes.Width


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 271
ClassificationNaiveBayes: property Width

Kernel smoothing bandwidths

A numeric matrix with one row per class and one column per predictor,
giving the bandwidth of each 'kernel' predictor&rsquo;s density, and
empty when no predictor uses one. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Kernel smoothing bandwidths



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
ClassificationNaiveBayes.X


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 224
ClassificationNaiveBayes: property X

Predictor data

A numeric matrix containing the predictor data. Each column of X
represents one predictor (variable), and each row represents one
observation. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
Predictor data



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
ClassificationNaiveBayes.Y


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 316
ClassificationNaiveBayes: property Y

Class labels

Specified as a logical or numeric column vector, or as a character array
or a cell array of character vectors with the same number of rows as the
predictor data. Each row in Y is the observed class label for the
corresponding row in X . This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
Class labels



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
ClassificationNaiveBayes.compact


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 394
ClassificationNaiveBayes: CMdl = compact ( obj )

Drop the training data from a trained model.

CMdl = compact ( obj ) returns a
CompactClassificationNaiveBayes object carrying the fitted
densities and everything predict needs, but not the observations
the model was fitted on. It classifies new data identically and is far
smaller to keep or to ship.

See also:
CompactClassificationNaiveBayes


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 44
Drop the training data from a trained model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
ClassificationNaiveBayes.crossval


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 585
ClassificationNaiveBayes: CVMdl = crossval ( obj )
ClassificationNaiveBayes: CVMdl = crossval (&hellip;, name , value )

Cross-validate a trained naive Bayes model.

CVMdl = crossval ( obj ) partitions the training data
into ten folds, or into as many folds as there are observations when
there are fewer than ten, refits the model on each fold&rsquo;s training part
and returns a ClassificationPartitionedModel .

CVMdl = crossval (&hellip;, name , value ) takes
exactly one of 'KFold' , 'Holdout' , 'Leaveout'
or 'CVPartition' .

See also:
ClassificationPartitionedModel,
cvpartition


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
Cross-validate a trained naive Bayes model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
ClassificationNaiveBayes.edge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 388
ClassificationNaiveBayes: e = edge ( obj , X , Y )
ClassificationNaiveBayes: e = edge (&hellip;, 'Weights' , w )

Classification edge on new data.

e = edge ( obj , X , Y ) returns the weighted
mean of the margins, a single number summarising how confidently the
model classifies the data.

The weights are normalized within each class to that class&rsquo;s prior
before they are applied.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Classification edge on new data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
ClassificationNaiveBayes.logp


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 398
ClassificationNaiveBayes: lp = logp ( obj , X )

Log unconditional probability density of new data.

lp = logp ( obj , X ) returns one value per
observation, the logarithm of its density under the fitted model taken
over all the classes, each weighted by its prior. A markedly low value
marks an observation the model finds unlike anything it was trained on,
whatever class it would be assigned to.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
Log unconditional probability density of new data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
ClassificationNaiveBayes.loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 511
ClassificationNaiveBayes: l = loss ( obj , X , Y )
ClassificationNaiveBayes: l = loss (&hellip;, name , value )

Classification loss on new data.

l = loss ( obj , X , Y ) returns the minimum
expected misclassification cost.

l = loss (&hellip;, name , value ) takes the
following options.

Name Value
'LossFun' One of 'binodeviance' ,
'classifcost' , 'classiferror' , 'exponential' ,
'hinge' , 'logit' , 'mincost' (default) or
'quadratic' .
'Weights' A numeric vector of observation weights,
one per row of X .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Classification loss on new data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
ClassificationNaiveBayes.margin


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 394
ClassificationNaiveBayes: m = margin ( obj , X , Y )

Classification margin on new data.

m = margin ( obj , X , Y ) returns one margin
per observation: the posterior the model gives the observation&rsquo;s true
class, less the largest posterior it gives any other class. A positive
margin means the observation is classified correctly, and a larger one
means it is classified more confidently.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
Classification margin on new data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
ClassificationNaiveBayes.predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 627
ClassificationNaiveBayes: label = predict ( obj , XC )
ClassificationNaiveBayes: [ label , score , cost ] = predict ( obj , XC )

Classify new data with a trained ClassificationNaiveBayes object.

label = predict ( obj , XC ) returns the predicted
class label for each row of XC , which must have as many columns as
the predictor data the model was fitted on.

[ label , score , cost ] = predict ( obj ,
XC ) also returns score , the posterior probability of each
class, and cost , the expected misclassification cost of assigning
each observation to each class. The label of an observation is the
class of least expected cost.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 65
Classify new data with a trained ClassificationNaiveBayes object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
ClassificationNaiveBayes.resubEdge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 90
ClassificationNaiveBayes: e = resubEdge ( obj )

Classification edge on the training data.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Classification edge on the training data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
ClassificationNaiveBayes.resubLoss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 190
ClassificationNaiveBayes: l = resubLoss ( obj )
ClassificationNaiveBayes: l = resubLoss (&hellip;, name , value )

Classification loss on the training data.

Takes the same options as loss .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Classification loss on the training data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
ClassificationNaiveBayes.resubMargin


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 94
ClassificationNaiveBayes: m = resubMargin ( obj )

Classification margin on the training data.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
Classification margin on the training data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
ClassificationNaiveBayes.resubPredict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 307
ClassificationNaiveBayes: label = resubPredict ( obj )
ClassificationNaiveBayes: [ label , score , cost ] = resubPredict ( obj )

Classify the training data with the trained model.

The same as calling predict on the data the model was fitted on,
with the rows that were dropped for missing values left out.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
Classify the training data with the trained model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
ClassificationNaiveBayes.savemodel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 499
ClassificationNaiveBayes: savemodel ( obj , filename )

Save a ClassificationNaiveBayes object.

savemodel ( obj , filename ) saves each property of a
ClassificationNaiveBayes object into an Octave binary file, the name of
which is specified in filename , along with an extra variable, which
defines the type classification object these variables constitute. Use
loadmodel in order to load a classification object into Octave&rsquo;s
workspace.

See also:
loadmodel,
fitcnb,
ClassificationNaiveBayes


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
Save a ClassificationNaiveBayes object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
ClassificationNeuralNetwork


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 591
statistics: ClassificationNeuralNetwork

Neural network classification

The ClassificationNeuralNetwork class implements a neural network
classifier object, which can predict responses for new data using the
predict method.

Neural network classification is a machine learning method that uses
interconnected nodes in multiple layers to learn complex patterns in data.
It processes inputs through hidden layers with activation functions to
produce classification outputs.

Create a ClassificationNeuralNetwork object by using the
fitcnet function or the class constructor.

See also:
fitcnet


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Neural network classification



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
ClassificationNeuralNetwork.Activations


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 391
ClassificationNeuralNetwork: property Activations

Activation functions for hidden layers

A character vector or cell array of character vectors specifying the
activation functions used in the hidden layers of the neural network.
Supported activation functions include: 'linear' ,
'sigmoid' , 'relu' , 'tanh' , 'softmax' ,
'lrelu' , 'prelu' , 'elu' , and 'gelu' .
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
Activation functions for hidden layers



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
ClassificationNeuralNetwork.BinEdges


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 375
ClassificationNeuralNetwork: property BinEdges

Bin edges of the predictors

A cell array with one entry per predictor, holding that predictor&rsquo;s bin
edges where the learner discretized it before fitting. It is empty here
and stays empty: this learner fits the predictors as they are, and
MATLAB&rsquo;s reports an empty cell for it as well.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Bin edges of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
ClassificationNeuralNetwork.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 239
ClassificationNeuralNetwork: property CategoricalPredictors

Indices of the categorical predictors

A numeric vector of column indices into X naming the predictors
treated as categorical, and empty when none is. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
ClassificationNeuralNetwork.ClassNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 355
ClassificationNeuralNetwork: property ClassNames

Names of classes in the response variable

An array of unique values of the response variable Y , which has the
same data types as the data in Y . This property is read-only.
ClassNames can have any of the following datatypes:

Cell array of character vectors
Character array
Logical vector
Numeric vector


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Names of classes in the response variable



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 55
ClassificationNeuralNetwork.ClassificationNeuralNetwork


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4675
statistics: obj = ClassificationNeuralNetwork ( X , Y )
statistics: obj = ClassificationNeuralNetwork (&hellip;, name , value )

Create a ClassificationNeuralNetwork class object containing a
neural network classification model.

obj = ClassificationNeuralNetwork ( X , Y ) returns
a ClassificationNeuralNetwork object, with X as the predictor data
and Y containing the class labels of observations in X .

X must be a N&times;P numeric matrix of input data where rows
correspond to observations and columns correspond to features or
variables. X will be used to train the neural network model.

Y is N&times;1 matrix or cell matrix containing the class labels
of corresponding predictor data in X . Y can contain any type
of categorical data. Y must have the same number of rows as
X .

obj = ClassificationNeuralNetwork (&hellip;, name ,
value ) returns a ClassificationNeuralNetwork object with
parameters specified by the following name , value
paired input arguments:

Name Value
'PredictorNames' A cell array of character
vectors specifying the names of the predictors. The length of this array
must match the number of columns in X .
'ResponseName' A character vector specifying the
name of the response variable.
'ClassNames' Names of the classes in the class
labels, Y , used for fitting the neural network model.
ClassNames are of the same type as the class labels in Y .
'ScoreTransform' A user-defined function handle
or a character vector specifying one of the following builtin functions
specifying the transformation applied to predicted classification scores.
Supported values include 'doublelogit' , 'invlogit' ,
'ismax' , 'logit' , 'none' , 'identity' ,
'sign' , 'symmetric' , 'symmetricismax' , and
'symmetriclogit' .
'Standardize' A logical scalar specifying whether
to standardize the predictor data. When true , the predictors are
centered and scaled to have zero mean and unit variance.
'LayerSizes' A positive integer vector specifying
the sizes of the fully connected layers in the neural network. The
default is 10.
'Activations' A character vector or cell array of
character vectors specifying the activation functions for the hidden
layers. Supported values include 'linear' , 'sigmoid' ,
'relu' , 'tanh' , 'softmax' , 'lrelu' ,
'prelu' , 'elu' , and 'gelu' . The default is
'relu' , whose gradient is one wherever a unit is active and so
does not shrink as it passes back through the layers, where a sigmoid
multiplies it by at most a quarter at every one.
'OutputLayerActivation' A character vector
specifying the activation function for the output layer. Supported
values are the same as for 'Activations' . The default is
'softmax' , which makes the scores a probability over the
classes and trains the network against cross entropy; any other value
trains it against the mean squared error.
'LearningRate' A positive scalar specifying the
learning rate for gradient descent. The default is 0.003. A larger
rate can drive every unit of a hidden layer negative, after which a
rectifier passes no gradient and the network stops training.
Applies only when 'Solver' is 'sgd' .
'Solver' A character vector naming the solver that
trains the network, either 'lbfgs' or 'sgd' . The
default is 'lbfgs' , which minimizes the loss over the whole
training set at once by limited-memory BFGS, as MATLAB does. It takes
no learning rate, stops on the three tolerances below, and reaches a
lower training loss in fewer passes over the data, though each of its
iterations costs several passes where an epoch costs one.
'sgd' visits the samples one at a time and steps down the
gradient of each, running for 'IterationLimit' epochs; it was
the default before version 1.9.0.
'GradientTolerance' A nonnegative scalar. Training
stops once the gradient&rsquo;s infinity norm falls to or below it, which is
the quantity MATLAB tests too. The default is 1e-6 . Applies
only when 'Solver' is 'lbfgs' .
'StepTolerance' A nonnegative scalar. Training
stops once the step&rsquo;s infinity norm falls to or below it, which is the
quantity MATLAB tests too. The default is 1e-6 . Applies only
when 'Solver' is 'lbfgs' .
'LossTolerance' A real scalar. Training stops once
the training loss falls to or below it. The test is on the loss
itself and not on its change, matching MATLAB; pass -Inf to
switch it off. The default is 1e-6 . Applies only when
'Solver' is 'lbfgs' .
'IterationLimit' A positive integer specifying
the maximum number of training iterations. The default is 1000.
Under 'sgd' this counts epochs, under
'lbfgs' solver iterations.
'DisplayInfo' A logical scalar specifying whether
to display training information. The default is false .

See also:
fitcnet


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 99
Create a ClassificationNeuralNetwork class object containing a neural network classification model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
ClassificationNeuralNetwork.ConvergenceInfo


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 749
ClassificationNeuralNetwork: property ConvergenceInfo

Training convergence information

A structure containing convergence information of the neural network
classifier model with the following fields:

Accuracy - The prediction accuracy at each iteration
during training
TrainingLoss - The loss value recorded at each iteration
during training
Time - The cumulative time taken for all iterations in
seconds

This property is read-only.

Under 'lbfgs' the structure carries Gradient and
Step , the two quantities the solver measured to decide it had
converged, and ConvergenceCriterion , naming the test that
stopped it. It carries no Accuracy : MATLAB reports none, and
measuring it would cost a pass over the whole training set at every
iteration.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Training convergence information



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
ClassificationNeuralNetwork.Cost


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 796
ClassificationNeuralNetwork: property Cost

Cost of misclassification

A numeric matrix with one row and one column per class, where
Cost(i,j) is the cost of classifying an observation of class
i as class j . The default has zeros on the diagonal and
ones elsewhere. Change it on a trained model with dot notation, as
in obj .Cost = cost .

A cost may also be given as a struct with the fields
ClassNames and ClassificationCosts , which names the
order its own matrix is written in. That matrix is permuted into the
order of ClassNames above, so a caller need not know which
order the classes were sorted into. It must name every class.

A cost must be floating point, not sparse, not complex, non-negative
and zero down its diagonal, and must hold no NaN or
Inf . A single is widened to double .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
Cost of misclassification



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
ClassificationNeuralNetwork.DisplayInfo


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 185
ClassificationNeuralNetwork: property DisplayInfo

Display training information flag

A boolean flag indicating whether to print information during training.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
Display training information flag



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
ClassificationNeuralNetwork.ExpandedPredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 272
ClassificationNeuralNetwork: property ExpandedPredictorNames

Names of the predictors as the model expanded them

A cell array of character vectors. It matches PredictorNames
unless a categorical predictor was expanded into indicator variables.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
Names of the predictors as the model expanded them



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 61
ClassificationNeuralNetwork.HyperparameterOptimizationResults


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 370
ClassificationNeuralNetwork: property HyperparameterOptimizationResults

Results of the hyperparameter optimization

Always empty. It is declared for MATLAB compatibility, where
it holds what an automatic search over the hyperparameters found. This
class fits the parameters it is given and runs no such search, so there
is nothing to report. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Results of the hyperparameter optimization



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
ClassificationNeuralNetwork.IterationLimit


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 207
ClassificationNeuralNetwork: property IterationLimit

Maximum number of training iterations

A positive integer value defining the maximum number of epochs for
training the model. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Maximum number of training iterations



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
ClassificationNeuralNetwork.LayerBiases


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 240
ClassificationNeuralNetwork: property LayerBiases

Learned bias of each fully connected layer

A cell array holding one column vector per layer, the output layer
included, with one entry per neuron of that layer. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Learned bias of each fully connected layer



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
ClassificationNeuralNetwork.LayerSizes


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 480
ClassificationNeuralNetwork: property LayerSizes

Sizes of fully connected layers

A positive integer vector specifying the sizes of the fully connected
layers in the neural network model. The i-th element of
LayerSizes is the number of outputs in the i-th fully connected
layer of the neural network model. LayerSizes does not include
the size of the final fully connected layer. This layer always has K
outputs, where K is the number of classes in Y. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Sizes of fully connected layers



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
ClassificationNeuralNetwork.LayerWeights


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 291
ClassificationNeuralNetwork: property LayerWeights

Learned weights of each fully connected layer

A cell array holding one weight matrix per layer, the output layer
included. LayerWeights{i} has one row per neuron of layer
i and one column per input it receives. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
Learned weights of each fully connected layer



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
ClassificationNeuralNetwork.LearningRate


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 222
ClassificationNeuralNetwork: property LearningRate

Learning rate for gradient descent

A positive scalar value defining the learning rate used by the gradient
descent algorithm during training. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
Learning rate for gradient descent



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
ClassificationNeuralNetwork.ModelParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1174
ClassificationNeuralNetwork: property ModelParameters

Neural network model parameters

A structure holding the fit as it was asked for: LayerSizes ,
Activations , OutputLayerActivation ,
LayerWeightsInitializers , Solver ,
LearningRate , IterationLimit ,
GradientTolerance , LossTolerance ,
StepTolerance , DisplayInfo , StandardizeData ,
and the Version , Method and Type tags.

What came out of the fit is elsewhere: the LayerWeights and
LayerBiases properties hold the network, TrainingHistory
the series and ConvergenceInfo where it stopped.

LayerWeightsInitializers names the scheme each layer&rsquo;s weights
were drawn with, the output layer last: 'he' for a rectifying
activation and 'glorot' for a symmetric one. It is a report,
not a setting, the engine choosing per layer from the activation and
offering no way to override it.

OutputLayerActivation , Solver and LearningRate
are this package&rsquo;s own; MATLAB has no counterpart for them. The fields
it reports that this class does not accept as arguments
( Lambda , the validation set and its patience and frequency,
InitialStepSize and the two initializer settings) are absent.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Neural network model parameters



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
ClassificationNeuralNetwork.Mu


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 410
ClassificationNeuralNetwork: property Mu

Predictor means

A numeric vector containing the means of the predictors used for
standardization. Empty when the predictor data were not standardized.
This property is read-only.

Only observations with no missing predictor enter the estimate, and
they are weighted so that each class keeps the share of the
observation weight it carried before any row was set aside.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
Predictor means



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
ClassificationNeuralNetwork.NumObservations


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 250
ClassificationNeuralNetwork: property NumObservations

Number of observations

A positive integer value specifying the number of observations in the
training dataset used for training the ClassificationNeuralNetwork model.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Number of observations



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
ClassificationNeuralNetwork.NumPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 244
ClassificationNeuralNetwork: property NumPredictors

Number of predictors

A positive integer value specifying the number of predictors in the
training dataset used for training the ClassificationNeuralNetwork model.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Number of predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
ClassificationNeuralNetwork.OutputLayerActivation


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 449
ClassificationNeuralNetwork: property OutputLayerActivation

Activation function for output layer

A character vector specifying the activation function of the output layer
of the neural network. Supported activation functions are the same as
for the Activations property. The default, softmax ,
reports a probability over the classes; the network is then trained
against cross entropy rather than the mean squared error. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
Activation function for output layer



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
ClassificationNeuralNetwork.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 267
ClassificationNeuralNetwork: property PredictorNames

Names of predictor variables

A cell array of character vectors specifying the names of the predictor
variables. The names are in the order in which they appear in the
training dataset. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
Names of predictor variables



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
ClassificationNeuralNetwork.Prior


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 623
ClassificationNeuralNetwork: property Prior

Prior probability of each class

A numeric vector with one entry per class, in the order of
ClassNames , summing to one. It defaults to the relative
frequency of each class in the training data. This property is
read-only, as MATLAB documents it; pass 'Prior' to
fitcnet to set it.

Specified as a row vector with one entry per class, in the order of
ClassNames , and rescaled to sum to one. It may be given as
'empirical' , 'uniform' , a numeric vector, or a
structure with ClassNames and ClassProbs fields, which
assigns each probability by class name rather than by position.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Prior probability of each class



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
ClassificationNeuralNetwork.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 171
ClassificationNeuralNetwork: property ResponseName

Response variable name

A character vector specifying the name of the response variable Y .
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Response variable name



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
ClassificationNeuralNetwork.RowsUsed


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 406
ClassificationNeuralNetwork: property RowsUsed

Rows used for fitting

A logical column vector with the same length as the observations in the
original predictor data X , true for each row that was used for
fitting the ClassificationNeuralNetwork model. It is empty, [] ,
when every observation was used, so a non-empty value means that rows
holding missing values were dropped. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
Rows used for fitting



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
ClassificationNeuralNetwork.ScoreTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1007
ClassificationNeuralNetwork: property ScoreTransform

Transformation function for classification scores

Specified as a function handle for transforming the classification
scores. Add or change the ScoreTransform property using dot
notation as in:

obj .ScoreTransform = 'function_name'
obj .ScoreTransform = @function_handle

When specified as a character vector, it can be any of the following
built-in functions. Nevertheless, the ScoreTransform property
always stores their function handle equivalent.

Value Description
'doublelogit' 1 ./ (1 + exp (-2 &times; x))
'invlogit' log (x ./ (1 - x))
'ismax' Sets the score for the class with the
largest score to 1, and for all other classes to 0
'logit' 1 ./ (1 + exp (-x))
'none' x (no transformation)
'identity' x (no transformation)
'sign' -1 for x < 0, 0 for x = 0, 1 for x >
0
'symmetric' 2 &times; x - 1
'symmetricismax' Sets the score for the class
with the largest score to 1, and for all other classes to -1
'symmetriclogit' 2 ./ (1 + exp (-x)) - 1


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Transformation function for classification scores



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
ClassificationNeuralNetwork.Sigma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 441
ClassificationNeuralNetwork: property Sigma

Predictor standard deviations

A numeric vector containing the standard deviations of the predictors
used for standardization. Empty when the predictor data were not
standardized.
This property is read-only.

Only observations with no missing predictor enter the estimate, and
they are weighted so that each class keeps the share of the
observation weight it carried before any row was set aside.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Predictor standard deviations



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
ClassificationNeuralNetwork.Solver


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 277
ClassificationNeuralNetwork: property Solver

Solver used for training

A character vector specifying the solver algorithm used to train the
neural network model, either 'Gradient Descent' for the
stochastic solver or 'LBFGS' for the full-batch one. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
Solver used for training



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
ClassificationNeuralNetwork.TrainingHistory


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 466
ClassificationNeuralNetwork: property TrainingHistory

Iteration by iteration record of training

A table with one row per iteration, holding the iteration number, the
training loss and the training accuracy recorded at it. This property
is read-only.

The columns follow the solver. Under 'sgd' they are
Iteration and TrainingLoss , with TrainingAccuracy
for a classifier. Under 'lbfgs' they are Iteration ,
TrainingLoss , Gradient and Step , as MATLAB&rsquo;s are.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Iteration by iteration record of training



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
ClassificationNeuralNetwork.W


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 385
ClassificationNeuralNetwork: property W

Observation weights

A numeric column vector with one entry per training observation. It
defaults to a uniform weight for every observation. This property is
read-only.

Each class carries its prior spread evenly over its own observations,
so an observation of a class weighs Prior for that class
divided by the number of observations it holds.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
Observation weights



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
ClassificationNeuralNetwork.X


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 242
ClassificationNeuralNetwork: property X

Predictor data

A numeric matrix containing the unstandardized predictor data. Each
column of X represents one predictor (variable), and each row
represents one observation. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
Predictor data



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
ClassificationNeuralNetwork.Y


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 319
ClassificationNeuralNetwork: property Y

Class labels

Specified as a logical or numeric column vector, or as a character array
or a cell array of character vectors with the same number of rows as the
predictor data. Each row in Y is the observed class label for
the corresponding row in X . This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
Class labels



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
ClassificationNeuralNetwork.compact


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 289
ClassificationNeuralNetwork: CVMdl = compact ( obj )

Create a CompactClassificationNeuralNetwork object.

CVMdl = compact ( obj ) creates a compact version of the
ClassificationNeuralNetwork object, obj .

See also:
fitcnet,
ClassificationNeuralNetwork,
CompactClassificationNeuralNetwork


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51
Create a CompactClassificationNeuralNetwork object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
ClassificationNeuralNetwork.crossval


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1079
ClassificationNeuralNetwork: CVMdl = crossval ( obj )
ClassificationNeuralNetwork: CVMdl = crossval (&hellip;, Name , Value )

Cross Validate a Neural Network classification object.

CVMdl = crossval ( obj ) returns a cross-validated model
object, CVMdl , from a trained model, obj , using 10-fold
cross-validation by default.

CVMdl = crossval ( obj , name , value )
specifies additional name-value pair arguments to customize the
cross-validation process.

Name Value
'KFold' Specify the number of folds to use in
k-fold cross-validation. "KFold", k , where k is an
integer greater than 1.
'Holdout' Specify the fraction of the data to
hold out for testing. "Holdout", p , where p is a
scalar in the range (0,1) .
'Leaveout' Specify whether to perform
leave-one-out cross-validation. "Leaveout", Value , where
Value is &rsquo;on&rsquo; or &rsquo;off&rsquo;.
'CVPartition' Specify a cvpartition
object used for cross-validation. "CVPartition", cv , where
isa ( cv , "cvpartition") = 1.

See also:
fitcnet,
ClassificationNeuralNetwork,
cvpartition,
ClassificationPartitionedModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 54
Cross Validate a Neural Network classification object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
ClassificationNeuralNetwork.edge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 499
ClassificationNeuralNetwork: e = edge ( obj , X , Y )
ClassificationNeuralNetwork: e = edge (&hellip;, "Weights" , w )

Classification edge of a neural network classifier.

e = edge ( obj , X , Y ) returns the mean of
the classification margins over the rows of X .

e = edge (&hellip;, "Weights" , w ) takes the
weighted mean instead, w holding one weight per row of X .
The weights are normalised to sum to one before they are applied.

See also:
ClassificationNeuralNetwork,
margin,
loss,
predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51
Classification edge of a neural network classifier.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
ClassificationNeuralNetwork.loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1124
ClassificationNeuralNetwork: L = loss ( obj , X , Y )
ClassificationNeuralNetwork: L = loss (&hellip;, name , value )

Classification loss of a neural network classifier.

L = loss ( obj , X , Y ) returns the
proportion of the rows of X the model misclassifies against the
true labels Y .

L = loss (&hellip;, name , value ) accepts the
following name-value pairs:

"LossFun" selects the loss. Supported values are
"mincost" , the default, "binodeviance" ,
"classifcost" , "classiferror" , "crossentropy" ,
"exponential" , "hinge" , "logit" and
"quadratic" . "mincost" assigns each observation to
the class of least expected cost and charges what that assignment
costs, so it reads the scores as a posterior; "classifcost"
charges what the model&rsquo;s own prediction costs. "crossentropy"
is defined for a network only. Note that the default differs from the
other classifiers in this package, which default to
"classiferror" , and follows MATLAB&rsquo;s for this class.

"Weights" holds one weight per row of X , normalised to
sum to one before it is applied.

See also:
ClassificationNeuralNetwork,
margin,
edge,
predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51
Classification loss of a neural network classifier.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
ClassificationNeuralNetwork.margin


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 457
ClassificationNeuralNetwork: m = margin ( obj , X , Y )

Classification margin of a neural network classifier.

m = margin ( obj , X , Y ) returns a column
vector holding, for each row of X , the score the model gives its
true class in Y less the largest score it gives any other class.
A positive margin means the observation is classified correctly, and
the larger it is the more confidently so.

See also:
ClassificationNeuralNetwork,
edge,
loss,
predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 53
Classification margin of a neural network classifier.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
ClassificationNeuralNetwork.predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1233
ClassificationNeuralNetwork: label = predict ( obj , XC )
ClassificationNeuralNetwork: [ label , score ] = predict ( obj , XC )

Classify new data points into categories using the neural network
classification model from a ClassificationNeuralNetwork object.

label = predict ( obj , XC ) returns the vector of
labels predicted for the corresponding instances in XC , using the
predictor data in obj.X and corresponding labels, obj.Y ,
stored in the ClassificationNeuralNetwork model, obj .

obj must be a ClassificationNeuralNetwork class object.

XC must be an M&times;P numeric matrix with the same number of
features P as the corresponding predictors of the neural network
model in obj .

[ label , score ] = predict ( obj , XC ) also
returns score , which contains the predicted class scores or
posterior probabilities for each instance of the corresponding unique
classes.

The score matrix contains the classification scores for each class.
For each observation in XC , the predicted class label is the one
with the highest score among all classes. If the ScoreTransform
property is set to a transformation function, the scores are transformed
accordingly before being returned.

See also:
ClassificationNeuralNetwork,
fitcnet


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 129
Classify new data points into categories using the neural network classification model from a ClassificationNeuralNetwork object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
ClassificationNeuralNetwork.resubEdge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 273
ClassificationNeuralNetwork: e = resubEdge ( obj )

Classification edge of a neural network classifier on its training
data.

e = resubEdge ( obj ) is edge applied to the
observations the model was fitted on, weighted by obj.W .

See also:
ClassificationNeuralNetwork,
edge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 72
Classification edge of a neural network classifier on its training data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
ClassificationNeuralNetwork.resubLoss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 387
ClassificationNeuralNetwork: L = resubLoss ( obj )
ClassificationNeuralNetwork: L = resubLoss (&hellip;, name , value )

Classification loss of a neural network classifier on its training
data.

L = resubLoss ( obj ) is loss applied to the
observations the model was fitted on, weighted by obj.W . It
takes the same "LossFun" name-value pair.

See also:
ClassificationNeuralNetwork,
loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 72
Classification loss of a neural network classifier on its training data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
ClassificationNeuralNetwork.resubMargin


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 263
ClassificationNeuralNetwork: m = resubMargin ( obj )

Classification margin of a neural network classifier on its training
data.

m = resubMargin ( obj ) is margin applied to
the observations the model was fitted on.

See also:
ClassificationNeuralNetwork,
margin


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 74
Classification margin of a neural network classifier on its training data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
ClassificationNeuralNetwork.resubPredict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 751
ClassificationNeuralNetwork: label = resubPredict ( obj )
ClassificationNeuralNetwork: [ label , score ] = resubPredict ( obj )

Classify the training data using the trained neural network
classification object.

label = resubPredict ( obj ) returns the vector of
labels predicted for the corresponding instances in the training data,
using the predictor data in obj.X and corresponding labels,
obj.Y , stored in the neural network classification model,
obj .

obj must be a ClassificationNeuralNetwork class object.

[ label , score ] = resubPredict ( obj ) also
returns score , which contains the predicted class scores or
posterior probabilities for each instance of the corresponding unique
classes.

See also:
ClassificationNeuralNetwork,
fitcnet


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 82
Classify the training data using the trained neural network classification object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
ClassificationNeuralNetwork.savemodel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 512
ClassificationNeuralNetwork: savemodel ( obj , filename )

Save a ClassificationNeuralNetwork object.

savemodel ( obj , filename ) saves each property of a
ClassificationNeuralNetwork object into an Octave binary file, the name
of which is specified in filename , along with an extra variable,
which defines the type classification object these variables constitute.
Use
loadmodel in order to load a classification object into Octave&rsquo;s
workspace.

See also:
loadmodel,
fitcnet,
ClassificationNeuralNetwork


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Save a ClassificationNeuralNetwork object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
ClassificationPartitionedKernel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 925
statistics: ClassificationPartitionedKernel

Cross-validated Gaussian kernel binary classifier.

A ClassificationPartitionedKernel object holds one
ClassificationKernel per fold of a partition, each fitted to the
observations the fold trains on. Every kfold method predicts each
observation with the fold that held it out , so the estimate it
returns is an out-of-sample one.

A ClassificationKernel stores no copy of its training data and so
has no resubstitution methods and no compact form. This class is
what takes their place: cross-validation is the way a linear model is
asked how it would do on data it has not seen.

When the fold models carry a whole regularization path, every method
returns one column per strength, in the order of the 'Lambda'
that was asked for.

Create one with fitclinear and a cross-validation option, or
directly.

See also:
fitclinear,
ClassificationKernel,
ClassificationPartitionedKernel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
Cross-validated Gaussian kernel binary classifier.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 53
ClassificationPartitionedKernel.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 202
ClassificationPartitionedKernel: property CategoricalPredictors

Indices of the categorical predictors

A row vector of column indices, empty when every predictor is
numeric. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
ClassificationPartitionedKernel.ClassNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 172
ClassificationPartitionedKernel: property ClassNames

Names of the two classes

A column of the same type as the response, shared by every fold.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
Names of the two classes



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 63
ClassificationPartitionedKernel.ClassificationPartitionedKernel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1069
ClassificationPartitionedKernel: obj = ClassificationPartitionedKernel ( X , Y )
ClassificationPartitionedKernel: obj = ClassificationPartitionedKernel (&hellip;, name , value )

Cross-validate a linear binary classifier.

obj = ClassificationPartitionedKernel ( X , Y )
partitions the data into ten stratified folds and fits a
ClassificationKernel to each.

obj = ClassificationPartitionedKernel (&hellip;,
name , value ) takes one of 'KFold' ,
'Holdout' , 'Leaveout' and 'CVPartition' to say
how to partition, and any option ClassificationKernel takes to
say how to fit. 'CrossVal' is accepted and has no effect
here, this class being cross-validated by construction.

The classes, the prior and the cost are resolved once over the whole
data and handed to every fold. Anything left as 'auto' is
not: each fold resolves 'Lambda' and 'KernelScale'
against its own training rows, so ten folds of a hundred
observations each get a Lambda of one ninetieth rather than
one hundredth. Both are MATLAB&rsquo;s behaviour, measured.

See also:
fitclinear,
ClassificationKernel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Cross-validate a linear binary classifier.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
ClassificationPartitionedKernel.Cost


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 236
ClassificationPartitionedKernel: property Cost

Cost of misclassifying an observation

A square numeric matrix with one row and one column per class. It is
handed to every fold rather than re-derived by each. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Cost of misclassifying an observation



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51
ClassificationPartitionedKernel.CrossValidatedModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 180
ClassificationPartitionedKernel: property CrossValidatedModel

Name of the model that was cross-validated

Always 'Linear' , the short name MATLAB uses. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Name of the model that was cross-validated



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
ClassificationPartitionedKernel.KFold


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 222
ClassificationPartitionedKernel: property KFold

Number of folds

A positive integer scalar. A holdout partition has one fold and a
leave-one-out partition has as many as there are observations. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
Number of folds



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
ClassificationPartitionedKernel.ModelParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1155
ClassificationPartitionedKernel: property ModelParameters

What was cross-validated, and how

A structure holding the parameters the folds were fitted with, carried
through from the learner that was cross validated, beside
NLearn , the number of folds, and the Version ,
Method and Type tags of this class, with
LearnerTemplates naming the backing. The
learner&rsquo;s own tags are replaced rather than kept, so a cross-validated
SVM reports Method as 'PartitionedKernel' and not
'SVM' .

Deviation from MATLAB. MATLAB reports the parameter record of
the cross-validation ensemble here rather than of the learner,
so it says nothing at all about how the folds were fitted: of its
eighteen fields only the fold count, its partitioner and a fit template
carry anything, and the rest are boosting settings left inert. Nor can
the parameters be reached through the folds, a compact model carrying
none in MATLAB. This class reports the fit instead, which is strictly
more than MATLAB offers, and everything MATLAB&rsquo;s record does carry is
published here as the KFold , Partition , X ,
Y , W and CrossValidatedModel properties.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
What was cross-validated, and how



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
ClassificationPartitionedKernel.NumObservations


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 221
ClassificationPartitionedKernel: property NumObservations

Number of observations the partition covers

A positive integer scalar, counting the rows that survived the removal
of missing values. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
Number of observations the partition covers



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
ClassificationPartitionedKernel.Partition


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 155
ClassificationPartitionedKernel: property Partition

The partition itself

A cvpartition object over the retained observations. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
The partition itself



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
ClassificationPartitionedKernel.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 145
ClassificationPartitionedKernel: property PredictorNames

Names of the predictors

A cell array of character vectors. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
Names of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
ClassificationPartitionedKernel.Prior


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 321
ClassificationPartitionedKernel: property Prior

Prior probability of each class

A numeric row vector summing to one, in the order of
ClassNames . Like the cost it is the parent&rsquo;s and is handed to
every fold, so a fold of an unbalanced problem does not quietly adopt
a prior of its own. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Prior probability of each class



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 44
ClassificationPartitionedKernel.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 145
ClassificationPartitionedKernel: property ResponseName

Name of the response

A character vector, defaulting to 'Y' . This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Name of the response



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
ClassificationPartitionedKernel.ScoreTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 460
ClassificationPartitionedKernel: property ScoreTransform

Transformation applied to the predicted scores

A character vector naming a transformation, or the text of the
function handle that was supplied, which may be assigned after the
model is built. It is applied once to the assembled scores and is
not handed to the folds. A transform the learner implies, as
'logistic' implies 'logit' , does stay with the folds,
and this one is then applied on top of it.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
Transformation applied to the predicted scores



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
ClassificationPartitionedKernel.Trained


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 216
ClassificationPartitionedKernel: property Trained

The models fitted to the folds

A cell column with one ClassificationKernel per fold, each
fitted to the observations its fold trains on. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
The models fitted to the folds



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
ClassificationPartitionedKernel.W


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 203
ClassificationPartitionedKernel: property W

Observation weights

An Nx1 numeric vector summing to one, normalized within each
class to that class&rsquo;s cost-adjusted prior. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
Observation weights



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
ClassificationPartitionedKernel.Y


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 143
ClassificationPartitionedKernel: property Y

Response of the retained observations

In the type it was supplied in. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Response of the retained observations



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
ClassificationPartitionedKernel.kfoldEdge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 384
ClassificationPartitionedKernel: e = kfoldEdge ( obj )
ClassificationPartitionedKernel: e = kfoldEdge (&hellip;, name , value )

Weighted mean of the out-of-fold classification margins.

e = kfoldEdge (&hellip;, name , value ) takes
'Folds' , a subset of the folds to average over, and
'Mode' , either 'average' , the default, or
'individual' , which returns one row per fold instead.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 56
Weighted mean of the out-of-fold classification margins.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
ClassificationPartitionedKernel.kfoldLoss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 435
ClassificationPartitionedKernel: l = kfoldLoss ( obj )
ClassificationPartitionedKernel: l = kfoldLoss (&hellip;, name , value )

Out-of-fold classification loss.

l = kfoldLoss ( obj ) returns the out-of-fold
misclassification rate.

l = kfoldLoss (&hellip;, name , value ) takes
'LossFun' , one of 'binodeviance' ,
'classifcost' , 'classiferror' , 'exponential' ,
'hinge' , 'logit' , 'mincost' and
'quadratic' ; 'Folds' ; and 'Mode' .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Out-of-fold classification loss.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
ClassificationPartitionedKernel.kfoldMargin


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 256
ClassificationPartitionedKernel: m = kfoldMargin ( obj )

Out-of-fold classification margin of every observation.

The score the out-of-fold model gives the true class, less the score
it gives the other one. An observation no fold held out comes back
NaN .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 55
Out-of-fold classification margin of every observation.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 44
ClassificationPartitionedKernel.kfoldPredict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 435
ClassificationPartitionedKernel: labels = kfoldPredict ( obj )
ClassificationPartitionedKernel: [ labels , scores ] = kfoldPredict ( obj )

Out-of-fold class of every observation.

Each observation is classified by the fold that held it out, so the
labels are out-of-sample. An observation that no fold held out, which
under a holdout partition is most of them, comes back missing rather
than classified, and its scores come back NaN .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
Out-of-fold class of every observation.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
ClassificationPartitionedLinear


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 916
statistics: ClassificationPartitionedLinear

Cross-validated linear binary classifier.

A ClassificationPartitionedLinear object holds one
ClassificationLinear per fold of a partition, each fitted to the
observations the fold trains on. Every kfold method predicts each
observation with the fold that held it out , so the estimate it
returns is an out-of-sample one.

A ClassificationLinear stores no copy of its training data and so
has no resubstitution methods and no compact form. This class is
what takes their place: cross-validation is the way a linear model is
asked how it would do on data it has not seen.

When the fold models carry a whole regularization path, every method
returns one column per strength, in the order of the 'Lambda'
that was asked for.

Create one with fitclinear and a cross-validation option, or
directly.

See also:
fitclinear,
ClassificationLinear,
ClassificationPartitionedKernel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Cross-validated linear binary classifier.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 53
ClassificationPartitionedLinear.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 202
ClassificationPartitionedLinear: property CategoricalPredictors

Indices of the categorical predictors

A row vector of column indices, empty when every predictor is
numeric. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
ClassificationPartitionedLinear.ClassNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 172
ClassificationPartitionedLinear: property ClassNames

Names of the two classes

A column of the same type as the response, shared by every fold.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
Names of the two classes



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 63
ClassificationPartitionedLinear.ClassificationPartitionedLinear


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1039
ClassificationPartitionedLinear: obj = ClassificationPartitionedLinear ( X , Y )
ClassificationPartitionedLinear: obj = ClassificationPartitionedLinear (&hellip;, name , value )

Cross-validate a linear binary classifier.

obj = ClassificationPartitionedLinear ( X , Y )
partitions the data into ten stratified folds and fits a
ClassificationLinear to each.

obj = ClassificationPartitionedLinear (&hellip;,
name , value ) takes one of 'KFold' ,
'Holdout' , 'Leaveout' and 'CVPartition' to say
how to partition, and any option ClassificationLinear takes to
say how to fit. 'CrossVal' is accepted and has no effect
here, this class being cross-validated by construction.

The classes, the prior and the cost are resolved once over the whole
data and handed to every fold. Anything left as 'auto' is
not: each fold resolves 'Lambda' against its own training
rows, so ten folds of a hundred observations each get one ninetieth
rather than one hundredth. Both are MATLAB&rsquo;s behaviour, measured.

See also:
fitclinear,
ClassificationLinear


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Cross-validate a linear binary classifier.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
ClassificationPartitionedLinear.Cost


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 236
ClassificationPartitionedLinear: property Cost

Cost of misclassifying an observation

A square numeric matrix with one row and one column per class. It is
handed to every fold rather than re-derived by each. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Cost of misclassifying an observation



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51
ClassificationPartitionedLinear.CrossValidatedModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 180
ClassificationPartitionedLinear: property CrossValidatedModel

Name of the model that was cross-validated

Always 'Linear' , the short name MATLAB uses. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Name of the model that was cross-validated



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
ClassificationPartitionedLinear.KFold


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 222
ClassificationPartitionedLinear: property KFold

Number of folds

A positive integer scalar. A holdout partition has one fold and a
leave-one-out partition has as many as there are observations. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
Number of folds



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
ClassificationPartitionedLinear.ModelParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1155
ClassificationPartitionedLinear: property ModelParameters

What was cross-validated, and how

A structure holding the parameters the folds were fitted with, carried
through from the learner that was cross validated, beside
NLearn , the number of folds, and the Version ,
Method and Type tags of this class, with
LearnerTemplates naming the backing. The
learner&rsquo;s own tags are replaced rather than kept, so a cross-validated
SVM reports Method as 'PartitionedLinear' and not
'SVM' .

Deviation from MATLAB. MATLAB reports the parameter record of
the cross-validation ensemble here rather than of the learner,
so it says nothing at all about how the folds were fitted: of its
eighteen fields only the fold count, its partitioner and a fit template
carry anything, and the rest are boosting settings left inert. Nor can
the parameters be reached through the folds, a compact model carrying
none in MATLAB. This class reports the fit instead, which is strictly
more than MATLAB offers, and everything MATLAB&rsquo;s record does carry is
published here as the KFold , Partition , X ,
Y , W and CrossValidatedModel properties.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
What was cross-validated, and how



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
ClassificationPartitionedLinear.NumObservations


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 221
ClassificationPartitionedLinear: property NumObservations

Number of observations the partition covers

A positive integer scalar, counting the rows that survived the removal
of missing values. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
Number of observations the partition covers



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
ClassificationPartitionedLinear.Partition


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 155
ClassificationPartitionedLinear: property Partition

The partition itself

A cvpartition object over the retained observations. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
The partition itself



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
ClassificationPartitionedLinear.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 145
ClassificationPartitionedLinear: property PredictorNames

Names of the predictors

A cell array of character vectors. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
Names of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
ClassificationPartitionedLinear.Prior


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 321
ClassificationPartitionedLinear: property Prior

Prior probability of each class

A numeric row vector summing to one, in the order of
ClassNames . Like the cost it is the parent&rsquo;s and is handed to
every fold, so a fold of an unbalanced problem does not quietly adopt
a prior of its own. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Prior probability of each class



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 44
ClassificationPartitionedLinear.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 145
ClassificationPartitionedLinear: property ResponseName

Name of the response

A character vector, defaulting to 'Y' . This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Name of the response



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
ClassificationPartitionedLinear.ScoreTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 460
ClassificationPartitionedLinear: property ScoreTransform

Transformation applied to the predicted scores

A character vector naming a transformation, or the text of the
function handle that was supplied, which may be assigned after the
model is built. It is applied once to the assembled scores and is
not handed to the folds. A transform the learner implies, as
'logistic' implies 'logit' , does stay with the folds,
and this one is then applied on top of it.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
Transformation applied to the predicted scores



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
ClassificationPartitionedLinear.Trained


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 216
ClassificationPartitionedLinear: property Trained

The models fitted to the folds

A cell column with one ClassificationLinear per fold, each
fitted to the observations its fold trains on. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
The models fitted to the folds



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
ClassificationPartitionedLinear.W


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 203
ClassificationPartitionedLinear: property W

Observation weights

An Nx1 numeric vector summing to one, normalized within each
class to that class&rsquo;s cost-adjusted prior. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
Observation weights



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
ClassificationPartitionedLinear.Y


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 143
ClassificationPartitionedLinear: property Y

Response of the retained observations

In the type it was supplied in. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Response of the retained observations



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
ClassificationPartitionedLinear.kfoldEdge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 384
ClassificationPartitionedLinear: e = kfoldEdge ( obj )
ClassificationPartitionedLinear: e = kfoldEdge (&hellip;, name , value )

Weighted mean of the out-of-fold classification margins.

e = kfoldEdge (&hellip;, name , value ) takes
'Folds' , a subset of the folds to average over, and
'Mode' , either 'average' , the default, or
'individual' , which returns one row per fold instead.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 56
Weighted mean of the out-of-fold classification margins.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
ClassificationPartitionedLinear.kfoldLoss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 435
ClassificationPartitionedLinear: l = kfoldLoss ( obj )
ClassificationPartitionedLinear: l = kfoldLoss (&hellip;, name , value )

Out-of-fold classification loss.

l = kfoldLoss ( obj ) returns the out-of-fold
misclassification rate.

l = kfoldLoss (&hellip;, name , value ) takes
'LossFun' , one of 'binodeviance' ,
'classifcost' , 'classiferror' , 'exponential' ,
'hinge' , 'logit' , 'mincost' and
'quadratic' ; 'Folds' ; and 'Mode' .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Out-of-fold classification loss.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
ClassificationPartitionedLinear.kfoldMargin


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 319
ClassificationPartitionedLinear: m = kfoldMargin ( obj )

Out-of-fold classification margin of every observation.

The score the out-of-fold model gives the true class, less the score
it gives the other one. An observation no fold held out comes back
NaN . With L regularization strengths m has one
column per strength.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 55
Out-of-fold classification margin of every observation.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 44
ClassificationPartitionedLinear.kfoldPredict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 525
ClassificationPartitionedLinear: labels = kfoldPredict ( obj )
ClassificationPartitionedLinear: [ labels , scores ] = kfoldPredict ( obj )

Out-of-fold class of every observation.

Each observation is classified by the fold that held it out, so the
labels are out-of-sample. An observation that no fold held out, which
under a holdout partition is most of them, comes back missing rather
than classified, and its scores come back NaN .

With L regularization strengths labels has one column per
strength and scores is Nx2xL .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
Out-of-fold class of every observation.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
ClassificationPartitionedModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 407
statistics: ClassificationPartitionedModel

Cross-validated classification model

The ClassificationPartitionedModel class stores cross-validated
classification models trained on different partitions of the data.
It can predict responses for observations not used for training using
the kfoldPredict method.

Create a ClassificationPartitionedModel object by using the
crossval function.

See also:
crossval


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
Cross-validated classification model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
ClassificationPartitionedModel.BinEdges


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 498
ClassificationPartitionedModel: property BinEdges

Bin edges

A cell array with one entry per predictor, holding that predictor&rsquo;s
bin edges where the learner discretized it before fitting. It is
carried over from the model that was cross validated, and is empty
whenever that model did no binning, which is every learner this package
implements: MATLAB fills it only for its GAM, which bins because it is
built from boosted trees where ours is built from splines.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
Bin edges



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 52
ClassificationPartitionedModel.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 206
ClassificationPartitionedModel: property CategoricalPredictors

Indices of categorical predictors

A vector of positive integers specifying the indices of categorical
predictors. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
Indices of categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
ClassificationPartitionedModel.ClassNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 358
ClassificationPartitionedModel: property ClassNames

Names of classes in the response variable

An array of unique values of the response variable Y , which has the
same data types as the data in Y . This property is read-only.
ClassNames can have any of the following datatypes:

Cell array of character vectors
Character array
Logical vector
Numeric vector


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Names of classes in the response variable



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 61
ClassificationPartitionedModel.ClassificationPartitionedModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 451
ClassificationPartitionedModel: this = ClassificationPartitionedModel ( Mdl , Partition )

Create a ClassificationPartitionedModel class object for
cross-validation of classification models.

this = ClassificationPartitionedModel ( Mdl ,
Partition ) returns a ClassificationPartitionedModel object, with
Mdl as the trained classification model object and
Partition as the partitioning object obtained using
cvpartition
function.

See also:
cvpartition


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 99
Create a ClassificationPartitionedModel class object for cross-validation of classification models.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
ClassificationPartitionedModel.Cost


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1438
ClassificationPartitionedModel: property Cost

Cost of Misclassification

A square matrix specifying the cost of misclassification of a point.
Cost(i,j) is the cost of classifying a point into class j
if its true class is i (that is, the rows correspond to the true
class and the columns correspond to the predicted class). The order of
the rows and columns in Cost corresponds to the order of the
classes in ClassNames . The number of rows and columns in
Cost is the number of unique classes in the response. By
default, Cost(i,j) = 1 if i != j , and
Cost(i,j) = 0 if i = j . In other words, the cost is 0
for correct classification and 1 for incorrect classification.

Assigning Cost rebuilds it on every fold in Trained , so
kfoldPredict and kfoldLoss answer under the new costs. It
is refused on a cross-validated ClassificationSVM , whose costs
enter the box constraint while it is being fitted: a model already fitted
under one cost matrix cannot be made to describe another.

A cost may also be given as a struct with the fields
ClassNames and ClassificationCosts , which names the
order its own matrix is written in. That matrix is permuted into the
order of ClassNames above, so a caller need not know which
order the classes were sorted into. It must name every class.

A cost must be floating point, not sparse, not complex, non-negative
and zero down its diagonal, and must hold no NaN or
Inf . A single is widened to double .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
Cost of Misclassification



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
ClassificationPartitionedModel.CrossValidatedModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 370
ClassificationPartitionedModel: property CrossValidatedModel

Cross-validated model class

A character vector holding the short name of the learner that was
cross validated, as MATLAB reports it: 'Discriminant' ,
'GAM' , 'KNN' , 'NeuralNetwork' or
'SVM' . It is not the class name of that learner, and the
regression side uses the same names. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Cross-validated model class



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
ClassificationPartitionedModel.KFold


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 181
ClassificationPartitionedModel: property KFold

Number of cross-validated folds

A positive integer value specifying the number of cross-validated folds.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Number of cross-validated folds



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
ClassificationPartitionedModel.ModelParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1094
ClassificationPartitionedModel: property ModelParameters

Model parameters

A structure holding the parameters the folds were fitted with, carried
through from the learner that was cross validated, beside
NLearn , the number of folds, and the Version ,
Method and Type tags of this class. The
learner&rsquo;s own tags are replaced rather than kept, so a cross-validated
SVM reports Method as 'PartitionedModel' and not
'SVM' .

Deviation from MATLAB. MATLAB reports the parameter record of
the cross-validation ensemble here rather than of the learner,
so it says nothing at all about how the folds were fitted: of its
eighteen fields only the fold count, its partitioner and a fit template
carry anything, and the rest are boosting settings left inert. Nor can
the parameters be reached through the folds, a compact model carrying
none in MATLAB. This class reports the fit instead, which is strictly
more than MATLAB offers, and everything MATLAB&rsquo;s record does carry is
published here as the KFold , Partition , X ,
Y , W and CrossValidatedModel properties.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
Model parameters



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
ClassificationPartitionedModel.NumObservations


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 241
ClassificationPartitionedModel: property NumObservations

Number of observations

A positive integer value specifying the number of observations in the
training dataset used for training the cross-validated model.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Number of observations



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
ClassificationPartitionedModel.NumTrainedPerFold


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 728
ClassificationPartitionedModel: property NumTrainedPerFold

How many trees each fold fitted

A scalar structure with fields PredictorTrees and
InteractionTrees , each a row with one entry per fold, for a
generalized additive model backing, and empty for every other.

It reports what each fold actually fitted, which the budget in
ModelParameters does not: a phase stops early when it can no
longer improve the fit, and the folds need not stop at the same place.

MATLAB carries this on its per-learner partitioned GAM classes, which
this package deliberately does not have (see crossval ), so like
IsStandardDeviationFit it is declared here for every backing
and left empty where it does not apply.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
How many trees each fold fitted



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
ClassificationPartitionedModel.Partition


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 307
ClassificationPartitionedModel: property Partition

Partition configuration

A cvpartition object specifying the partition configuration used
for cross-validation. This field stores the cvpartition instance that
describes how the data was split into training and validation sets.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
Partition configuration



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
ClassificationPartitionedModel.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 270
ClassificationPartitionedModel: property PredictorNames

Names of predictor variables

A cell array of character vectors specifying the names of the predictor
variables. The names are in the order in which they appear in the
training dataset. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
Names of predictor variables



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
ClassificationPartitionedModel.Prior


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 669
ClassificationPartitionedModel: property Prior

Prior probability for each class

A numeric vector specifying the prior probabilities for each class. The
order of the elements in Prior corresponds to the order of the
classes in ClassNames .

It may be assigned only on a cross-validated
ClassificationDiscriminant or ClassificationNaiveBayes ,
the two learners that score from the priors they are given rather than
consuming them while they fit: the discriminant re-derives its
coefficients from them and the naive Bayes weights its class densities
by them. Every other learner cannot revisit them afterwards.
Assigning it rebuilds the priors on every fold in Trained .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Prior probability for each class



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
ClassificationPartitionedModel.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 174
ClassificationPartitionedModel: property ResponseName

Response variable name

A character vector specifying the name of the response variable Y .
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Response variable name



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
ClassificationPartitionedModel.ScoreTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 182
ClassificationPartitionedModel: property ScoreTransform

Transformation function for classification scores

Specified as a function handle for transforming the classification
scores.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Transformation function for classification scores



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
ClassificationPartitionedModel.Trained


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 301
ClassificationPartitionedModel: property Trained

Models trained on each fold

A cell array of models trained on each fold. Each cell contains a model
trained on the minus-one fold of the data (all but one fold used for
training and the remaining fold used for validation). This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Models trained on each fold



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
ClassificationPartitionedModel.W


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 202
ClassificationPartitionedModel: property W

Observation weights

A numeric column vector with one entry per observation, carried over
from the model that was cross validated. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
Observation weights



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
ClassificationPartitionedModel.X


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 245
ClassificationPartitionedModel: property X

Predictor data

A numeric matrix containing the unstandardized predictor data. Each
column of X represents one predictor (variable), and each row
represents one observation. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
Predictor data



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
ClassificationPartitionedModel.Y


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 322
ClassificationPartitionedModel: property Y

Class labels

Specified as a logical or numeric column vector, or as a character array
or a cell array of character vectors with the same number of rows as the
predictor data. Each row in Y is the observed class label for
the corresponding row in X . This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
Class labels



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
ClassificationPartitionedModel.kfoldEdge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 898
ClassificationPartitionedModel: e = kfoldEdge ( obj )
ClassificationPartitionedModel: e = kfoldEdge (&hellip;, name , value )

Classification edge of the cross-validated observations.

e = kfoldEdge ( obj ) returns the mean of the
classification margins over every cross-validated observation, which is
the mean of kfoldMargin ( obj ) .

obj must be a ClassificationPartitionedModel object.

e = kfoldEdge (&hellip;, name , value ) accepts
the following Name-Value pairs.

Name Value
'Mode' 'average' , the default, which returns
one number over the observations of every fold asked for, or
'individual' , which returns one number per fold.
'Folds' A vector of fold indices to restrict the
edge to. It defaults to every fold.

The observations of a selection are weighted uniformly and normalized
over that selection, so a subset of folds is an average rather than a
sum, exactly as kfoldLoss does.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 56
Classification edge of the cross-validated observations.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
ClassificationPartitionedModel.kfoldLoss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1073
ClassificationPartitionedModel: L = kfoldLoss ( obj )
ClassificationPartitionedModel: L = kfoldLoss (&hellip;, name , value )

Compute the cross-validated classification loss.

L = kfoldLoss ( obj ) returns the fraction of
observations the folds misclassify, each answered for by the fold&rsquo;s
model that did not see it, which is what kfoldPredict returns.

obj must be a ClassificationPartitionedModel object.

L = kfoldLoss (&hellip;, name , value ) accepts
the following Name-Value pairs.

Name Value
'LossFun' 'classiferror' , the default,
'classifcost' , 'mincost' , or a function handle called
as
lossfun ( C , S , W , Cost ) , where
C is a logical matrix with one true per row marking the true
class, S the scores, W the weights and Cost the
misclassification cost.
'Mode' 'average' , the default, which returns
one number over the observations of every fold asked for, or
'individual' , which returns one number per fold.
'Folds' A vector of fold indices to restrict the
loss to. It defaults to every fold.

See also:
ClassificationPartitionedModel,
kfoldPredict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Compute the cross-validated classification loss.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
ClassificationPartitionedModel.kfoldMargin


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 723
ClassificationPartitionedModel: m = kfoldMargin ( obj )

Classification margins of the cross-validated observations.

m = kfoldMargin ( obj ) returns an Nx1 vector
holding, for every observation, the score its own fold&rsquo;s model gave the
true class less the largest score that model gave any other class. A
larger margin is a more confident correct answer and a negative one is
a misclassification. Every observation is scored by the fold that held
it out, so no model answers for a row it was trained on.

obj must be a ClassificationPartitionedModel object.

Where the fold that held an observation out produced no score for it,
the margin is NaN . This method takes no optional arguments,
as MATLAB&rsquo;s does not.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 59
Classification margins of the cross-validated observations.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
ClassificationPartitionedModel.kfoldPredict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2149
ClassificationPartitionedModel: label = kfoldPredict ( this )
ClassificationPartitionedModel: [ label , score , cost ] = kfoldPredict ( this )

Predict responses for observations not used for training in a
cross-validated classification model.

[label, Score, Cost] = kfoldPredict ( this )
returns the predicted class labels, classification scores, and
classification costs for the data used
to train the cross-validated model this .

this is a ClassificationPartitionedModel object.
The function predicts the response for each observation that was
held out during training in the cross-validation process.

An observation that no fold held out is not predicted at all: its
scores and costs are NaN and its label is missing, an empty
character vector for a cell array of strings and NaN for a
numeric response. Under a 'Holdout' partition that is every
observation outside the holdout set. This differs from
MATLAB , which reports NaN scores for those rows as we do but
labels every one of them with the first class, whatever their
response: that label is the least-cost class of a row of NaN
costs rather than a prediction any model made, and naming a class for
an observation nothing scored would be wrong. A logical response has
no missing value to give, so those rows stay false .

Output Description
label Predicted class labels, returned as a
vector or cell array. The type of label matches the type of
Y in the original training data. Each element of label
corresponds to the predicted class
label for the corresponding row in X .
Score Classification scores, returned as a
numeric matrix. Each row of Score corresponds to an observation,
and each column corresponds to a class. The value in row i and
column j is the
classification score for class j for observation i .
Cost Classification costs, returned as a
numeric matrix. Each row of Cost corresponds to an observation,
and each column corresponds to a class. The value in row i
and column j is the classification cost for class j for
observation i . This output is optional and only returned if
requested.

See also:
ClassificationKNN,
ClassificationSVM,
ClassificationPartitionedModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 99
Predict responses for observations not used for training in a cross-validated classification model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
ClassificationPartitionedModel.kfoldfun


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 806
ClassificationPartitionedModel: vals = kfoldfun ( obj , fun )

Apply a function to each fold of a cross-validated model.

vals = kfoldfun ( obj , fun ) calls fun once
per fold and returns a K&times;M numeric matrix whose row k is
what fun returned for fold k .

fun is a function handle taking seven inputs and returning a
numeric vector of the same length every time it is called:

testvals = fun ( M , Xtrain , Ytrain , Wtrain , &hellip;
Xtest , Ytest , Wtest )

M is the model the fold was fitted with, taken from
obj .Trained{k} ; Xtrain , Ytrain and
Wtrain are the predictors, response and weights of the
observations that fold was trained on, and Xtest , Ytest and
Wtest those of the observations it held out.

See also:
ClassificationPartitionedModel,
kfoldPredict,
kfoldLoss,
kfoldMargin,
kfoldEdge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 57
Apply a function to each fold of a cross-validated model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
ClassificationSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 709
statistics: ClassificationSVM

Support Vector Machine classification

The ClassificationSVM class implements a Support Vector Machine
classifier object for one-class or two-class problems, which can predict
responses for new data using the predict method.

Support Vector Machine classification is a supervised learning method used
for classification tasks. It works by finding the optimal hyperplane that
separates classes in the feature space with the maximum margin. For
non-linearly separable data, it uses kernel functions to map data to a
higher-dimensional space where separation is possible.

Create a ClassificationSVM object by using the fitcsvm
function or the class constructor.

See also:
fitcsvm


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Support Vector Machine classification



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
ClassificationSVM.Alpha


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 468
ClassificationSVM: property Alpha

Trained classifier coefficients

The coefficients of the trained SVM classifier specified as an s&times;1
numeric vector, where s is the number of support vectors equal to
sum (obj.IsSupportVector) . They are the magnitudes of the dual
coefficients and are never negative; the class each belongs to is given
by the corresponding entry of SupportVectorLabels .
Alpha is populated for every kernel function. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Trained classifier coefficients



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
ClassificationSVM.Beta


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 493
ClassificationSVM: property Beta

Linear predictor coefficients

The linear predictor coefficients specified as a p&times;1 numeric
vector, where p is the number of predictors. Beta is
the primal representation of the fitted hyperplane and exists only when
the SVM classifier was trained with a 'linear' kernel function;
for any other kernel there is no such representation and Beta is
empty. It equals
obj.SupportVectors' * (obj.Alpha .* obj.SupportVectorLabels) .
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Linear predictor coefficients



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
ClassificationSVM.Bias


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 109
ClassificationSVM: property Bias

Bias term

The bias term specified as a scalar. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
Bias term



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
ClassificationSVM.BinEdges


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 365
ClassificationSVM: property BinEdges

Bin edges of the predictors

A cell array with one entry per predictor, holding that predictor&rsquo;s bin
edges where the learner discretized it before fitting. It is empty here
and stays empty: this learner fits the predictors as they are, and
MATLAB&rsquo;s reports an empty cell for it as well.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Bin edges of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
ClassificationSVM.BoxConstraints


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 397
ClassificationSVM: property BoxConstraints

Box constraints

A numeric column vector with one entry per observation, holding the
box constraint the fit applied to it. It is BoxConstraint for
every observation unless Prior or Cost reweighted the
classes, in which case each class is scaled by the weight it carried
into the fit, normalized so the weights average to one. This property
is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
Box constraints



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
ClassificationSVM.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 229
ClassificationSVM: property CategoricalPredictors

Indices of the categorical predictors

A numeric vector of column indices into X naming the predictors
treated as categorical, and empty when none is. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
ClassificationSVM.ClassNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 345
ClassificationSVM: property ClassNames

Names of classes in the response variable

An array of unique values of the response variable Y , which has the
same data types as the data in Y . This property is read-only.
ClassNames can have any of the following datatypes:

Cell array of character vectors
Character array
Logical vector
Numeric vector


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Names of classes in the response variable



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
ClassificationSVM.ClassificationSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3078
statistics: obj = ClassificationSVM ( X , Y )
statistics: obj = ClassificationSVM (&hellip;, name , value )

Create a ClassificationSVM class object containing a Support
Vector Machine classification model for one-class or two-class problems.

obj = ClassificationSVM ( X , Y ) returns a
ClassificationSVM object, with X as the predictor data and Y
containing the class labels of observations in X .

X must be a N&times;P numeric matrix of input data where rows
correspond to observations and columns correspond to features or
variables. X will be used to train the SVM model.

Y is N&times;1 matrix or cell matrix containing the class labels
of corresponding predictor data in X . Y can be either
numeric, logical, or cell array of character vectors. It must have same
numbers of rows as X .

obj = ClassificationSVM (&hellip;, name , value )
returns a ClassificationSVM object with parameters specified by the
following name , value paired input arguments:

Name Value
'PredictorNames' A cell array of character
vectors specifying the names of the predictors. The length of this array
must match the number of columns in X .
'ResponseName' A character vector specifying the
name of the response variable.
'ClassNames' Names of the classes in the class
labels, Y , used for fitting the SVM model. ClassNames are
of the same type as the class labels in Y .
'ScoreTransform' A user-defined function handle
or a character vector specifying one of the following builtin functions
specifying the transformation applied to predicted classification scores.
Supported values include 'doublelogit' , 'invlogit' ,
'ismax' , 'logit' , 'none' , 'identity' ,
'sign' , 'symmetric' , 'symmetricismax' , and
'symmetriclogit' .
'Standardize' A logical scalar specifying whether
to standardize the predictor variables. Default is false .
'SVMtype' A character vector specifying the type
of SVM to use. Supported values are 'c_svc' (C-support vector
classification), 'nu_svc' (nu-support vector classification), and
'one_class_svm' (one-class SVM).
'KernelFunction' A character vector specifying
the kernel function to use. Supported values are 'linear' ,
'rbf' or 'gaussian' , 'polynomial' , and
'sigmoid' .
'PolynomialOrder' A positive integer specifying
the order of the polynomial kernel function. Default is 3.
'KernelScale' A positive scalar specifying the
kernel scale parameter. Default is 1.
'KernelOffset' A non-negative scalar specifying
the kernel offset parameter. Default is 0.
'BoxConstraint' A positive scalar specifying the
box constraint parameter. Default is 1.
'Nu' A positive scalar in the range (0,1]
specifying the nu parameter for nu-SVM and one-class SVM. Default is 0.5.
'CacheSize' A positive scalar specifying the
cache size in MB. Default is 1000.
'Tolerance' A positive scalar specifying the
tolerance of termination criterion. Default is 1e-6.
'Shrinking' Either 0 or 1 specifying whether to
use the shrinking heuristics. Default is 1.
'OutlierFraction' A positive scalar in the range
[0,1) specifying the fraction of outliers for one-class SVM.

See also:
fitcsvm


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 133
Create a ClassificationSVM class object containing a Support Vector Machine classification model for one-class or two-class problems.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
ClassificationSVM.Cost


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 250
ClassificationSVM: property Cost

Cost of misclassification

A numeric square matrix, where Cost(i,j) is the cost of
classifying an observation of class i as class j . It
defaults to zero on the diagonal and one elsewhere. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
Cost of misclassification



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
ClassificationSVM.ExpandedPredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 262
ClassificationSVM: property ExpandedPredictorNames

Names of the predictors as the model expanded them

A cell array of character vectors. It matches PredictorNames
unless a categorical predictor was expanded into indicator variables.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
Names of the predictors as the model expanded them



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51
ClassificationSVM.HyperparameterOptimizationResults


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 360
ClassificationSVM: property HyperparameterOptimizationResults

Results of the hyperparameter optimization

Always empty. It is declared for MATLAB compatibility, where
it holds what an automatic search over the hyperparameters found. This
class fits the parameters it is given and runs no such search, so there
is nothing to report. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Results of the hyperparameter optimization



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
ClassificationSVM.IsSupportVector


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 277
ClassificationSVM: property IsSupportVector

Support vector indicator

An N&times;1 logical vector that flags whether a corresponding
observation in the predictor data matrix is a Support Vector. N
is the number of observations in the training data. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
Support vector indicator



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
ClassificationSVM.KernelParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 372
ClassificationSVM: property KernelParameters

Parameters of the kernel function

A structure with fields Function and Scale , and
Order for a polynomial kernel. Function names the
kernel as MATLAB names it, so a radial basis kernel reports
'gaussian' whichever spelling was given; the kernel the fit was
handed is unchanged in ModelParameters . This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
Parameters of the kernel function



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
ClassificationSVM.ModelParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 734
ClassificationSVM: property ModelParameters

SVM training parameters

A structure holding the parameters the fit was given. The engine is
LIBSVM and the record is LIBSVM&rsquo;s, so SVMtype names its
formulation and Tolerance and Shrinking are its own
controls; the parameters MathWorks reports for its SMO and ISDA
solvers are absent, this class running neither.

KernelPolynomialOrder belongs to the polynomial kernel alone
and is empty under every other, as it is in MATLAB.

A structure containing the parameters used to train the SVM model with
the following fields: SVMtype , BoxConstraint ,
CacheSize , KernelScale , KernelOffset ,
KernelFunction , PolynomialOrder , Nu ,
Tolerance , and Shrinking . This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
SVM training parameters



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
ClassificationSVM.Mu


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 439
ClassificationSVM: property Mu

Predictor means

A numeric vector of the same length as the columns in X containing
the means of predictor variables. If the predictor variables have not
been standardized, then Mu is empty. This property is read-only.

Only observations with no missing predictor enter the estimate, and
they are weighted so that each class keeps the share of the
observation weight it carried before any row was set aside.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
Predictor means



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
ClassificationSVM.Nu


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 196
ClassificationSVM: property Nu

Nu parameter for one-class learning

A positive scalar, and empty unless the model is a one-class learner,
which is what MATLAB reports. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
Nu parameter for one-class learning



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
ClassificationSVM.NumObservations


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 230
ClassificationSVM: property NumObservations

Number of observations

A positive integer value specifying the number of observations in the
training dataset used for training the ClassificationSVM model.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Number of observations



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
ClassificationSVM.NumPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 224
ClassificationSVM: property NumPredictors

Number of predictors

A positive integer value specifying the number of predictors in the
training dataset used for training the ClassificationSVM model.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Number of predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
ClassificationSVM.OutlierFraction


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 539
ClassificationSVM: property OutlierFraction

Expected fraction of outliers in the training data

A scalar in [0, 1) , zero unless one was asked for.

Deviation from MATLAB. The value is reported as it was given,
but it reaches the fit by a different route: MATLAB removes outliers
iteratively and reports Solver as 'ISDA' , where a
nonzero fraction here selects LIBSVM&rsquo;s \nu -SVC, in which
\nu bounds the fraction of margin errors. The two agree on what
the number means and not on how the fit reaches it. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
Expected fraction of outliers in the training data



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
ClassificationSVM.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 257
ClassificationSVM: property PredictorNames

Names of predictor variables

A cell array of character vectors specifying the names of the predictor
variables. The names are in the order in which they appear in the
training dataset. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
Names of predictor variables



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
ClassificationSVM.Prior


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 546
ClassificationSVM: property Prior

Prior probabilities of the classes

A numeric row vector with one entry per class, in the order of
ClassNames , summing to one. It defaults to the class
frequencies of the training data. This property is read-only.

Specified as a row vector with one entry per class, in the order of
ClassNames , and rescaled to sum to one. It may be given as
'empirical' , 'uniform' , a numeric vector, or a
structure with ClassNames and ClassProbs fields, which
assigns each probability by class name rather than by position.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
Prior probabilities of the classes



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
ClassificationSVM.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 161
ClassificationSVM: property ResponseName

Response variable name

A character vector specifying the name of the response variable Y .
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Response variable name



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
ClassificationSVM.RowsUsed


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 386
ClassificationSVM: property RowsUsed

Rows used for fitting

A logical column vector with the same length as the observations in the
original predictor data X , true for each row that was used for
fitting the ClassificationSVM model. It is empty, [] ,
when every observation was used, so a non-empty value means that rows
holding missing values were dropped. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
Rows used for fitting



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
ClassificationSVM.ScoreTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 997
ClassificationSVM: property ScoreTransform

Transformation function for classification scores

Specified as a function handle for transforming the classification
scores. Add or change the ScoreTransform property using dot
notation as in:

obj .ScoreTransform = 'function_name'
obj .ScoreTransform = @function_handle

When specified as a character vector, it can be any of the following
built-in functions. Nevertheless, the ScoreTransform property
always stores their function handle equivalent.

Value Description
'doublelogit' 1 ./ (1 + exp (-2 &times; x))
'invlogit' log (x ./ (1 - x))
'ismax' Sets the score for the class with the
largest score to 1, and for all other classes to 0
'logit' 1 ./ (1 + exp (-x))
'none' x (no transformation)
'identity' x (no transformation)
'sign' -1 for x < 0, 0 for x = 0, 1 for x >
0
'symmetric' 2 &times; x - 1
'symmetricismax' Sets the score for the class
with the largest score to 1, and for all other classes to -1
'symmetriclogit' 2 ./ (1 + exp (-x)) - 1


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Transformation function for classification scores



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
ClassificationSVM.Sigma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 473
ClassificationSVM: property Sigma

Predictor standard deviations

A numeric vector of the same length as the columns in X containing
the standard deviations of predictor variables. If the predictor
variables have not been standardized, then Sigma is empty.
This property is read-only.

Only observations with no missing predictor enter the estimate, and
they are weighted so that each class keeps the share of the
observation weight it carried before any row was set aside.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Predictor standard deviations



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
ClassificationSVM.SupportVectorLabels


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 500
ClassificationSVM: property SupportVectorLabels

Support vector class labels

The support vector class labels specified as an s&times;1 numeric
vector, where s is the number of support vectors equal to
sum (obj.IsSupportVector) . A value of +1 in
SupportVectorLabels indicates that the corresponding support
vector
belongs to the positive class (ClassNames{2}) . A value of -1
indicates that the corresponding support vector belongs to the negative
class (ClassNames{1}) . This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Support vector class labels



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
ClassificationSVM.SupportVectors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 321
ClassificationSVM: property SupportVectors

Support vectors

The support vectors of the trained SVM classifier specified an s&times;p
numeric matrix, where s is the number of support vectors equal to
sum (obj.IsSupportVector) , and p is the number of
predictor
variables in the predictor data. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
Support vectors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
ClassificationSVM.W


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 368
ClassificationSVM: property W

Observation weights

A numeric column vector with one entry per training observation,
normalized to sum to one, as MATLAB reports it. This property is
read-only.

Each class carries its prior spread evenly over its own observations,
so an observation of a class weighs Prior for that class
divided by the number of observations it holds.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
Observation weights



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
ClassificationSVM.X


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 232
ClassificationSVM: property X

Predictor data

A numeric matrix containing the unstandardized predictor data. Each
column of X represents one predictor (variable), and each row
represents one observation. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
Predictor data



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
ClassificationSVM.Y


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 309
ClassificationSVM: property Y

Class labels

Specified as a logical or numeric column vector, or as a character array
or a cell array of character vectors with the same number of rows as the
predictor data. Each row in Y is the observed class label for
the corresponding row in X . This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
Class labels



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
ClassificationSVM.compact


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 239
ClassificationSVM: CVMdl = compact ( obj )

Create a CompactClassificationSVM object.

CVMdl = compact ( obj ) creates a compact version of the
ClassificationSVM object, obj .

See also:
fitcsvm,
ClassificationSVM,
CompactClassificationSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Create a CompactClassificationSVM object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
ClassificationSVM.crossval


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1057
ClassificationSVM: CVMdl = crossval ( obj )
ClassificationSVM: CVMdl = crossval (&hellip;, name , value )

Cross Validate a Support Vector Machine classification object.

CVMdl = crossval ( obj ) returns a cross-validated model
object, CVMdl , from a trained model, obj , using 10-fold
cross-validation by default.

CVMdl = crossval ( obj , name , value )
specifies additional name-value pair arguments to customize the
cross-validation process.

Name Value
'KFold' Specify the number of folds to use in
k-fold cross-validation. "KFold", k , where k is an
integer greater than 1.
'Holdout' Specify the fraction of the data to
hold out for testing. "Holdout", p , where p is a
scalar in the range (0,1) .
'Leaveout' Specify whether to perform
leave-one-out cross-validation. "Leaveout", Value , where
Value is &rsquo;on&rsquo; or &rsquo;off&rsquo;.
'CVPartition' Specify a cvpartition
object used for cross-validation. "CVPartition", cv , where
isa ( cv , "cvpartition") = 1.

See also:
fitcsvm,
ClassificationSVM,
cvpartition,
ClassificationPartitionedModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 62
Cross Validate a Support Vector Machine classification object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
ClassificationSVM.discardSupportVectors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 625
ClassificationSVM: obj = discardSupportVectors ( obj )

Discard the support vectors of a linear SVM model.

obj = discardSupportVectors ( obj ) empties
Alpha , SupportVectors and
SupportVectorLabels , leaving Beta and Bias to
decide every prediction. A linear kernel needs nothing else, so the
returned model predicts what it predicted before while carrying one
vector in place of many.

The kernel must be linear. Under any other the support vectors are
part of the decision function and cannot be dropped. Discarding twice
is not an error and changes nothing.

See also:
fitcsvm,
ClassificationSVM,
CompactClassificationSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
Discard the support vectors of a linear SVM model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
ClassificationSVM.edge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 599
ClassificationSVM: e = edge ( obj , X , Y )
ClassificationSVM: e = edge (&hellip;, "Weights" , w )

Classification edge, the mean of the classification margins.

e = edge ( obj , X , Y ) reduces the vector
that margin returns to a single number, the mean margin over the
rows of X . It says how far the model puts the true class ahead of
its nearest rival on average, so a larger edge is a better model, and
unlike a loss it is not bounded above and rewards confidence rather than
bare correctness.

e = edge (&hellip;, "Weights" , w ) takes the
weighted mean instead, with one weight per row of X .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 60
Classification edge, the mean of the classification margins.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
ClassificationSVM.loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1890
ClassificationSVM: L = loss ( obj , X , Y )
ClassificationSVM: L = loss (&hellip;, name , value )

Compute loss for a trained ClassificationSVM object.

L = loss ( obj , X , Y ) computes the loss,
L , using the default loss function 'classiferror' .

obj is a ClassificationSVM object trained on
X and Y .

X must be a N&times;P numeric matrix of input data where rows
correspond to observations and columns correspond to features or
variables.

Y is N&times;1 matrix or cell matrix containing the class labels
of corresponding predictor data in X . Y must have same
numbers of Rows as X .

L = loss (&hellip;, name , value ) allows
additional options specified by name - value pairs:

Name Value
'LossFun' Specifies the loss function to use.
Can be a function handle with four input arguments (C, S, W, Cost)
which returns a scalar value or one of:
&rsquo;binodeviance&rsquo;, &rsquo;classifcost&rsquo;, &rsquo;classiferror&rsquo;, &rsquo;exponential&rsquo;,
&rsquo;hinge&rsquo;, &rsquo;logit&rsquo;,&rsquo;mincost&rsquo;, &rsquo;quadratic&rsquo;.

C is a logical matrix of size N&times;K , where N is the
number of observations and K is the number of classes.
The element C(i,j) is true if the class label of the i-th
observation is equal to the j-th class.

S is a numeric matrix of size N&times;K , where each element
represents the classification score for the corresponding class.

W is a numeric vector of length N , representing
the observation weights.

Cost is a K&times;K matrix representing the misclassification
costs.

'Weights' Specifies observation weights, must be
a numeric vector of length equal to the number of rows in X.
Default is ones (size (X, 1)) . loss normalizes the weights so that
observation weights in each class sum to the prior probability of that
class. When you supply Weights, loss computes the weighted
classification loss.

See also:
ClassificationSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 52
Compute loss for a trained ClassificationSVM object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
ClassificationSVM.margin


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 814
ClassificationSVM: m = margin ( obj , X , Y )

Classification margins for Support Vector Machine classifier.

m = margin ( obj , X , Y ) returns
the classification margins for obj with data X and
classification Y . m is a numeric vector of length size (X,1).

obj is a ClassificationSVM object trained on X
and Y .

X must be a N&times;P numeric matrix of input data where rows
correspond to observations and columns correspond to features or
variables.

Y is N&times;1 matrix or cell matrix containing the class labels
of corresponding predictor data in X . Y must have same
numbers of Rows as X .

The classification margin for each observation is the difference between
the classification score for the true class and the maximal
classification score for the false classes.

See also:
fitcsvm,
ClassificationSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 61
Classification margins for Support Vector Machine classifier.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
ClassificationSVM.predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1698
ClassificationSVM: label = predict ( obj , XC )
ClassificationSVM: [ label , score ] = predict ( obj , XC )
ClassificationSVM: [ label , score , cost ] = predict ( obj , XC )

Classify new data points into categories using the Support Vector Machine
classification model from a ClassificationSVM object.

label = predict ( obj , XC ) returns the vector of
labels predicted for the corresponding instances in XC , using the
predictor data in obj.X and corresponding labels, obj.Y ,
stored in the ClassificationSVM model, obj . For one-class SVM
model, +1 or -1 is returned.

obj must be a ClassificationSVM class object.

XC must be an M&times;P numeric matrix with the same number of
features P as the corresponding predictors of the SVM model in
obj .

[ label , score ] = predict ( obj , XC ) also
returns score , which contains the decision values for each
prediction. A ScoreTransform assigned to obj is applied
to them, so score holds whatever that transform returns. Posterior
probabilities need a transform fitted to the model, which this package
does not compute yet.

Deviation from MATLAB. cost is the expected cost of
each assignment, sum_j P(j) Cost(j,k) . An SVM score is a
signed distance to the boundary and not a posterior, so the only
distribution available is the one concentrated on the predicted class
and cost is the row of Cost belonging to it. MATLAB
returns the column instead, which is the same matrix read the
wrong way and contradicts its own ClassificationKNN ,
ClassificationDiscriminant and ClassificationNaiveBayes
on any asymmetric cost matrix; the two agree wherever Cost is
symmetric, the default included. Measured on R2024a.

See also:
ClassificationSVM,
fitcsvm


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 127
Classify new data points into categories using the Support Vector Machine classification model from a ClassificationSVM object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
ClassificationSVM.resubEdge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 210
ClassificationSVM: e = resubEdge ( obj )

Classification edge of the model on its own training data.

e = resubEdge ( obj ) is edge applied to the
observations the model was fitted on, the mean of resubMargin .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 58
Classification edge of the model on its own training data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
ClassificationSVM.resubLoss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1640
ClassificationSVM: L = resubLoss ( obj )
ClassificationSVM: L = resubLoss (&hellip;, name , value )

Compute resubstitution loss for a trained ClassificationSVM object.

L = resubLoss ( obj ) computes the resubstitution loss,
L , using the default loss function 'classiferror' .

obj is a ClassificationSVM object trained on
X and Y .

L = resubLoss (&hellip;, name , value ) allows
additional options specified by name - value pairs:

Name Value
'LossFun' Specifies the loss function to use.
Can be a function handle with four input arguments (C, S, W, Cost)
which returns a scalar value or one of:
&rsquo;binodeviance&rsquo;, &rsquo;classifcost&rsquo;, &rsquo;classiferror&rsquo;, &rsquo;exponential&rsquo;,
&rsquo;hinge&rsquo;, &rsquo;logit&rsquo;,&rsquo;mincost&rsquo;, &rsquo;quadratic&rsquo;.

C is a logical matrix of size N&times;K , where N is the
number of observations and K is the number of classes.
The element C(i,j) is true if the class label of the i-th
observation is equal to the j-th class.

S is a numeric matrix of size N&times;K , where each element
represents the classification score for the corresponding class.

W is a numeric vector of length N , representing
the observation weights.

Cost is a K&times;K matrix representing the misclassification
costs.

'Weights' Specifies observation weights, must be
a numeric vector of length equal to the number of rows in X.
Default is ones (size (X, 1)) . loss normalizes the weights so that
observation weights in each class sum to the prior probability of that
class. When you supply Weights, loss computes the weighted
classification loss.

See also:
ClassificationSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 67
Compute resubstitution loss for a trained ClassificationSVM object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
ClassificationSVM.resubMargin


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 287
ClassificationSVM: m = resubMargin ( obj )

Classification margins of the model on its own training data.

m = resubMargin ( obj ) is margin applied to the
observations the model was fitted on, one number per observation. Being
a resubstitution quantity it is optimistic by construction.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 61
Classification margins of the model on its own training data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
ClassificationSVM.resubPredict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1540
ClassificationSVM: label = resubPredict ( obj )
ClassificationSVM: [ label , score ] = resubPredict ( obj )
ClassificationSVM: [ label , score , cost ] = resubPredict ( obj )

Classify the training data using the trained Support Vector Machine
classification object.

label = resubPredict ( obj ) returns the vector of
labels predicted for the corresponding instances in the training data,
using the predictor data in obj.X and corresponding labels,
obj.Y , stored in the Support Vector Machine classification model,
obj . For one-class model, +1 or -1 is returned.

obj must be a ClassificationSVM class object.

[ label , scores ] = resubPredict ( obj also
returns scores , which contains the decision values for each
prediction. A ScoreTransform assigned to obj is applied
to them, so scores holds whatever that transform returns. Posterior
probabilities need a transform fitted to the model, which this package
does not compute yet.

Deviation from MATLAB. cost is the expected cost of
each assignment, sum_j P(j) Cost(j,k) . An SVM score is a
signed distance to the boundary and not a posterior, so the only
distribution available is the one concentrated on the predicted class
and cost is the row of Cost belonging to it. MATLAB
returns the column instead, which is the same matrix read the
wrong way and contradicts its own ClassificationKNN ,
ClassificationDiscriminant and ClassificationNaiveBayes
on any asymmetric cost matrix; the two agree wherever Cost is
symmetric, the default included. Measured on R2024a.

See also:
fitcsvm


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 90
Classify the training data using the trained Support Vector Machine classification object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
ClassificationSVM.savemodel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 472
ClassificationSVM: savemodel ( obj , filename )

Save a ClassificationSVM object.

savemodel ( obj , filename ) saves each property of a
ClassificationSVM object into an Octave binary file, the name of which is
specified in filename , along with an extra variable, which defines
the type classification object these variables constitute. Use
loadmodel in order to load a classification object into Octave&rsquo;s
workspace.

See also:
loadmodel,
fitcsvm,
ClassificationSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Save a ClassificationSVM object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
CompactClassificationDiscriminant


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1664
statistics: CompactClassificationDiscriminant

Compact discriminant analysis classification

The CompactClassificationDiscriminant class implements a compact
version of a linear discriminant analysis classifier object, which can
predict responses for new data using the predict method but does not
store the training data.

A CompactClassificationDiscriminant object is a compact version of a
discriminant analysis model, ClassificationDiscriminant . It does
not include the training data resulting in a smaller classifier size, which
can be used for making predictions from new data, but not for tasks such as
cross validation. It can only be created from a
ClassificationDiscriminant model by using the compact object
method.

Create a CompactClassificationDiscriminant object by using the
compact method of a ClassificationDiscriminant object.

Six discriminant types are available, in two families. The linear family,
'linear' , 'diagLinear' and 'pseudoLinear' , pools
one covariance across the classes and separates them with a hyperplane.
The quadratic family, 'quadratic' , 'diagQuadratic' and
'pseudoQuadratic' , estimates a covariance per class and separates
them with a quadric. A 'diag' type keeps only the variances,
which is the same model as a Gamma of 1, and a 'pseudo'
type inverts a singular covariance rather than refusing it.

DiscrimType may be assigned after fitting, but only within
its own family : the family is fixed when the model is fitted, because it
decides which covariances the fit has to estimate. Assigning it, or
Gamma , re-derives Sigma , LogDetSigma and
Coeffs without refitting.

See also:
fitcdiscr,
ClassificationDiscriminant


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 44
Compact discriminant analysis classification



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
CompactClassificationDiscriminant.BetweenSigma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 757
CompactClassificationDiscriminant: property BetweenSigma

Between-class covariance matrix

A P -by- P matrix holding the covariance of the class means
about the overall mean, weighted by how many observations each class
contributes. With n_k observations in class k ,
p_k = n_k / n and \bar{\mu} = \sum_k p_k \mu_k , it is

BetweenSigma = sum_k n_k (Mu(k,:) - mubar)' * (Mu(k,:) - mubar)
/ (n * (1 - sum_k p_k^2))

The denominator is the unbiased one for a weighted covariance, so a
balanced fit divides by n (K-1) / K . It reads the class
sizes , not Prior : assigning a prior leaves it where it was. It
is estimated for every discriminant type, the quadratic family included,
since it describes the classes rather than the fit. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Between-class covariance matrix



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 55
CompactClassificationDiscriminant.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 245
CompactClassificationDiscriminant: property CategoricalPredictors

Indices of the categorical predictors

A numeric vector of column indices into X naming the predictors
treated as categorical, and empty when none is. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 44
CompactClassificationDiscriminant.ClassNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 361
CompactClassificationDiscriminant: property ClassNames

Names of classes in the response variable

An array of unique values of the response variable Y , which has the
same data types as the data in Y . This property is read-only.
ClassNames can have any of the following datatypes:

Cell array of character vectors
Character array
Logical vector
Numeric vector


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Names of classes in the response variable



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
CompactClassificationDiscriminant.Coeffs


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 849
CompactClassificationDiscriminant: property Coeffs

Coefficient matrices

A K&times;K structure containing the coefficient matrices, where
K is the number of classes. If the 'FillCoeffs' parameter
was set to 'off' in the original
ClassificationDiscriminant model, then Coeffs is empty
([]) . This property is read-only.

Coeffs(i,j) contains the coefficients of the boundary between
the classes i and j in the following fields:

DiscrimType - A character vector
Class1 - ClassNames (i)
Class2 - ClassNames (j)
Const - A scalar
Linear - A vector with length as the number of predictors.
Quadratic - The quadratic family only. A PxP
matrix, or a 1xP vector for 'diagQuadratic' , following
the shape of Sigma .

The diagonal entries carry the two class names and nothing else. The
structure is rebuilt whenever DiscrimType , Gamma or
Prior is assigned.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Coefficient matrices



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 67
CompactClassificationDiscriminant.CompactClassificationDiscriminant


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 483
CompactClassificationDiscriminant: obj = CompactClassificationDiscriminant ( Mdl )
CompactClassificationDiscriminant: obj = CompactClassificationDiscriminant ()

Create a CompactClassificationDiscriminant object.

Mdl is the ClassificationDiscriminant object to
compact. The documented way to reach this constructor is the
compact method.

Called with no arguments it returns an object with its properties
empty, which is how a saved model is rebuilt before its values are
filled in.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
Create a CompactClassificationDiscriminant object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
CompactClassificationDiscriminant.Cost


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1158
CompactClassificationDiscriminant: property Cost

Cost of Misclassification

A square matrix specifying the cost of misclassification of a point.
Cost(i,j) is the cost of classifying a point into class j
if its true class is i (that is, the rows correspond to the true
class and the columns correspond to the predicted class). The order of
the rows and columns in Cost corresponds to the order of the
classes in ClassNames . The number of rows and columns in
Cost is the number of unique classes in the response. By
default, Cost(i,j) = 1 if i != j , and
Cost(i,j) = 0 if i = j . In other words, the cost is 0
for correct classification and 1 for incorrect classification.

This property is read-only.

A cost may also be given as a struct with the fields
ClassNames and ClassificationCosts , which names the
order its own matrix is written in. That matrix is permuted into the
order of ClassNames above, so a caller need not know which
order the classes were sorted into. It must name every class.

A cost must be floating point, not sparse, not complex, non-negative
and zero down its diagonal, and must hold no NaN or
Inf . A single is widened to double .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
Cost of Misclassification



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
CompactClassificationDiscriminant.Delta


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 816
CompactClassificationDiscriminant: property Delta

Delta threshold for the linear coefficients

A nonnegative scalar that eliminates predictors. A per-class linear
coefficient is set to zero when it falls below Delta , and the
comparison is made on the standardized coefficient, the
coefficient times the within-class standard deviation of its predictor.
Scaling matters here: a threshold on the raw coefficients would depend
on the units each predictor is measured in, so the same model in
centimetres and in metres would drop different predictors.

DeltaPredictor reports, per predictor, the value at which it
drops out of every class at once.

It applies to the linear family only, a quadratic discriminant having no
linear coefficients to eliminate. Assigning it rebuilds Coeffs
and changes what predict answers.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
Delta threshold for the linear coefficients



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
CompactClassificationDiscriminant.DeltaPredictor


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 489
CompactClassificationDiscriminant: property DeltaPredictor

Minimum Delta at which each predictor drops out

A row vector with one entry per predictor, the value of Delta at
which that predictor&rsquo;s coefficient is zero for every class and the
predictor leaves the model altogether. It is all zeros for the
quadratic family, which has no linear coefficients to eliminate.

This property is read-only, and it describes the fit rather than the
threshold: assigning Delta does not move it.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
Minimum Delta at which each predictor drops out



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
CompactClassificationDiscriminant.DiscrimType


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 803
CompactClassificationDiscriminant: property DiscrimType

Discriminant type

A character vector naming the discriminant model, one of
'linear' , 'quadratic' , 'diagLinear' ,
'diagQuadratic' , 'pseudoLinear' or
'pseudoQuadratic' . A linear type pools one covariance across
the classes; a quadratic type estimates one per class. A
'diag' type keeps only the variances, and a 'pseudo'
type inverts a singular covariance instead of refusing it.

This property may be assigned, but only within its own family :
the three linear types interchange freely and so do the three quadratic
ones, while no assignment moves a model between the two. The family is
fixed when the model is fitted, because it decides which covariances the
fit has to estimate. Assigning re-derives Sigma ,
LogDetSigma , Gamma and Coeffs .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
Discriminant type



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 56
CompactClassificationDiscriminant.ExpandedPredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 278
CompactClassificationDiscriminant: property ExpandedPredictorNames

Names of the predictors as the model expanded them

A cell array of character vectors. It matches PredictorNames
unless a categorical predictor was expanded into indicator variables.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
Names of the predictors as the model expanded them



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
CompactClassificationDiscriminant.Gamma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 520
CompactClassificationDiscriminant: property Gamma

Gamma regularization parameter

A scalar from 0 to 1 shrinking the covariance towards its diagonal.
Gamma and DiscrimType are one state: a value of 1 is the
diagonal type, so assigning it renames DiscrimType to
'diagLinear' or 'diagQuadratic' , and assigning a
diagonal type sets Gamma to 1.

The quadratic family admits 0 and 1 only. A value below
MinGamma is refused, since it would leave the covariance
singular. Assigning re-derives Sigma , LogDetSigma and
Coeffs .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
Gamma regularization parameter



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
CompactClassificationDiscriminant.LogDetSigma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 625
CompactClassificationDiscriminant: property LogDetSigma

Logarithm of the determinant of the within-class covariance matrix

A scalar for the linear family and a Kx1 vector for the quadratic
one, one entry per class. It is computed in correlation space, as the
sum of the logarithms of the predictor variances plus the log
determinant of the correlation matrix, which is far better conditioned
than the covariance when the data are nearly collinear. A predictor
with no variance contributes nothing rather than an infinity, and the
'pseudo' types sum only over the directions that carry variance.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 66
Logarithm of the determinant of the within-class covariance matrix



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
CompactClassificationDiscriminant.MinGamma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 451
CompactClassificationDiscriminant: property MinGamma

Minimum value for the Gamma regularization parameter

A scalar from 0 to 1, the least regularization that leaves the
correlation matrix invertible. It is 0 when the matrix is already
invertible, and positive when the predictors are collinear, in which
case a plain 'linear' or 'quadratic' fit is raised to it
rather than failing. Assigning a Gamma below it is refused.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 52
Minimum value for the Gamma regularization parameter



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
CompactClassificationDiscriminant.Mu


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 272
CompactClassificationDiscriminant: property Mu

Class means

A K&times;P numeric matrix specifying the mean of the multivariate
normal distribution of each corresponding class, where K is the
number of classes and P is the number of predictors. This property
is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
Class means



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
CompactClassificationDiscriminant.NumPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 256
CompactClassificationDiscriminant: property NumPredictors

Number of predictors

A positive integer value specifying the number of predictors in the
training dataset used for training the CompactClassificationDiscriminant
model. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Number of predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
CompactClassificationDiscriminant.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 273
CompactClassificationDiscriminant: property PredictorNames

Names of predictor variables

A cell array of character vectors specifying the names of the predictor
variables. The names are in the order in which they appear in the
training dataset. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
Names of predictor variables



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
CompactClassificationDiscriminant.Prior


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 569
CompactClassificationDiscriminant: property Prior

Prior probability for each class

A numeric vector specifying the prior probabilities for each class. The
order of the elements in Prior corresponds to the order of the
classes in ClassNames .

This property is read-only.

Specified as a row vector with one entry per class, in the order of
ClassNames , and rescaled to sum to one. It may be given as
'empirical' , 'uniform' , a numeric vector, or a
structure with ClassNames and ClassProbs fields, which
assigns each probability by class name rather than by position.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Prior probability for each class



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
CompactClassificationDiscriminant.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 177
CompactClassificationDiscriminant: property ResponseName

Response variable name

A character vector specifying the name of the response variable Y .
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Response variable name



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
CompactClassificationDiscriminant.ScoreTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 895
CompactClassificationDiscriminant: property ScoreTransform

Transformation function for classification scores

Specified as a function handle for transforming the classification
scores. This property is read-only.

When specified as a character vector, it can be any of the following
built-in functions. Nevertheless, the ScoreTransform property
always stores their function handle equivalent.

Value Description
'doublelogit' 1 ./ (1 + exp (-2 &times; x))
'invlogit' log (x ./ (1 - x))
'ismax' Sets the score for the class with the
largest score to 1, and for all other classes to 0
'logit' 1 ./ (1 + exp (-x))
'none' x (no transformation)
'identity' x (no transformation)
'sign' -1 for x < 0, 0 for x = 0, 1 for x >
0
'symmetric' 2 &times; x - 1
'symmetricismax' Sets the score for the class
with the largest score to 1, and for all other classes to -1
'symmetriclogit' 2 ./ (1 + exp (-x)) - 1


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Transformation function for classification scores



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
CompactClassificationDiscriminant.Sigma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 519
CompactClassificationDiscriminant: property Sigma

Within-class covariance

A numeric array whose shape follows DiscrimType , with P
predictors and K classes:

DiscrimType Sigma LogDetSigma
'linear' , 'pseudoLinear' PxP
scalar
'quadratic' , 'pseudoQuadratic' PxPxK
Kx1
'diagLinear' 1xP scalar
'diagQuadratic' 1xPxK Kx1

The linear family pools one covariance across the classes and the
quadratic family estimates one per class. This property is read-only,
but it is re-derived whenever DiscrimType or Gamma is
assigned.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
Within-class covariance



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
CompactClassificationDiscriminant.edge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 631
CompactClassificationDiscriminant: e = edge ( obj , X , Y )
CompactClassificationDiscriminant: e = edge (&hellip;, "Weights" , w )

Classification edge, the mean of the classification margins.

e = edge ( obj , X , Y ) reduces the vector
that margin returns to a single number, the mean margin over the
rows of X . It says how far the model puts the true class ahead of
its nearest rival on average, so a larger edge is a better model, and
unlike a loss it is not bounded above and rewards confidence rather than
bare correctness.

e = edge (&hellip;, "Weights" , w ) takes the
weighted mean instead, with one weight per row of X .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 60
Classification edge, the mean of the classification margins.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
CompactClassificationDiscriminant.logp


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 704
CompactClassificationDiscriminant: lp = logp ( obj , X )

Log unconditional probability density of the observations.

lp = logp ( obj , X ) returns an Nx1
vector holding, for each row of X , the natural logarithm of
P(x) = sum_k P(k) P(x|k) , the density of the observation summed
over the classes with each class weighted by its prior P(k) .
Each P(x|k) is the multivariate normal density of class
k .

obj must be a CompactClassificationDiscriminant object.

X must be an NxP numeric matrix with one column per
predictor of the trained model.

An unusually low value marks an observation the model finds unlikely
under every class, which is what makes this an outlier test rather
than a classification.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 58
Log unconditional probability density of the observations.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
CompactClassificationDiscriminant.loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1945
CompactClassificationDiscriminant: L = loss ( obj , X , Y )
CompactClassificationDiscriminant: L = loss (&hellip;, name , value )

Compute loss for a trained CompactClassificationDiscriminant object.

L = loss ( obj , X , Y ) computes the loss,
L , using the default loss function 'mincost' .

obj is a CompactClassificationDiscriminant object.

X must be a N&times;P numeric matrix of input data where rows
correspond to observations and columns correspond to features or
variables.

Y is N&times;1 matrix or cell matrix containing the class labels
of corresponding predictor data in X . Y must have same
numbers of rows as X .

L = loss (&hellip;, name , value ) allows
additional options specified by name - value pairs:

Name Value
'LossFun' Specifies the loss function to use.
Can be a function handle with four input arguments (C, S, W, Cost)
which returns a scalar value or one of:
&rsquo;binodeviance&rsquo;, &rsquo;classifcost&rsquo;, &rsquo;classiferror&rsquo;, &rsquo;exponential&rsquo;,
&rsquo;hinge&rsquo;, &rsquo;logit&rsquo;,&rsquo;mincost&rsquo;, &rsquo;quadratic&rsquo;.

C is a logical matrix of size N&times;K , where N is the
number of observations and K is the number of classes.
The element C(i,j) is true if the class label of the i-th
observation is equal to the j-th class.

S is a numeric matrix of size N&times;K , where each element
represents the classification score for the corresponding class.

W is a numeric vector of length N , representing
the observation weights.

Cost is a K&times;K matrix representing the misclassification
costs.

'Weights' Specifies observation weights, must be
a numeric vector of length equal to the number of rows in X.
Default is ones (size (X, 1)) . loss normalizes the weights so that
observation weights in each class sum to the prior probability of that
class. When you supply Weights, loss computes the weighted
classification loss.

See also:
CompactClassificationDiscriminant


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 68
Compute loss for a trained CompactClassificationDiscriminant object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
CompactClassificationDiscriminant.mahal


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1034
CompactClassificationDiscriminant: M = mahal ( obj , X )
CompactClassificationDiscriminant: M = mahal (&hellip;, 'ClassLabels' , labels )

Squared Mahalanobis distance to the class means.

M = mahal ( obj , X ) returns an NxK
matrix whose element (i,j) is the squared Mahalanobis distance
from observation i to the mean of class j , measured
against the covariance that class carries: the one shared covariance
for a linear discriminant and the class&rsquo;s own for a quadratic one.

obj must be a CompactClassificationDiscriminant object.

X must be an NxP numeric matrix with one column per
predictor of the trained model.

M = mahal (&hellip;, 'ClassLabels' , labels )
returns an Nx1 vector instead, holding for each observation the
distance to the mean of the class labels names for it.
labels must have one entry per row of X , each of them one
of ClassNames .

The distance is measured against the covariance the model reports, so
a regularized model is measured against its regularized covariance.
The prior does not enter it.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Squared Mahalanobis distance to the class means.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
CompactClassificationDiscriminant.margin


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 843
CompactClassificationDiscriminant: m = margin ( obj , X , Y )

Classification margins for discriminant analysis classifier.

m = margin ( obj , X , Y ) returns
the classification margins for obj with data X and
classification Y . m is a numeric vector of length size (X,1).

obj is a CompactClassificationDiscriminant object.

X must be a N&times;P numeric matrix of input data where rows
correspond to observations and columns correspond to features or
variables.

Y is N&times;1 matrix or cell matrix containing the class labels
of corresponding predictor data in X . Y must have same
numbers of rows as X .

The classification margin for each observation is the difference between
the classification score for the true class and the maximal
classification score for the false classes.

See also:
fitcdiscr,
CompactClassificationDiscriminant


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 60
Classification margins for discriminant analysis classifier.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
CompactClassificationDiscriminant.nLinearCoeffs


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 901
CompactClassificationDiscriminant: n = nLinearCoeffs ( obj )
CompactClassificationDiscriminant: n = nLinearCoeffs ( obj , delta )

Number of nonzero linear coefficients at a regularization threshold.

n = nLinearCoeffs ( obj ) returns the number of
predictors the discriminant keeps at its own Delta .

n = nLinearCoeffs ( obj , delta ) returns the
number it would keep at each threshold in delta , as a column
vector however delta is shaped.

A predictor survives a threshold when its DeltaPredictor reaches
it, the comparison including equality, so delta at exactly a
predictor&rsquo;s own value still counts it. A threshold above every
DeltaPredictor therefore leaves nothing and returns zero.

The count is taken whatever the DiscrimType , as MATLAB takes it,
even though Delta regularizes the linear types alone.

See also:
fitcdiscr,
ClassificationDiscriminant,
CompactClassificationDiscriminant


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 68
Number of nonzero linear coefficients at a regularization threshold.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
CompactClassificationDiscriminant.predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1433
CompactClassificationDiscriminant: label = predict ( obj , XC )
CompactClassificationDiscriminant: [ label , score , cost ] = predict ( obj , XC )

Classify new data points into categories using the discriminant
analysis model from a CompactClassificationDiscriminant object.

label = predict ( obj , XC ) returns the vector of
labels predicted for the corresponding instances in XC , using the
corresponding labels from the trained ClassificationDiscriminant ,
model, obj .

obj must be a CompactClassificationDiscriminant class
object.

XC must be an M&times;P numeric matrix with the same number of
features P as the corresponding predictors of the discriminant
model in obj .

[ label , score , cost ] = predict ( obj ,
XC ) also returns score , which contains the predicted class
scores or posterior probabilities for each instance of the corresponding
unique classes, and cost , which is a matrix containing the expected
cost of the classifications.

The score matrix contains the posterior probabilities for each
class, calculated using the multivariate normal probability density
function and the prior probabilities of each class. These scores are
normalized to ensure they sum to 1 for each observation.

The cost matrix contains the expected classification cost for each
class, computed based on the posterior probabilities and the specified
misclassification costs.

See also:
CompactClassificationDiscriminant,
fitcdiscr


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 127
Classify new data points into categories using the discriminant analysis model from a CompactClassificationDiscriminant object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
CompactClassificationDiscriminant.savemodel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 531
CompactClassificationDiscriminant: savemodel ( obj , filename )

Save a CompactClassificationDiscriminant object.

savemodel ( obj , filename ) saves each property of a
CompactClassificationDiscriminant object into an Octave binary file, the
name of which is specified in filename , along with an extra
variable, which defines the type classification object these variables
constitute. Use loadmodel in order to load a classification object
into Octave&rsquo;s workspace.

See also:
loadmodel,
fitcdiscr,
ClassificationDiscriminant


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Save a CompactClassificationDiscriminant object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
CompactClassificationGAM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 966
statistics: CompactClassificationGAM

Compact generalized additive model classification

The CompactClassificationGAM class is a compact version of a
Generalized Additive Model classifier, ClassificationGAM . It does
not include the training data, resulting in a smaller classifier size that
can be used for making predictions from new data, but not for tasks such as
cross validation.

A CompactClassificationGAM object can only be created from a
ClassificationGAM model by using the compact method.

The engine that fitted the model is carried over in FitMethod ,
and the compact model predicts by the same scheme the full one did.
Under 'boostedtrees' , the default, the fit is described by
TreeModel , BinEdges and PairDetectionBinEdges .
Under 'splines' it is described by Formula ,
BaseModel , ModelwInt and IntMatrix , which MATLAB&rsquo;s
compact model does not carry. Whichever fitted the model, the other
set is empty.

See also:
ClassificationGAM,
fitcgam


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Compact generalized additive model classification



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
CompactClassificationGAM.BaseModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 295
CompactClassificationGAM: property BaseModel

Base model parameters

A structure containing the parameters of the base model without any
interaction terms. The base model represents the generalized additive
model with only the main effects (predictor terms) included.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
Base model parameters



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
CompactClassificationGAM.BinEdges


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 291
CompactClassificationGAM: property BinEdges

Bin edges of the fitted shape functions

A cell array with one row vector per predictor, holding the cut points
the boosted-tree engine binned it at. It is the empty cell under the
spline engine, which does no binning. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
Bin edges of the fitted shape functions



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
CompactClassificationGAM.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 226
CompactClassificationGAM: property CategoricalPredictors

Indices of the categorical predictors

A numeric vector holding the column of each predictor treated as
categorical, and empty when none is. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
CompactClassificationGAM.ClassNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 352
CompactClassificationGAM: property ClassNames

Names of classes in the response variable

An array of unique values of the response variable Y , which has the
same data types as the data in Y . This property is read-only.
ClassNames can have any of the following datatypes:

Cell array of character vectors
Character array
Logical vector
Numeric vector


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Names of classes in the response variable



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
CompactClassificationGAM.CompactClassificationGAM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 429
CompactClassificationGAM: obj = CompactClassificationGAM ( Mdl )
CompactClassificationGAM: obj = CompactClassificationGAM ()

Create a CompactClassificationGAM object.

Mdl is the ClassificationGAM object to
compact. The documented way to reach this constructor is the
compact method.

Called with no arguments it returns an object with its properties
empty, which is how a saved model is rebuilt before its values are
filled in.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Create a CompactClassificationGAM object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
CompactClassificationGAM.Cost


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1203
CompactClassificationGAM: property Cost

Cost of Misclassification

A square matrix specifying the cost of misclassification of a point.
Cost(i,j) is the cost of classifying a point into class j
if its true class is i (that is, the rows correspond to the true
class and the columns correspond to the predicted class). The order of
the rows and columns in Cost corresponds to the order of the
classes in ClassNames . The number of rows and columns in
Cost is the number of unique classes in the response. By
default, Cost(i,j) = 1 if i != j , and
Cost(i,j) = 0 if i = j . In other words, the cost is 0
for correct classification and 1 for incorrect classification.

Add or change the Cost property using dot notation as in:

obj .Cost = costMatrix

A cost may also be given as a struct with the fields
ClassNames and ClassificationCosts , which names the
order its own matrix is written in. That matrix is permuted into the
order of ClassNames above, so a caller need not know which
order the classes were sorted into. It must name every class.

A cost must be floating point, not sparse, not complex, non-negative
and zero down its diagonal, and must hold no NaN or
Inf . A single is widened to double .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
Cost of Misclassification



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
CompactClassificationGAM.ExpandedPredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 301
CompactClassificationGAM: property ExpandedPredictorNames

Names of the expanded predictor variables

A cell array of character vectors naming the predictors as the model
sees them. It matches PredictorNames unless a categorical
predictor was expanded into dummy variables. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Names of the expanded predictor variables



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
CompactClassificationGAM.FitMethod


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 188
CompactClassificationGAM: property FitMethod

Which engine fitted the model

Either 'boostedtrees' or 'splines' , as the model it was
compacted from was fitted. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Which engine fitted the model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
CompactClassificationGAM.Formula


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 280
CompactClassificationGAM: property Formula

Model specification formula

A character vector specifying the model formula in the form
'Y ~ terms' where Y represents the response variable and
terms specifies the predictor variables and interaction terms.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Model specification formula



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
CompactClassificationGAM.IntMatrix


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 564
CompactClassificationGAM: property IntMatrix

Every term the model fits

A logical matrix with one row per term and one column per predictor,
true wherever the term multiplies that predictor. A row naming one
predictor is a main effect, two an interaction, and three or more a
higher-order term. This property is read-only.

It is the complete record, where Interactions reports only the
two-way terms, in the form MATLAB reports them. It is also the form
the 'Interactions' option takes back, so passing it to the
constructor rebuilds a model over the same terms.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
Every term the model fits



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
CompactClassificationGAM.Interactions


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 605
CompactClassificationGAM: property Interactions

Two-way interaction terms of the fitted model

A Kx2 matrix of predictor index pairs, one row per two-way term
the model carries, and zeros (0, 2) when it carries none. It
reports what was fitted rather than what was asked for, so a count of
terms, 'all' , a logical matrix and a formula all leave the same
kind of value behind. This property is read-only.

A main effect names one predictor and a higher-order term names three
or more, and neither has a two-column form, so neither appears here.
IntMatrix remains the complete record of every term fitted.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
Two-way interaction terms of the fitted model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
CompactClassificationGAM.Intercept


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 204
CompactClassificationGAM: property Intercept

Intercept of the fitted model

A numeric scalar, the log-odds of the response mean, which every
additive term is measured against. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Intercept of the fitted model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
CompactClassificationGAM.ModelwInt


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 275
CompactClassificationGAM: property ModelwInt

Model parameters with interactions

A structure containing the parameters of the model that includes
interaction terms. This model extends the base model by adding
interaction terms between predictors. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
Model parameters with interactions



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
CompactClassificationGAM.NumPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 231
CompactClassificationGAM: property NumPredictors

Number of predictors

A positive integer value specifying the number of predictors in the
training dataset used for training the ClassificationGAM model.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Number of predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
CompactClassificationGAM.PairDetectionBinEdges


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 236
CompactClassificationGAM: property PairDetectionBinEdges

Bin edges the interaction terms are held on

A cell array with one coarse row vector per predictor, empty when the
model carries no interaction terms. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
Bin edges the interaction terms are held on



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
CompactClassificationGAM.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 264
CompactClassificationGAM: property PredictorNames

Names of predictor variables

A cell array of character vectors specifying the names of the predictor
variables. The names are in the order in which they appear in the
training dataset. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
Names of predictor variables



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
CompactClassificationGAM.Prior


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 272
CompactClassificationGAM: property Prior

Prior probability for each class

A 2-element numeric vector specifying the prior probabilities for each
class. The order of the elements in Prior corresponds to the
order of the classes in ClassNames . This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Prior probability for each class



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
CompactClassificationGAM.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 168
CompactClassificationGAM: property ResponseName

Response variable name

A character vector specifying the name of the response variable Y .
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Response variable name



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
CompactClassificationGAM.ScoreTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1357
CompactClassificationGAM: property ScoreTransform

Transformation function for classification scores

Specified as a function handle for transforming the classification
scores. Add or change the ScoreTransform property using dot
notation as in:

obj .ScoreTransform = 'function_name'
obj .ScoreTransform = @function_handle

When specified as a character vector, it can be any of the following
built-in functions. Nevertheless, the ScoreTransform property
always stores their function handle equivalent.

Value Description
'doublelogit' 1 ./ (1 + exp (-2 &times; x))
'invlogit' log (x ./ (1 - x))
'ismax' Sets the score for the class with the
largest score to 1, and for all other classes to 0
'logit' 1 ./ (1 + exp (-x))
'none' x (no transformation)
'identity' x (no transformation)
'sign' -1 for x < 0, 0 for x = 0, 1 for x >
0
'symmetric' 2 &times; x - 1
'symmetricismax' Sets the score for the class
with the largest score to 1, and for all other classes to -1
'symmetriclogit' 2 ./ (1 + exp (-x)) - 1

The default is 'logit' , as in MATLAB. This model&rsquo;s raw
score is a log-odds, reported as the pair [-f, f] whose two
columns sum to zero, and the transform is what turns it into the
posterior probabilities that sum to one. Every transform therefore
composes on the log-odds and not on the probabilities, so
'none' returns the log-odds themselves.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Transformation function for classification scores



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
CompactClassificationGAM.TreeModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 223
CompactClassificationGAM: property TreeModel

The fitted shape functions and interaction surfaces

The structure the full model reports, carried over unchanged, and
empty under the spline engine. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51
The fitted shape functions and interaction surfaces



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
CompactClassificationGAM.edge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 447
CompactClassificationGAM: e = edge ( obj , X , Y )
CompactClassificationGAM: e = edge (&hellip;, "Weights" , w )

Classification edge of a compact generalized additive model.

e = edge ( obj , X , Y ) returns the mean of
the classification margins over the rows of X .

e = edge (&hellip;, "Weights" , w ) takes the
weighted mean instead, with one weight per row of X .

See also:
CompactClassificationGAM,
ClassificationGAM,
margin,
loss,
predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 60
Classification edge of a compact generalized additive model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
CompactClassificationGAM.loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 946
CompactClassificationGAM: L = loss ( obj , X , Y )
CompactClassificationGAM: L = loss (&hellip;, name , value )

Classification loss of a compact generalized additive model.

L = loss ( obj , X , Y ) returns the loss of
the model on the rows of X against the true labels Y .

L = loss (&hellip;, name , value ) accepts the
following name-value pairs:

"LossFun" selects the loss. Supported values are
"mincost" , the default, "binodeviance" ,
"classifcost" , "classiferror" , "exponential" ,
"hinge" , "logit" and "quadratic" .
"mincost" assigns each observation to the class of least
expected cost and charges what that assignment costs, so it reads the
scores as a posterior, which is what this model returns;
"classifcost" charges what the model&rsquo;s own prediction costs.

"Weights" holds one weight per row of X , normalised to
sum to one before it is applied.

See also:
CompactClassificationGAM,
ClassificationGAM,
margin,
edge,
predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 60
Classification loss of a compact generalized additive model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
CompactClassificationGAM.margin


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 471
CompactClassificationGAM: m = margin ( obj , X , Y )

Classification margin of a compact generalized additive model.

m = margin ( obj , X , Y ) returns a column
vector holding, for each row of X , the score the model gives its
true class in Y less the score it gives the other class. A
positive margin means the observation is classified correctly, and the
larger it is the more confidently so.

See also:
CompactClassificationGAM,
ClassificationGAM,
edge,
loss,
predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 62
Classification margin of a compact generalized additive model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
CompactClassificationGAM.predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1185
CompactClassificationGAM: label = predict ( obj , XC )
CompactClassificationGAM: [ label , score ] = predict ( obj , XC )
CompactClassificationGAM: [ label , score ] = predict (&hellip;, 'IncludeInteractions' , includeInteractions )

Predict labels for new data using the Generalized Additive Model (GAM)
stored in a CompactClassificationGAM object.

label = predict ( obj , XC ) returns the predicted
labels for the data in XC based on the model stored in the
CompactClassificationGAM object, obj .

[ label , score ] = predict ( obj , XC ) also
returns score , which contains the predicted class scores or
posterior probabilities for each observation.

[ label , score ] = predict ( obj , XC ,
'IncludeInteractions', includeInteractions ) allows you to specify
whether interaction terms should be included when making predictions.

obj must be a CompactClassificationGAM class object.

XC must be an M&times;P numeric matrix where each row is an
observation and each column corresponds to a predictor variable.

includeInteractions is a logical scalar indicating whether to
include interaction terms in the predictions.

See also:
CompactClassificationGAM,
ClassificationGAM,
fitcgam


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 115
Predict labels for new data using the Generalized Additive Model (GAM) stored in a CompactClassificationGAM object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
CompactClassificationGAM.savemodel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 519
CompactClassificationGAM: savemodel ( obj , filename )

Save a CompactClassificationGAM object.

savemodel ( obj , filename ) saves each property of a
CompactClassificationGAM object into an Octave binary file, the name of
which is specified in filename , along with an extra variable,
which defines the type classification object these variables constitute.
Use loadmodel in order to load a classification object into
Octave&rsquo;s workspace.

See also:
loadmodel,
fitcgam,
ClassificationGAM,
CompactClassificationGAM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
Save a CompactClassificationGAM object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
CompactClassificationNaiveBayes


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 575
statistics: CompactClassificationNaiveBayes

Compact naive Bayes classification

A CompactClassificationNaiveBayes object carries the fitted
densities of a ClassificationNaiveBayes model and everything
predict needs, but not the observations the model was fitted on.
It classifies new data identically to the model it came from, and is far
smaller to keep or to ship.

Create one with the compact method of a
ClassificationNaiveBayes object. Because it holds no training
data, it has no resub methods and cannot be cross-validated.

See also:
ClassificationNaiveBayes,
fitcnb


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
Compact naive Bayes classification



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
CompactClassificationNaiveBayes.CategoricalLevels


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 254
CompactClassificationNaiveBayes: property CategoricalLevels

Levels of the categorical predictors

A cell array with one entry per predictor, holding the distinct levels
of each categorical predictor and empty for every other. This property
is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
Levels of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 53
CompactClassificationNaiveBayes.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 189
CompactClassificationNaiveBayes: property CategoricalPredictors

Categorical predictor indices

The column indices treated as categorical, or empty when none is. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Categorical predictor indices



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
CompactClassificationNaiveBayes.ClassNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 210
CompactClassificationNaiveBayes: property ClassNames

Class labels of the fitted model

The distinct classes the model was fitted on, in the order the other
per-class properties use. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Class labels of the fitted model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 63
CompactClassificationNaiveBayes.CompactClassificationNaiveBayes


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 288
CompactClassificationNaiveBayes: obj = CompactClassificationNaiveBayes ( Mdl )

Create a CompactClassificationNaiveBayes object.

Mdl is the ClassificationNaiveBayes object to compact. The
documented way to reach this constructor is the compact method.

See also:
ClassificationNaiveBayes


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Create a CompactClassificationNaiveBayes object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
CompactClassificationNaiveBayes.Cost


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 179
CompactClassificationNaiveBayes: property Cost

Misclassification cost

A square numeric matrix where Cost(i,j) is the cost of
classifying an observation of class i into class j .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Misclassification cost



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
CompactClassificationNaiveBayes.DistributionNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 215
CompactClassificationNaiveBayes: property DistributionNames

Predictor distributions

A cell array of character vectors with one entry per predictor, naming
the distribution fitted to it. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
Predictor distributions



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 54
CompactClassificationNaiveBayes.DistributionParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 230
CompactClassificationNaiveBayes: property DistributionParameters

Fitted distribution parameters

A cell array with one row per class and one column per predictor,
holding the parameters fitted to each. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
Fitted distribution parameters



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 54
CompactClassificationNaiveBayes.ExpandedPredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 208
CompactClassificationNaiveBayes: property ExpandedPredictorNames

Expanded predictor variable names

A cell array of character vectors naming the predictors as the model
sees them. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
Expanded predictor variable names



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
CompactClassificationNaiveBayes.Kernel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 199
CompactClassificationNaiveBayes: property Kernel

Kernel smoothing functions

A cell array naming the smoothing kernel of each kernel predictor, and
empty for every other. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
Kernel smoothing functions



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
CompactClassificationNaiveBayes.Mu


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 186
CompactClassificationNaiveBayes: property Mu

Predictor means

The means used to center the predictors, when the model standardizes
them, and empty otherwise. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
Predictor means



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
CompactClassificationNaiveBayes.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 168
CompactClassificationNaiveBayes: property PredictorNames

Predictor variable names

A cell array of character vectors naming the predictors. This property
is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
Predictor variable names



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
CompactClassificationNaiveBayes.Prior


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 167
CompactClassificationNaiveBayes: property Prior

Class prior probabilities

A numeric row vector with one entry per class, in the order of
ClassNames , summing to one.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
Class prior probabilities



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 44
CompactClassificationNaiveBayes.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 156
CompactClassificationNaiveBayes: property ResponseName

Response variable name

A character vector naming the response variable. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Response variable name



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
CompactClassificationNaiveBayes.ScoreTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 187
CompactClassificationNaiveBayes: property ScoreTransform

Score transformation

A character vector naming the function applied to the posterior
returned by predict , or a function handle.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Score transformation



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
CompactClassificationNaiveBayes.Sigma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 216
CompactClassificationNaiveBayes: property Sigma

Predictor standard deviations

The standard deviations used to scale the predictors, when the model
standardizes them, and empty otherwise. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Predictor standard deviations



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
CompactClassificationNaiveBayes.Support


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 206
CompactClassificationNaiveBayes: property Support

Kernel smoothing supports

A cell array giving the support of each kernel predictor&rsquo;s density, and
empty for every other. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
Kernel smoothing supports



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
CompactClassificationNaiveBayes.Width


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 226
CompactClassificationNaiveBayes: property Width

Kernel smoothing bandwidths

A numeric matrix with one row per class and one column per predictor,
and empty when no predictor uses a kernel density. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Kernel smoothing bandwidths



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
CompactClassificationNaiveBayes.edge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 160
CompactClassificationNaiveBayes: e = edge ( obj , X , Y )
CompactClassificationNaiveBayes: e = edge (&hellip;, 'Weights' , w )

Classification edge on new data.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Classification edge on new data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
CompactClassificationNaiveBayes.logp


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 106
CompactClassificationNaiveBayes: lp = logp ( obj , X )

Log unconditional probability density of new data.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
Log unconditional probability density of new data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
CompactClassificationNaiveBayes.loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 244
CompactClassificationNaiveBayes: l = loss ( obj , X , Y )
CompactClassificationNaiveBayes: l = loss (&hellip;, name , value )

Classification loss on new data.

Takes the 'LossFun' and 'Weights' options that
ClassificationNaiveBayes.loss takes.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Classification loss on new data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
CompactClassificationNaiveBayes.margin


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 95
CompactClassificationNaiveBayes: m = margin ( obj , X , Y )

Classification margin on new data.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
Classification margin on new data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
CompactClassificationNaiveBayes.predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 367
CompactClassificationNaiveBayes: label = predict ( obj , XC )
CompactClassificationNaiveBayes: [ label , score , cost ] = predict ( obj , XC )

Classify new data with a compact naive Bayes model.

The same classification the model it came from would give: the label of
least expected cost, the posterior of each class, and the expected
misclassification cost of each.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51
Classify new data with a compact naive Bayes model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
CompactClassificationNaiveBayes.savemodel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 527
CompactClassificationNaiveBayes: savemodel ( obj , filename )

Save a CompactClassificationNaiveBayes object.

savemodel ( obj , filename ) saves each property of a
CompactClassificationNaiveBayes object into an Octave binary file, the
name of which is specified in filename , along with an extra
variable, which defines the type classification object these variables
constitute. Use loadmodel in order to load a classification
object into Octave&rsquo;s workspace.

See also:
loadmodel,
fitcnb,
CompactClassificationNaiveBayes


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
Save a CompactClassificationNaiveBayes object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
CompactClassificationNeuralNetwork


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 758
statistics: CompactClassificationNeuralNetwork

Compact neural network classification

The CompactClassificationNeuralNetwork class implements a compact
version of the neural network classifier object, which can predict
responses for new data using the predict method, but does not store
the training data.

A compact neural network classification model is a smaller version of the
full ClassificationNeuralNetwork model that does not include the
training data. It consumes less memory than the full model, but cannot
perform tasks that require the training data, such as cross-validation.

Create a CompactClassificationNeuralNetwork object by using the
compact method on a ClassificationNeuralNetwork object.

See also:
ClassificationNeuralNetwork,
fitcnet


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Compact neural network classification



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
CompactClassificationNeuralNetwork.Activations


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 398
CompactClassificationNeuralNetwork: property Activations

Activation functions for hidden layers

A character vector or cell array of character vectors specifying the
activation functions used in the hidden layers of the neural network.
Supported activation functions include: 'linear' ,
'sigmoid' , 'relu' , 'tanh' , 'softmax' ,
'lrelu' , 'prelu' , 'elu' , and 'gelu' .
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
Activation functions for hidden layers



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 56
CompactClassificationNeuralNetwork.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 236
CompactClassificationNeuralNetwork: property CategoricalPredictors

Indices of the categorical predictors

A numeric vector holding the column of each predictor treated as
categorical, and empty when none is. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
CompactClassificationNeuralNetwork.ClassNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 362
CompactClassificationNeuralNetwork: property ClassNames

Names of classes in the response variable

An array of unique values of the response variable Y , which has the
same data types as the data in Y . This property is read-only.
ClassNames can have any of the following datatypes:

Cell array of character vectors
Character array
Logical vector
Numeric vector


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Names of classes in the response variable



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 69
CompactClassificationNeuralNetwork.CompactClassificationNeuralNetwork


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 489
CompactClassificationNeuralNetwork: obj = CompactClassificationNeuralNetwork ( Mdl )
CompactClassificationNeuralNetwork: obj = CompactClassificationNeuralNetwork ()

Create a CompactClassificationNeuralNetwork object.

Mdl is the ClassificationNeuralNetwork object to
compact. The documented way to reach this constructor is the
compact method.

Called with no arguments it returns an object with its properties
empty, which is how a saved model is rebuilt before its values are
filled in.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51
Create a CompactClassificationNeuralNetwork object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
CompactClassificationNeuralNetwork.Cost


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 759
CompactClassificationNeuralNetwork: property Cost

Cost of misclassification

A numeric matrix with one row and one column per class, where
Cost(i,j) is the cost of classifying an observation of class
i as class j . It is taken from the model this object was
compacted from. This property is read-only.

A cost may also be given as a struct with the fields
ClassNames and ClassificationCosts , which names the
order its own matrix is written in. That matrix is permuted into the
order of ClassNames above, so a caller need not know which
order the classes were sorted into. It must name every class.

A cost must be floating point, not sparse, not complex, non-negative
and zero down its diagonal, and must hold no NaN or
Inf . A single is widened to double .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
Cost of misclassification



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 57
CompactClassificationNeuralNetwork.ExpandedPredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 311
CompactClassificationNeuralNetwork: property ExpandedPredictorNames

Names of the expanded predictor variables

A cell array of character vectors naming the predictors as the model
sees them. It matches PredictorNames unless a categorical
predictor was expanded into dummy variables. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Names of the expanded predictor variables



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
CompactClassificationNeuralNetwork.LayerBiases


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 247
CompactClassificationNeuralNetwork: property LayerBiases

Learned bias of each fully connected layer

A cell array holding one column vector per layer, the output layer
included, with one entry per neuron of that layer. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Learned bias of each fully connected layer



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
CompactClassificationNeuralNetwork.LayerSizes


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 487
CompactClassificationNeuralNetwork: property LayerSizes

Sizes of fully connected layers

A positive integer vector specifying the sizes of the fully connected
layers in the neural network model. The i-th element of
LayerSizes is the number of outputs in the i-th fully connected
layer of the neural network model. LayerSizes does not include
the size of the final fully connected layer. This layer always has K
outputs, where K is the number of classes in Y. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Sizes of fully connected layers



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
CompactClassificationNeuralNetwork.LayerWeights


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 276
CompactClassificationNeuralNetwork: property LayerWeights

Learned weights of each fully connected layer

A cell array holding one matrix per layer, the output layer included,
with one row per neuron of that layer and one column per input it
takes. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
Learned weights of each fully connected layer



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
CompactClassificationNeuralNetwork.Mu


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 228
CompactClassificationNeuralNetwork: property Mu

Predictor means

A numeric vector containing the means of the predictors used for
standardization. Empty when the predictor data were not standardized.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
Predictor means



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
CompactClassificationNeuralNetwork.NumPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 238
CompactClassificationNeuralNetwork: property NumPredictors

Number of predictors

A positive integer value specifying the number of predictors in the
training dataset used for training the neural network model.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Number of predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 56
CompactClassificationNeuralNetwork.OutputLayerActivation


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 307
CompactClassificationNeuralNetwork: property OutputLayerActivation

Activation function for output layer

A character vector specifying the activation function of the output layer
of the neural network. Supported activation functions are the same as
for the Activations property. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
Activation function for output layer



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
CompactClassificationNeuralNetwork.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 274
CompactClassificationNeuralNetwork: property PredictorNames

Names of predictor variables

A cell array of character vectors specifying the names of the predictor
variables. The names are in the order in which they appear in the
training dataset. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
Names of predictor variables



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
CompactClassificationNeuralNetwork.Prior


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 259
CompactClassificationNeuralNetwork: property Prior

Prior probability of each class

A numeric vector with one entry per class, in the order of
ClassNames , summing to one. It is taken from the model this
object was compacted from. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Prior probability of each class



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
CompactClassificationNeuralNetwork.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 178
CompactClassificationNeuralNetwork: property ResponseName

Response variable name

A character vector specifying the name of the response variable Y .
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Response variable name



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
CompactClassificationNeuralNetwork.ScoreTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1014
CompactClassificationNeuralNetwork: property ScoreTransform

Transformation function for classification scores

Specified as a function handle for transforming the classification
scores. Add or change the ScoreTransform property using dot
notation as in:

obj .ScoreTransform = 'function_name'
obj .ScoreTransform = @function_handle

When specified as a character vector, it can be any of the following
built-in functions. Nevertheless, the ScoreTransform property
always stores their function handle equivalent.

Value Description
'doublelogit' 1 ./ (1 + exp (-2 &times; x))
'invlogit' log (x ./ (1 - x))
'ismax' Sets the score for the class with the
largest score to 1, and for all other classes to 0
'logit' 1 ./ (1 + exp (-x))
'none' x (no transformation)
'identity' x (no transformation)
'sign' -1 for x < 0, 0 for x = 0, 1 for x >
0
'symmetric' 2 &times; x - 1
'symmetricismax' Sets the score for the class
with the largest score to 1, and for all other classes to -1
'symmetriclogit' 2 ./ (1 + exp (-x)) - 1


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Transformation function for classification scores



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
CompactClassificationNeuralNetwork.Sigma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 259
CompactClassificationNeuralNetwork: property Sigma

Predictor standard deviations

A numeric vector containing the standard deviations of the predictors
used for standardization. Empty when the predictor data were not
standardized.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Predictor standard deviations



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
CompactClassificationNeuralNetwork.edge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 486
CompactClassificationNeuralNetwork: e = edge ( obj , X , Y )
CompactClassificationNeuralNetwork: e = edge (&hellip;, "Weights" , w )

Classification edge of a compact neural network classifier.

e = edge ( obj , X , Y ) returns the mean of
the classification margins over the rows of X .

e = edge (&hellip;, "Weights" , w ) takes the
weighted mean instead, with one weight per row of X .

See also:
CompactClassificationNeuralNetwork,
ClassificationNeuralNetwork,
margin,
loss,
predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 59
Classification edge of a compact neural network classifier.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
CompactClassificationNeuralNetwork.loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1165
CompactClassificationNeuralNetwork: L = loss ( obj , X , Y )
CompactClassificationNeuralNetwork: L = loss (&hellip;, name , value )

Classification loss of a compact neural network classifier.

L = loss ( obj , X , Y ) returns the loss of
the model on the rows of X against the true labels Y .

L = loss (&hellip;, name , value ) accepts the
following name-value pairs:

"LossFun" selects the loss. Supported values are
"mincost" , the default, "binodeviance" ,
"classifcost" , "classiferror" , "crossentropy" ,
"exponential" , "hinge" , "logit" and
"quadratic" . "mincost" assigns each observation to
the class of least expected cost and charges what that assignment
costs, so it reads the scores as a posterior; "classifcost"
charges what the model&rsquo;s own prediction costs. "crossentropy"
is defined for a network only. Note that the default differs from the
other classifiers in this package, which default to
"classiferror" , and follows MATLAB&rsquo;s for this class.

"Weights" holds one weight per row of X , normalised to
sum to one before it is applied.

See also:
CompactClassificationNeuralNetwork,
ClassificationNeuralNetwork,
margin,
edge,
predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 59
Classification loss of a compact neural network classifier.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
CompactClassificationNeuralNetwork.margin


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 508
CompactClassificationNeuralNetwork: m = margin ( obj , X , Y )

Classification margin of a compact neural network classifier.

m = margin ( obj , X , Y ) returns a column
vector holding, for each row of X , the score the model gives its
true class in Y less the largest score it gives any other class.
A positive margin means the observation is classified correctly, and
the larger it is the more confidently so.

See also:
CompactClassificationNeuralNetwork,
ClassificationNeuralNetwork,
edge,
loss,
predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 61
Classification margin of a compact neural network classifier.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
CompactClassificationNeuralNetwork.predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1267
CompactClassificationNeuralNetwork: label = predict ( obj , XC )
CompactClassificationNeuralNetwork: [ label , score ] = predict ( obj , XC )

Classify new data points into categories using the neural network
classification model from a CompactClassificationNeuralNetwork object.

label = predict ( obj , XC ) returns the vector of
labels predicted for the corresponding instances in XC , using the
neural network model stored in the CompactClassificationNeuralNetwork
model, obj .

obj must be a CompactClassificationNeuralNetwork class
object.

XC must be an M&times;P numeric matrix with the same number of
features P as the corresponding predictors of the neural network
model in obj .

[ label , score ] = predict ( obj , XC ) also
returns score , which contains the predicted class scores or
posterior probabilities for each instance of the corresponding unique
classes.

The score matrix contains the classification scores for each class.
For each observation in XC , the predicted class label is the one
with the highest score among all classes. If the ScoreTransform
property is set to a transformation function, the scores are transformed
accordingly before being returned.

See also:
CompactClassificationNeuralNetwork,
ClassificationNeuralNetwork,
fitcnet


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 136
Classify new data points into categories using the neural network classification model from a CompactClassificationNeuralNetwork object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 44
CompactClassificationNeuralNetwork.savemodel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 533
CompactClassificationNeuralNetwork: savemodel ( obj , filename )

Save a CompactClassificationNeuralNetwork object.

savemodel ( obj , filename ) saves each property of a
CompactClassificationNeuralNetwork object into an Octave binary file, the
name of which is specified in filename , along with an extra
variable, which defines the type classification object these variables
constitute. Use loadmodel in order to load a classification
object into Octave&rsquo;s workspace.

See also:
loadmodel,
fitcnet,
ClassificationNeuralNetwork


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Save a CompactClassificationNeuralNetwork object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
CompactClassificationSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 706
statistics: CompactClassificationSVM

Compact Support Vector Machine classification

The CompactClassificationSVM class implements a compact version of a
Support Vector Machine classifier object for one-class or two-class
problems, which can predict responses for new data using the predict
method.

A CompactClassificationSVM object is a compact version of a support
vector machine model, ClassificationSVM . It does not include the
training data resulting in a smaller classifier size, which can be used for
making predictions from new data, but not for tasks such as cross
validation. It can only be created from a ClassificationSVM model
by using the compact object method.

See also:
ClassificationSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
Compact Support Vector Machine classification



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
CompactClassificationSVM.Alpha


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 361
CompactClassificationSVM: property Alpha

Trained classifier coefficients

The coefficients of the trained SVM classifier specified as an s&times;1
numeric vector, where s is the number of support vectors,
rows (obj.SupportVectors) . If the SVM classifier was trained
with a kernel function other than 'linear' , then Alpha is
empty. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Trained classifier coefficients



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
CompactClassificationSVM.Beta


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 332
CompactClassificationSVM: property Beta

Linear predictor coefficients

The linear predictor coefficients specified as an s&times;1 numeric
vector, where s is the number of support vectors,
rows (obj.SupportVectors) . If the SVM classifier was trained
with a 'linear' kernel function, then Beta is empty.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Linear predictor coefficients



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
CompactClassificationSVM.Bias


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 116
CompactClassificationSVM: property Bias

Bias term

The bias term specified as a scalar. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
Bias term



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
CompactClassificationSVM.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 236
CompactClassificationSVM: property CategoricalPredictors

Indices of the categorical predictors

A numeric vector of column indices into X naming the predictors
treated as categorical, and empty when none is. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
CompactClassificationSVM.ClassNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 352
CompactClassificationSVM: property ClassNames

Names of classes in the response variable

An array of unique values of the response variable Y , which has the
same data types as the data in Y . This property is read-only.
ClassNames can have any of the following datatypes:

Cell array of character vectors
Character array
Logical vector
Numeric vector


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Names of classes in the response variable



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
CompactClassificationSVM.CompactClassificationSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 429
CompactClassificationSVM: obj = CompactClassificationSVM ( Mdl )
CompactClassificationSVM: obj = CompactClassificationSVM ()

Create a CompactClassificationSVM object.

Mdl is the ClassificationSVM object to
compact. The documented way to reach this constructor is the
compact method.

Called with no arguments it returns an object with its properties
empty, which is how a saved model is rebuilt before its values are
filled in.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Create a CompactClassificationSVM object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
CompactClassificationSVM.Cost


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 202
CompactClassificationSVM: property Cost

Cost of misclassification

A numeric square matrix, where Cost(i,j) is the cost of
classifying an observation of class i as class j . This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
Cost of misclassification



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
CompactClassificationSVM.ExpandedPredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 269
CompactClassificationSVM: property ExpandedPredictorNames

Names of the predictors as the model expanded them

A cell array of character vectors. It matches PredictorNames
unless a categorical predictor was expanded into indicator variables.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
Names of the predictors as the model expanded them



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
CompactClassificationSVM.KernelParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 315
CompactClassificationSVM: property KernelParameters

Parameters of the kernel function

A structure with fields Function and Scale , and
Order for a polynomial kernel. Function names the
kernel as MATLAB names it, so a radial basis kernel reports
'gaussian' whichever spelling was given. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
Parameters of the kernel function



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
CompactClassificationSVM.Mu


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 257
CompactClassificationSVM: property Mu

Predictor means

A numeric vector of the same length as the columns in X containing
the means of predictor variables. If the predictor variables have not
been standardized, then Mu is empty. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
Predictor means



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
CompactClassificationSVM.NumPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 217
CompactClassificationSVM: property NumPredictors

Number of predictors

A positive integer value specifying the number of predictors in the
training dataset used for training the SVM model. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Number of predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
CompactClassificationSVM.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 264
CompactClassificationSVM: property PredictorNames

Names of predictor variables

A cell array of character vectors specifying the names of the predictor
variables. The names are in the order in which they appear in the
training dataset. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
Names of predictor variables



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
CompactClassificationSVM.Prior


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 197
CompactClassificationSVM: property Prior

Prior probabilities of the classes

A numeric row vector with one entry per class, in the order of
ClassNames , summing to one. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
Prior probabilities of the classes



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
CompactClassificationSVM.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 168
CompactClassificationSVM: property ResponseName

Response variable name

A character vector specifying the name of the response variable Y .
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Response variable name



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
CompactClassificationSVM.ScoreTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1004
CompactClassificationSVM: property ScoreTransform

Transformation function for classification scores

Specified as a function handle for transforming the classification
scores. Add or change the ScoreTransform property using dot
notation as in:

obj .ScoreTransform = 'function_name'
obj .ScoreTransform = @function_handle

When specified as a character vector, it can be any of the following
built-in functions. Nevertheless, the ScoreTransform property
always stores their function handle equivalent.

Value Description
'doublelogit' 1 ./ (1 + exp (-2 &times; x))
'invlogit' log (x ./ (1 - x))
'ismax' Sets the score for the class with the
largest score to 1, and for all other classes to 0
'logit' 1 ./ (1 + exp (-x))
'none' x (no transformation)
'identity' x (no transformation)
'sign' -1 for x < 0, 0 for x = 0, 1 for x >
0
'symmetric' 2 &times; x - 1
'symmetricismax' Sets the score for the class
with the largest score to 1, and for all other classes to -1
'symmetriclogit' 2 ./ (1 + exp (-x)) - 1


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Transformation function for classification scores



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
CompactClassificationSVM.Sigma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 291
CompactClassificationSVM: property Sigma

Predictor standard deviations

A numeric vector of the same length as the columns in X containing
the standard deviations of predictor variables. If the predictor
variables have not been standardized, then Sigma is empty.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Predictor standard deviations



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 44
CompactClassificationSVM.SupportVectorLabels


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 499
CompactClassificationSVM: property SupportVectorLabels

Support vector class labels

The support vector class labels specified as an s&times;1 numeric
vector, where s is the number of support vectors,
rows (obj.SupportVectors) . A value of +1 in
SupportVectorLabels indicates that the corresponding support
vector belongs to the positive class (ClassNames{2}) . A value
of -1 indicates that the corresponding support vector belongs to the
negative class (ClassNames{1}) . This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Support vector class labels



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
CompactClassificationSVM.SupportVectors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 320
CompactClassificationSVM: property SupportVectors

Support vectors

The support vectors of the trained SVM classifier specified an s&times;p
numeric matrix, where s is the number of support vectors,
rows (obj.SupportVectors) , and p is the number of
predictor variables in the predictor data. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
Support vectors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
CompactClassificationSVM.discardSupportVectors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 632
CompactClassificationSVM: obj = discardSupportVectors ( obj )

Discard the support vectors of a linear SVM model.

obj = discardSupportVectors ( obj ) empties
Alpha , SupportVectors and
SupportVectorLabels , leaving Beta and Bias to
decide every prediction. A linear kernel needs nothing else, so the
returned model predicts what it predicted before while carrying one
vector in place of many.

The kernel must be linear. Under any other the support vectors are
part of the decision function and cannot be dropped. Discarding twice
is not an error and changes nothing.

See also:
fitcsvm,
ClassificationSVM,
CompactClassificationSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
Discard the support vectors of a linear SVM model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
CompactClassificationSVM.edge


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 613
CompactClassificationSVM: e = edge ( obj , X , Y )
CompactClassificationSVM: e = edge (&hellip;, "Weights" , w )

Classification edge, the mean of the classification margins.

e = edge ( obj , X , Y ) reduces the vector
that margin returns to a single number, the mean margin over the
rows of X . It says how far the model puts the true class ahead of
its nearest rival on average, so a larger edge is a better model, and
unlike a loss it is not bounded above and rewards confidence rather than
bare correctness.

e = edge (&hellip;, "Weights" , w ) takes the
weighted mean instead, with one weight per row of X .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 60
Classification edge, the mean of the classification margins.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
CompactClassificationSVM.loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1905
CompactClassificationSVM: L = loss ( obj , X , Y )
CompactClassificationSVM: L = loss (&hellip;, name , value )

Compute loss for a trained CompactClassificationSVM object.

L = loss ( obj , X , Y ) computes the loss,
L , using the default loss function 'classiferror' .

obj is a CompactClassificationSVM object.

X must be a N&times;P numeric matrix of input data where rows
correspond to observations and columns correspond to features or
variables.

Y is N&times;1 matrix or cell matrix containing the class labels
of corresponding predictor data in X . Y must have same
numbers of Rows as X .

L = loss (&hellip;, name , value ) allows
additional options specified by name - value pairs:

Name Value
'LossFun' Specifies the loss function to use.
Can be a function handle with four input arguments (C, S, W, Cost)
which returns a scalar value or one of:
&rsquo;binodeviance&rsquo;, &rsquo;classifcost&rsquo;, &rsquo;classiferror&rsquo;, &rsquo;exponential&rsquo;,
&rsquo;hinge&rsquo;, &rsquo;logit&rsquo;,&rsquo;mincost&rsquo;, &rsquo;quadratic&rsquo;.

C is a logical matrix of size N&times;K , where N is the
number of observations and K is the number of classes.
The element C(i,j) is true if the class label of the i-th
observation is equal to the j-th class.

S is a numeric matrix of size N&times;K , where each element
represents the classification score for the corresponding class.

W is a numeric vector of length N , representing
the observation weights.

Cost is a K&times;K matrix representing the misclassification
costs.

'Weights' Specifies observation weights, must be
a numeric vector of length equal to the number of rows in X.
Default is ones (size (X, 1)) . loss normalizes the weights so that
observation weights in each class sum to the prior probability of that
class. When you supply Weights, loss computes the weighted
classification loss.

See also:
CompactClassificationSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 59
Compute loss for a trained CompactClassificationSVM object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
CompactClassificationSVM.margin


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 806
CompactClassificationSVM: m = margin ( obj , X , Y )

Classification margins for Support Vector Machine classifier.

m = margin ( obj , X , Y ) returns
the classification margins for obj with data X and
classification Y . m is a numeric vector of length size (X,1).

obj is a CompactClassificationSVM object.

X must be a N&times;P numeric matrix of input data where rows
correspond to observations and columns correspond to features or
variables.

Y is N&times;1 matrix or cell matrix containing the class labels
of corresponding predictor data in X . Y must have same
numbers of Rows as X .

The classification margin for each observation is the difference between
the classification score for the true class and the maximal
classification score for the false classes.

See also:
CompactClassificationSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 61
Classification margins for Support Vector Machine classifier.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
CompactClassificationSVM.predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1707
CompactClassificationSVM: label = predict ( obj , XC )
CompactClassificationSVM: [ label , score ] = predict ( obj , XC )
CompactClassificationSVM: [ label , score , cost ] = predict ( obj , XC )

Classify new data points into categories using the Support Vector Machine
classification model from a CompactClassificationSVM object.

label = predict ( obj , XC ) returns the vector of
labels predicted for the corresponding instances in XC , using the
predictor data in the CompactClassificationSVM model, obj . For
one-class SVM model, +1 or -1 is returned.

obj must be a CompactClassificationSVM class object.

XC must be an M&times;P numeric matrix with the same number of
features P as the corresponding predictors of the SVM model in
obj .

[ label , score ] = predict ( obj , XC ) also
returns score , which contains the decision values for each
prediction. A ScoreTransform assigned to obj is applied
to them, so score holds whatever that transform returns. Posterior
probabilities need a transform fitted to the model, which this package
does not compute yet.

Deviation from MATLAB. cost is the expected cost of
each assignment, sum_j P(j) Cost(j,k) . An SVM score is a
signed distance to the boundary and not a posterior, so the only
distribution available is the one concentrated on the predicted class
and cost is the row of Cost belonging to it. MATLAB
returns the column instead, which is the same matrix read the
wrong way and contradicts its own ClassificationKNN ,
ClassificationDiscriminant and ClassificationNaiveBayes
on any asymmetric cost matrix; the two agree wherever Cost is
symmetric, the default included. Measured on R2024a.

See also:
CompactClassificationSVM,
ClassificationSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 134
Classify new data points into categories using the Support Vector Machine classification model from a CompactClassificationSVM object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
CompactClassificationSVM.savemodel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 510
CompactClassificationSVM: savemodel ( obj , filename )

Save a CompactClassificationSVM object.

savemodel ( obj , filename ) saves each property of a
CompactClassificationSVM object into an Octave binary file, the name of
which is specified in filename , along with an extra variable,
which defines the type classification object these variables constitute.
Use loadmodel in order to load a classification object into
Octave&rsquo;s workspace.

See also:
loadmodel,
ClassificationSVM,
CompactClassificationSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
Save a CompactClassificationSVM object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
CompactRegressionGAM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1122
statistics: CompactRegressionGAM

Compact generalized additive model regression

The CompactRegressionGAM class implements a compact version of the
generalized additive model regression object, which predicts responses for
new data with the predict method but does not store the training
data.

A compact model consumes less memory than the full RegressionGAM
model, but cannot perform tasks that need the training data, such as
computing a resubstitution loss or the standard deviation of a prediction.

Create a CompactRegressionGAM object by using the compact
method on a RegressionGAM object.

The engine that fitted the model is carried over in FitMethod ,
and the compact model predicts by the same scheme the full one did.
Under 'boostedtrees' , the default, the fit is described by
TreeModel , BinEdges and PairDetectionBinEdges .
Under 'splines' it is described by Formula ,
BaseModel , ModelwInt and IntMatrix , which MATLAB&rsquo;s
compact model does not carry.
Whichever fitted the model, the other set is empty. A standard
deviation is available from the spline engine alone.

See also:
RegressionGAM,
fitrgam


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
Compact generalized additive model regression



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
CompactRegressionGAM.BaseModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 308
CompactRegressionGAM: property BaseModel

Model without interaction terms

A structure holding the intercept, the piecewise polynomial of each
predictor, the number of backfitting cycles, the residuals and the
residual sum of squares of the model fitted without interaction
terms. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Model without interaction terms



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
CompactRegressionGAM.BinEdges


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 140
CompactRegressionGAM: property BinEdges

Bin edges of the fitted shape functions, empty under the spline
engine. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 71
Bin edges of the fitted shape functions, empty under the spline engine.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
CompactRegressionGAM.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 222
CompactRegressionGAM: property CategoricalPredictors

Indices of the categorical predictors

A numeric vector holding the column of each predictor treated as
categorical, and empty when none is. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
CompactRegressionGAM.CompactRegressionGAM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 405
CompactRegressionGAM: obj = CompactRegressionGAM ( Mdl )
CompactRegressionGAM: obj = CompactRegressionGAM ()

Create a CompactRegressionGAM object.

Mdl is the RegressionGAM object to
compact. The documented way to reach this constructor is the
compact method.

Called with no arguments it returns an object with its properties
empty, which is how a saved model is rebuilt before its values are
filled in.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Create a CompactRegressionGAM object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
CompactRegressionGAM.ExpandedPredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 297
CompactRegressionGAM: property ExpandedPredictorNames

Names of the expanded predictor variables

A cell array of character vectors naming the predictors as the model
sees them. It matches PredictorNames unless a categorical
predictor was expanded into dummy variables. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Names of the expanded predictor variables



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
CompactRegressionGAM.FitMethod


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 130
CompactRegressionGAM: property FitMethod

Which engine fitted the model, 'boostedtrees' or
'splines' . This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 59
Which engine fitted the model, 'boostedtrees' or 'splines'.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
CompactRegressionGAM.Formula


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 229
CompactRegressionGAM: property Formula

Formula of the model

A character vector naming the response and the terms of the model, as
in 'Y ~ x1 + x2 + x1:x2' , or empty when the model was not
given one. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Formula of the model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
CompactRegressionGAM.IntMatrix


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 560
CompactRegressionGAM: property IntMatrix

Every term the model fits

A logical matrix with one row per term and one column per predictor,
true wherever the term multiplies that predictor. A row naming one
predictor is a main effect, two an interaction, and three or more a
higher-order term. This property is read-only.

It is the complete record, where Interactions reports only the
two-way terms, in the form MATLAB reports them. It is also the form
the 'Interactions' option takes back, so passing it to the
constructor rebuilds a model over the same terms.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
Every term the model fits



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
CompactRegressionGAM.Interactions


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 601
CompactRegressionGAM: property Interactions

Two-way interaction terms of the fitted model

A Kx2 matrix of predictor index pairs, one row per two-way term
the model carries, and zeros (0, 2) when it carries none. It
reports what was fitted rather than what was asked for, so a count of
terms, 'all' , a logical matrix and a formula all leave the same
kind of value behind. This property is read-only.

A main effect names one predictor and a higher-order term names three
or more, and neither has a two-column form, so neither appears here.
IntMatrix remains the complete record of every term fitted.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
Two-way interaction terms of the fitted model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
CompactRegressionGAM.Intercept


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 191
CompactRegressionGAM: property Intercept

Intercept of the fitted model

A numeric scalar, the mean of the response, which every additive term
is measured against. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Intercept of the fitted model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
CompactRegressionGAM.IsStandardDeviationFit


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 286
CompactRegressionGAM: property IsStandardDeviationFit

Flag for a fitted standard deviation model

A boolean flag, always false , as this class estimates the
standard deviation of a prediction from the residuals of the fit
rather than fitting a model for it. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Flag for a fitted standard deviation model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
CompactRegressionGAM.ModelwInt


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 229
CompactRegressionGAM: property ModelwInt

Model with interaction terms

A structure of the same fields as BaseModel , for the model
fitted with the interaction terms, and empty when none was asked for.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
Model with interaction terms



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
CompactRegressionGAM.NumPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 162
CompactRegressionGAM: property NumPredictors

Number of predictors

A positive integer, the number of predictors of the training data.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Number of predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
CompactRegressionGAM.PairDetectionBinEdges


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 168
CompactRegressionGAM: property PairDetectionBinEdges

Coarse bin edges the interaction terms are held on, empty when the
model carries none. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 86
Coarse bin edges the interaction terms are held on, empty when the model carries none.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
CompactRegressionGAM.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 212
CompactRegressionGAM: property PredictorNames

Names of the predictor variables

A cell array of character vectors naming the predictors, in the order
they appear in the training data. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Names of the predictor variables



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
CompactRegressionGAM.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 148
CompactRegressionGAM: property ResponseName

Response variable name

A character vector naming the response variable Y . This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Response variable name



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
CompactRegressionGAM.ResponseTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 320
CompactRegressionGAM: property ResponseTransform

Transformation applied to the predicted response

A function handle applied to the response the model predicts. Add or
change it using dot notation, as in
obj .ResponseTransform = 'log' or
obj .ResponseTransform = @function_handle . It defaults
to 'none' , the identity.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Transformation applied to the predicted response



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
CompactRegressionGAM.TreeModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 153
CompactRegressionGAM: property TreeModel

The fitted shape functions and interaction surfaces, empty under the
spline engine. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 83
The fitted shape functions and interaction surfaces, empty under the spline engine.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
CompactRegressionGAM.loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 686
CompactRegressionGAM: L = loss ( obj , X , Y )
CompactRegressionGAM: L = loss (&hellip;, name , value )

Regression loss of a generalized additive model.

L = loss ( obj , X , Y ) returns the weighted
mean squared error of the model on the rows of X against the true
response Y .

L = loss (&hellip;, name , value ) accepts the
following name-value pairs:

"LossFun" selects the loss, either "mse" , the default,
or a function handle taking the true response, the predicted response
and the weights, and returning a numeric scalar.

"Weights" holds one weight per row of X , normalised to
sum to one before it is applied.

See also:
CompactRegressionGAM,
RegressionGAM,
fitrgam,
predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Regression loss of a generalized additive model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
CompactRegressionGAM.predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1718
CompactRegressionGAM: yFit = predict ( obj , Xfit )
CompactRegressionGAM: yFit = predict (&hellip;, Name , Value )
CompactRegressionGAM: [ yFit , ySD , yInt ] = predict (&hellip;)

Predict new data points using generalized additive model regression
object.

yFit = predict ( obj , Xfit returns a vector of
predicted responses, yFit , for the predictor data in matrix
Xfit based on the Generalized Additive Model in obj .
Xfit must have the same number of features/variables as the
training data in obj .

obj must be a CompactRegressionGAM class object.

[ yFit , ySD , yInt ] = predict ( obj ,
Xfit
also returns the standard deviations, ySD , and prediction
intervals,
yInt , of the response variable yFit , evaluated at each
observation in the predictor data Xfit .

yFit = predict (&hellip;, Name , Value ) returns
the
aforementioned results with additional properties specified by
Name-Value pair arguments listed below.

Name Value
'alpha' significance level of the prediction
intervals yInt , specified as scalar in range [0,1] . The
default value is 0.05, which corresponds to 95% prediction intervals.
'includeinteractions' a boolean flag to include
interactions to predict new values based on Xfit . By default,
'includeinteractions' is true when the GAM model in
obj
contains a obj.Formula or obj.Interactions fields.
Otherwise, is set to false . If set to true when no
interactions are present in the trained model, it will result to an
error. If set to
false when using a model that includes interactions, the
predictions
will be made on the basic model without any interaction terms. This way
you can make predictions from the same GAM model without having to
retrain it.

See also:
fitrgam,
RegressionGAM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 75
Predict new data points using generalized additive model regression object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
CompactRegressionGAM.savemodel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 438
CompactRegressionGAM: savemodel ( obj , filename )

Save a CompactRegressionGAM object.

savemodel ( obj , filename ) saves each property of a
CompactRegressionGAM object into an Octave binary file, the name of
which is specified in filename , along with an extra variable which
defines the type of object these variables constitute. Use
loadmodel in order to load the object back into Octave.

See also:
loadmodel,
fitrgam,
RegressionGAM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
Save a CompactRegressionGAM object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
CompactRegressionGP


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1037
statistics: CompactRegressionGP

Compact Gaussian process regression

A CompactRegressionGP object holds a Gaussian process regression
model without its training data, keeping what is needed to predict and
dropping the rest.

Create a CompactRegressionGP object by using the compact
method of a RegressionGP object.

A compact model keeps the active set it predicts from, the prediction
weights, the covariance function and its parameters, the explicit basis and
its coefficients, the noise standard deviation and the standardizing
location and scale. It drops the response, the observation weights, the
rows used, the count of observations and the maximized log likelihood, so
it can predict but cannot be cross validated, refitted, or asked for its
resubstitution loss or its post-fit statistics.

The standard deviation and the prediction intervals remain available,
because the active set of an exactly fitted model is the whole of the
training predictors and the factorization can be rebuilt from it.

See also:
RegressionGP,
fitrgp


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
Compact Gaussian process regression



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
CompactRegressionGP.ActiveSetMethod


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 123
CompactRegressionGP: property ActiveSetMethod

Method used to select the active set

'Random' . This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
Method used to select the active set



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
CompactRegressionGP.ActiveSetSize


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 123
CompactRegressionGP: property ActiveSetSize

Size of the active set

A positive integer scalar. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Size of the active set



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
CompactRegressionGP.ActiveSetVectors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 206
CompactRegressionGP: property ActiveSetVectors

Subset of the training data used for predictions

An MxP numeric matrix, standardized where the model standardized
its predictors. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Subset of the training data used for predictions



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
CompactRegressionGP.Alpha


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 159
CompactRegressionGP: property Alpha

Weights the predictions are made from

A numeric vector with one weight per active set vector. This property
is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Weights the predictions are made from



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
CompactRegressionGP.BasisFunction


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 142
CompactRegressionGP: property BasisFunction

Explicit basis of the model

A character vector or a function handle. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Explicit basis of the model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
CompactRegressionGP.Beta


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 160
CompactRegressionGP: property Beta

Estimated coefficients of the explicit basis

A numeric vector, empty when the basis is 'None' . This property
is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 44
Estimated coefficients of the explicit basis



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
CompactRegressionGP.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 160
CompactRegressionGP: property CategoricalPredictors

Indices of the categorical predictors

A vector of positive integers, or empty. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
CompactRegressionGP.CompactRegressionGP


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 282
CompactRegressionGP: obj = CompactRegressionGP ( Mdl )

Create a CompactRegressionGP object.

Mdl is the RegressionGP object to
compact, and is required: the compact model has no training data to
build itself from. The documented way to reach this constructor is
the compact method.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
Create a CompactRegressionGP object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
CompactRegressionGP.ExpandedPredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 151
CompactRegressionGP: property ExpandedPredictorNames

Expanded predictor variable names

A cell array of character vectors. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
Expanded predictor variable names



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
CompactRegressionGP.FitMethod


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 128
CompactRegressionGP: property FitMethod

Method used to estimate the parameters

'Exact' or 'None' . This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
Method used to estimate the parameters



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
CompactRegressionGP.KernelFunction


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 147
CompactRegressionGP: property KernelFunction

Form of the covariance function

A character vector or a function handle. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Form of the covariance function



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
CompactRegressionGP.KernelInformation


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 191
CompactRegressionGP: property KernelInformation

Covariance function and its parameters

A structure with fields Name , KernelParameters and
KernelParameterNames . This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
Covariance function and its parameters



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
CompactRegressionGP.PredictMethod


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 115
CompactRegressionGP: property PredictMethod

Method used to make predictions

'Exact' . This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Method used to make predictions



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
CompactRegressionGP.PredictorLocation


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 146
CompactRegressionGP: property PredictorLocation

Means the predictors were centred by

A 1xP numeric vector, or empty. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
Means the predictors were centred by



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
CompactRegressionGP.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 134
CompactRegressionGP: property PredictorNames

Predictor variable names

A cell array of character vectors. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
Predictor variable names



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
CompactRegressionGP.PredictorScale


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 156
CompactRegressionGP: property PredictorScale

Standard deviations the predictors were scaled by

A 1xP numeric vector, or empty. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Standard deviations the predictors were scaled by



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
CompactRegressionGP.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 115
CompactRegressionGP: property ResponseName

Response variable name

A character vector. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Response variable name



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
CompactRegressionGP.ResponseTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 204
CompactRegressionGP: property ResponseTransform

Transformation applied to the predicted response

A character vector, or the text of the function handle that was
supplied. Assigning to it accepts either.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Transformation applied to the predicted response



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
CompactRegressionGP.Sigma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 119
CompactRegressionGP: property Sigma

Estimated noise standard deviation

A positive scalar. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
Estimated noise standard deviation



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
CompactRegressionGP.loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 338
CompactRegressionGP: L = loss ( obj , X , Y )
CompactRegressionGP: L = loss (&hellip;, name , value )

Compute the regression loss of a compact Gaussian process model.

L = loss ( obj , X , Y ) returns the mean
squared error of the model obj on the data X and Y ,
and accepts the same 'LossFun' and 'Weights' pairs the
full model accepts.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 64
Compute the regression loss of a compact Gaussian process model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
CompactRegressionGP.predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 526
CompactRegressionGP: yFit = predict ( obj , XC )
CompactRegressionGP: [ yFit , ySD , yInt ] = predict ( obj , XC )
CompactRegressionGP: [&hellip;] = predict (&hellip;, 'Alpha' , alpha )

Predict the response for new data with a compact Gaussian process model.

yFit = predict ( obj , XC ) returns the predicted
response of the CompactRegressionGP model obj at the
points in XC , and the further outputs are the standard deviation
of each predicted response and the prediction intervals, exactly as the
full model returns them.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 72
Predict the response for new data with a compact Gaussian process model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
CompactRegressionGP.savemodel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 198
CompactRegressionGP: savemodel ( obj , filename )

Save a compact Gaussian process model to a file.

savemodel ( obj , filename ) saves the model obj
into filename in a form loadmodel can read back.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Save a compact Gaussian process model to a file.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
CompactRegressionNeuralNetwork


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 875
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


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
Compact neural network regression



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
CompactRegressionNeuralNetwork.Activations


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 214
CompactRegressionNeuralNetwork: property Activations

Activation functions of the hidden layers

A character vector, or a cell array of character vectors with one entry
per hidden layer. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Activation functions of the hidden layers



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 52
CompactRegressionNeuralNetwork.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 190
CompactRegressionNeuralNetwork: property CategoricalPredictors

Indices of the categorical predictors

A numeric vector of column indices, and empty when none is. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 61
CompactRegressionNeuralNetwork.CompactRegressionNeuralNetwork


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 465
CompactRegressionNeuralNetwork: obj = CompactRegressionNeuralNetwork ( Mdl )
CompactRegressionNeuralNetwork: obj = CompactRegressionNeuralNetwork ()

Create a CompactRegressionNeuralNetwork object.

Mdl is the RegressionNeuralNetwork object to
compact. The documented way to reach this constructor is the
compact method.

Called with no arguments it returns an object with its properties
empty, which is how a saved model is rebuilt before its values are
filled in.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
Create a CompactRegressionNeuralNetwork object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 53
CompactRegressionNeuralNetwork.ExpandedPredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 179
CompactRegressionNeuralNetwork: property ExpandedPredictorNames

Names of the predictors as the model expanded them

A cell array of character vectors. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
Names of the predictors as the model expanded them



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
CompactRegressionNeuralNetwork.LayerBiases


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 175
CompactRegressionNeuralNetwork: property LayerBiases

Biases the network learned

A cell array with one entry per layer, the output layer included. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
Biases the network learned



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
CompactRegressionNeuralNetwork.LayerSizes


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 181
CompactRegressionNeuralNetwork: property LayerSizes

Sizes of the fully connected hidden layers

A row vector of positive integers, one per hidden layer. This property
is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Sizes of the fully connected hidden layers



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
CompactRegressionNeuralNetwork.LayerWeights


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 177
CompactRegressionNeuralNetwork: property LayerWeights

Weights the network learned

A cell array with one entry per layer, the output layer included. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Weights the network learned



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
CompactRegressionNeuralNetwork.Mu


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 218
CompactRegressionNeuralNetwork: property Mu

Mean of the predictors

A row vector with one entry per predictor, used for standardization.
Empty when the predictor data were not standardized. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Mean of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 44
CompactRegressionNeuralNetwork.NumPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 132
CompactRegressionNeuralNetwork: property NumPredictors

Number of predictors

A positive integer scalar. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Number of predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 52
CompactRegressionNeuralNetwork.OutputLayerActivation


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 229
CompactRegressionNeuralNetwork: property OutputLayerActivation

Activation function of the output layer

A character vector. 'none' applies the identity, so a
prediction is an unrestricted real number. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
Activation function of the output layer



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
CompactRegressionNeuralNetwork.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 144
CompactRegressionNeuralNetwork: property PredictorNames

Names of the predictors

A cell array of character vectors. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
Names of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
CompactRegressionNeuralNetwork.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 133
CompactRegressionNeuralNetwork: property ResponseName

Name of the response variable

A character vector. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Name of the response variable



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
CompactRegressionNeuralNetwork.ResponseTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 277
CompactRegressionNeuralNetwork: property ResponseTransform

Transformation applied to the predicted response

A function handle, applied by predict to the network&rsquo;s output.
It may be set after construction, either to a handle or to the name of
a supported transformation.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Transformation applied to the predicted response



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
CompactRegressionNeuralNetwork.Sigma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 235
CompactRegressionNeuralNetwork: property Sigma

Standard deviation of the predictors

A row vector with one entry per predictor, used for standardization.
Empty when the predictor data were not standardized. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
Standard deviation of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
CompactRegressionNeuralNetwork.loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 981
CompactRegressionNeuralNetwork: L = loss ( obj , X , Y )
CompactRegressionNeuralNetwork: L = loss (&hellip;, name , value )

Compute the regression loss of a compact neural network model.

L = loss ( obj , X , Y ) returns the
weighted mean squared error between the response Y and the
response the model predicts for X .

obj must be a CompactRegressionNeuralNetwork class object.

X must be a numeric matrix with the same number of predictors as
the data the model was trained on.

Y must be a numeric vector with as many rows as X .

L = loss (&hellip;, 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


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 62
Compute the regression loss of a compact neural network model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
CompactRegressionNeuralNetwork.predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 538
CompactRegressionNeuralNetwork: yFit = predict ( obj , XC )

Predict the response for new data with a compact neural network
regression model.

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.

obj must be a CompactRegressionNeuralNetwork class object.

XC must be a numeric matrix with the same number of predictors as
the data the model was trained on.

See also:
CompactRegressionNeuralNetwork,
RegressionNeuralNetwork


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 81
Predict the response for new data with a compact neural network regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
CompactRegressionNeuralNetwork.savemodel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 349
CompactRegressionNeuralNetwork: savemodel ( obj , filename )

Save a compact neural network regression model to a file.

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


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 57
Save a compact neural network regression model to a file.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
CompactRegressionSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 852
statistics: CompactRegressionSVM

Compact Support Vector Machine regression

A CompactRegressionSVM object holds a support vector regression
model that has dropped its training data.

Create a CompactRegressionSVM object by using the compact
method of a RegressionSVM object.

The compact model keeps what is needed to answer about new data, the
support vectors and their coefficients, the intercept, the kernel, 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 observation count, and which training rows became support
vectors. 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:
RegressionSVM,
fitrsvm


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Compact Support Vector Machine regression



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
CompactRegressionSVM.Alpha


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 219
CompactRegressionSVM: property Alpha

Dual coefficients of the support vectors

A numeric column vector with one entry per support vector, signed, as
in the model this one was compacted from. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
Dual coefficients of the support vectors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
CompactRegressionSVM.Beta


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 216
CompactRegressionSVM: property Beta

Primal coefficients, one per predictor

A numeric column vector, equal to
obj.SupportVectors' * obj.Alpha , and empty for any kernel other
than linear. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
Primal coefficients, one per predictor



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
CompactRegressionSVM.Bias


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 181
CompactRegressionSVM: property Bias

Intercept of the fitted function

A numeric scalar. With a linear kernel the prediction is
X * obj.Beta + obj.Bias . This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Intercept of the fitted function



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
CompactRegressionSVM.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 180
CompactRegressionSVM: property CategoricalPredictors

Indices of the categorical predictors

A numeric vector of column indices, and empty when none is. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
CompactRegressionSVM.CompactRegressionSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 405
CompactRegressionSVM: obj = CompactRegressionSVM ( Mdl )
CompactRegressionSVM: obj = CompactRegressionSVM ()

Create a CompactRegressionSVM object.

Mdl is the RegressionSVM object to
compact. The documented way to reach this constructor is the
compact method.

Called with no arguments it returns an object with its properties
empty, which is how a saved model is rebuilt before its values are
filled in.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Create a CompactRegressionSVM object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
CompactRegressionSVM.Epsilon


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 241
CompactRegressionSVM: property Epsilon

Half-width of the insensitive tube

A non-negative scalar, carried over from the model this one was
compacted from. It is what the 'epsiloninsensitive' loss
charges against. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
Half-width of the insensitive tube



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
CompactRegressionSVM.ExpandedPredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 169
CompactRegressionSVM: property ExpandedPredictorNames

Names of the predictors as the model expanded them

A cell array of character vectors. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
Names of the predictors as the model expanded them



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
CompactRegressionSVM.KernelParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 311
CompactRegressionSVM: property KernelParameters

Parameters of the kernel function

A structure with fields Function and Scale , and
Order for a polynomial kernel. Function names the
kernel as MATLAB names it, so a radial basis kernel reports
'gaussian' whichever spelling was given. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
Parameters of the kernel function



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
CompactRegressionSVM.Mu


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 208
CompactRegressionSVM: property Mu

Mean of the predictors

A row vector with one entry per predictor, used for standardization.
Empty when the predictor data were not standardized. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Mean of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
CompactRegressionSVM.NumPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 122
CompactRegressionSVM: property NumPredictors

Number of predictors

A positive integer scalar. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Number of predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
CompactRegressionSVM.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 134
CompactRegressionSVM: property PredictorNames

Names of the predictors

A cell array of character vectors. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
Names of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
CompactRegressionSVM.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 123
CompactRegressionSVM: property ResponseName

Name of the response variable

A character vector. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Name of the response variable



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
CompactRegressionSVM.ResponseTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 265
CompactRegressionSVM: property ResponseTransform

Transformation applied to the predicted response

A function handle, applied by predict to the model&rsquo;s output. It
may be set after construction, either to a handle or to the name of a
supported transformation.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Transformation applied to the predicted response



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
CompactRegressionSVM.Sigma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 225
CompactRegressionSVM: property Sigma

Standard deviation of the predictors

A row vector with one entry per predictor, used for standardization.
Empty when the predictor data were not standardized. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
Standard deviation of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
CompactRegressionSVM.SupportVectors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 195
CompactRegressionSVM: property SupportVectors

The support vectors themselves

A numeric matrix with one row per support vector, on the scale the
model was trained on. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
The support vectors themselves



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
CompactRegressionSVM.discardSupportVectors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 598
CompactRegressionSVM: obj = discardSupportVectors ( obj )

Discard the support vectors of a linear SVM model.

obj = discardSupportVectors ( obj ) empties
Alpha and SupportVectors , leaving Beta and
Bias to decide every prediction. A linear kernel needs
nothing else, so the returned model predicts what it predicted
before while carrying one vector in place of many.

The kernel must be linear. Under any other the support vectors are
part of the decision function and cannot be dropped. Discarding twice
is not an error and changes nothing.

See also:
fitrsvm,
RegressionSVM,
CompactRegressionSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
Discard the support vectors of a linear SVM model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
CompactRegressionSVM.loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 958
CompactRegressionSVM: L = loss ( obj , X , Y )
CompactRegressionSVM: L = loss (&hellip;, name , value )

Compute the regression loss of a compact support vector machine model.

L = loss ( obj , X , Y ) returns the
weighted mean squared error between the response Y and the
response the model predicts for X .

obj must be a CompactRegressionSVM class object.

X must be a numeric matrix with the same number of predictors as
the data the model was trained on.

Y must be a numeric vector with as many rows as X .

L = loss (&hellip;, name , value ) accepts the
following Name-Value pairs.

Name Value
'LossFun' 'mse' , the default,
'epsiloninsensitive' , or a function handle called as
lossfun ( Y , yFit , W ) 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:
CompactRegressionSVM,
RegressionSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 70
Compute the regression loss of a compact support vector machine model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
CompactRegressionSVM.predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 498
CompactRegressionSVM: yFit = predict ( obj , XC )

Predict the response for new data with a compact support vector
regression model.

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.

obj must be a CompactRegressionSVM class object.

XC must be a numeric matrix with the same number of predictors as
the data the model was trained on.

See also:
CompactRegressionSVM,
RegressionSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 81
Predict the response for new data with a compact support vector regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
CompactRegressionSVM.savemodel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 319
CompactRegressionSVM: savemodel ( obj , filename )

Save a compact support vector regression model to a file.

savemodel ( obj , filename ) saves every property of
the CompactRegressionSVM object obj into filename
in binary format, so that it can be read back with loadmodel .

See also:
loadmodel,
CompactRegressionSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 57
Save a compact support vector regression model to a file.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
RegressionGAM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6392
statistics: obj = RegressionGAM ( X , Y )
statistics: obj = RegressionGAM (&hellip;, name , value )

Create a RegressionGAM class object containing a Generalized Additive
Model (GAM) for regression.

A RegressionGAM class object can store the predictors and response
data along with various parameters for the GAM model. It is recommended to
use the fitrgam function to create a RegressionGAM object.

obj = RegressionGAM ( X , Y ) returns an object of
class RegressionGAM, with matrix X containing the predictor data and
vector Y containing the continuous response data.

X must be a N&times;P numeric matrix of input data where rows
correspond to observations and columns correspond to features or variables.
X will be used to train the GAM model.

Y must be N&times;1 numeric vector containing the response data
corresponding to the predictor data in X . Y must have same
number of rows as X .

obj = RegressionGAM (&hellip;, name , value ) returns
an object of class RegressionGAM with additional properties specified by
Name-Value pair arguments listed below.

Name Value
'predictors' Predictor Variable names, specified as
a row vector cell of strings with the same length as the columns in X .
If omitted, the program will generate default variable names
(x1, x2, ..., xn) for each column in X .
'responsename' Response Variable Name, specified as
a string. If omitted, the default value is 'Y' .
'formula' (spline option) a model specification given as a
string in
the form 'Y ~ terms' where Y represents the response variable
and terms the predictor variables. The formula can be used to
specify a subset of variables for training model. For example:
'Y ~ x1 + x2 + x3 + x4 + x1:x2 + x2:x3' specifies four linear terms
for the first four columns of for predictor data, and x1:x2 and
x2:x3 specify the two interaction terms for 1st-2nd and 3rd-4th
columns respectively. Only these terms will be used for training the model,
but X must have at least as many columns as referenced in the formula.
If Predictor Variable names have been defined, then the terms in the formula
must reference to those. When 'formula' is specified, all terms used
for training the model are referenced in the IntMatrix field of the
obj class object as a matrix containing the column indexes for each
term including both the predictors and the interactions used.
'interactions' a logical matrix, a positive integer
scalar, or the string 'all' for defining the interactions between
predictor variables. When given a logical matrix, it must have the same
number of columns as X and each row corresponds to a different
interaction term combining the predictors indexed as true . Each
interaction term is appended as a column vector after the available predictor
column in X . When 'all' is defined, then all possible
combinations of interactions are appended in X before training. At the
moment, parsing a positive integer has the same effect as the 'all'
option. When 'interactions' is specified, only the interaction terms
appended to X are referenced in the IntMatrix field of the
obj class object.
'knots' (spline option) a scalar or a row vector with the
same
columns as X . It defines the knots for fitting a polynomial when
training the GAM. As a scalar, it is expanded to a row vector. The default
value is 5, hence expanded to ones (1, columns (X)) * 5 . You can
parse a row vector with different number of knots for each predictor
variable to be fitted with, although not recommended.
'order' (spline option) a scalar or a row vector with the
same
columns as X . It defines the order of the polynomial when training the
GAM. As a scalar, it is expanded to a row vector. The default values is 3,
hence expanded to ones (1, columns (X)) * 3 . You can parse a row
vector with different number of polynomial order for each predictor variable
to be fitted with, although not recommended.
'dof' (spline option) a scalar or a row vector with the
same columns
as X . It defines the degrees of freedom for fitting a polynomial when
training the GAM. As a scalar, it is expanded to a row vector. The default
value is 8, hence expanded to ones (1, columns (X)) * 8 . You can
parse a row vector with different degrees of freedom for each predictor
variable to be fitted with, although not recommended.
'tol' (spline option) a positive scalar to set the
tolerance for
convergence during training. By default, it is set to 1e-3 .

A row marked (spline option) belongs to the spline
engine and requires 'FitMethod', 'splines' ; passing one
under the default boosted-tree engine is an error rather than
being ignored. The boosted-tree engine&rsquo;s own options are
documented under fitrgam .

You can parse either a 'formula' or an 'interactions'
optional parameter. Parsing both parameters will result an error.
Accordingly, you can only pass up to two parameters among 'knots' ,
'order' , and 'dof' to define the required polynomial for
training the GAM model.

Two weak learners are available, selected by FitMethod .

'boostedtrees' , the default, boosts one shallow decision tree per
predictor in each round, which is the scheme MATLAB&rsquo;s generalized additive
model uses. A second phase then boosts trees over pairs of predictors,
where interactions are asked for.

'splines' boosts a smoothing spline per predictor until the
residual sum of squares changes by less than 'Tol' . It has no
MATLAB counterpart and is an Octave extension, kept because a smooth
additive fit is a genuinely different and often better answer than a
staircase of stumps. A standard deviation and a prediction interval are
available from it alone.

The two take different arguments, and an argument meant for one is refused
by the other rather than ignored.

The choice is visible in the properties. Knots , Order ,
DoF , Formula , Tol , BaseModel ,
ModelwInt and IntMatrix describe a spline fit and are empty
under the boosted-tree engine, while ModelParameters ,
ReasonForTermination , BinEdges ,
PairDetectionBinEdges and TreeModel describe a tree fit and
are empty under the spline engine.

Fitted values are not expected to equal MATLAB&rsquo;s even under
'boostedtrees' . The stopping rule and the step-reduction limit are
not recoverable from anything MATLAB reports, so this engine documents its
own; what the two share is the estimator and the reported surface, not the
arithmetic.

See also:
fitrgam,
regress,
regress_gp


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 97
Create a RegressionGAM class object containing a Generalized Additive Model (GAM) for regression.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
RegressionGAM.BaseModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 301
RegressionGAM: property BaseModel

Model without interaction terms

A structure holding the intercept, the piecewise polynomial of each
predictor, the number of backfitting cycles, the residuals and the
residual sum of squares of the model fitted without interaction
terms. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Model without interaction terms



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
RegressionGAM.BinEdges


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 471
RegressionGAM: property BinEdges

Bin edges of the predictors

A cell array with one entry per predictor, holding that predictor&rsquo;s bin
edges where the model discretized it before fitting. It is empty here
and stays empty: this generalized additive model is built from splines,
which take the predictors as they are, where MATLAB&rsquo;s is built from
boosted trees and bins them. That difference is described in the class
documentation.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Bin edges of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
RegressionGAM.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 215
RegressionGAM: property CategoricalPredictors

Indices of the categorical predictors

A numeric vector holding the column of each predictor treated as
categorical, and empty when none is. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
RegressionGAM.DoF


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 191
RegressionGAM: property DoF

Degrees of freedom of the spline fitting

A numeric vector with one entry per predictor, the sum of its number
of knots and its order. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
Degrees of freedom of the spline fitting



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
RegressionGAM.ExpandedPredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 290
RegressionGAM: property ExpandedPredictorNames

Names of the expanded predictor variables

A cell array of character vectors naming the predictors as the model
sees them. It matches PredictorNames unless a categorical
predictor was expanded into dummy variables. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Names of the expanded predictor variables



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
RegressionGAM.FitMethod


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 507
RegressionGAM: property FitMethod

Which engine fitted the model

A character vector, either 'boostedtrees' or
'splines' . The default is 'boostedtrees' , the scheme
MATLAB&rsquo;s generalized additive model uses. 'splines' selects
the penalised-spline engine, an Octave extension with no MATLAB
counterpart and the scheme this class fitted before version 1.9.0. The
two engines take different arguments and an argument meant for one is
refused by the other rather than ignored.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Which engine fitted the model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
RegressionGAM.Formula


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 222
RegressionGAM: property Formula

Formula of the model

A character vector naming the response and the terms of the model, as
in 'Y ~ x1 + x2 + x1:x2' , or empty when the model was not
given one. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Formula of the model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
RegressionGAM.HyperparameterOptimizationResults


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 356
RegressionGAM: property HyperparameterOptimizationResults

Results of the hyperparameter optimization

Always empty. It is declared for MATLAB compatibility, where
it holds what an automatic search over the hyperparameters found. This
class fits the parameters it is given and runs no such search, so there
is nothing to report. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Results of the hyperparameter optimization



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
RegressionGAM.IntMatrix


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 553
RegressionGAM: property IntMatrix

Every term the model fits

A logical matrix with one row per term and one column per predictor,
true wherever the term multiplies that predictor. A row naming one
predictor is a main effect, two an interaction, and three or more a
higher-order term. This property is read-only.

It is the complete record, where Interactions reports only the
two-way terms, in the form MATLAB reports them. It is also the form
the 'Interactions' option takes back, so passing it to the
constructor rebuilds a model over the same terms.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
Every term the model fits



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
RegressionGAM.Interactions


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 594
RegressionGAM: property Interactions

Two-way interaction terms of the fitted model

A Kx2 matrix of predictor index pairs, one row per two-way term
the model carries, and zeros (0, 2) when it carries none. It
reports what was fitted rather than what was asked for, so a count of
terms, 'all' , a logical matrix and a formula all leave the same
kind of value behind. This property is read-only.

A main effect names one predictor and a higher-order term names three
or more, and neither has a two-column form, so neither appears here.
IntMatrix remains the complete record of every term fitted.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
Two-way interaction terms of the fitted model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
RegressionGAM.Intercept


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 184
RegressionGAM: property Intercept

Intercept of the fitted model

A numeric scalar, the mean of the response, which every additive term
is measured against. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Intercept of the fitted model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
RegressionGAM.IsStandardDeviationFit


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 279
RegressionGAM: property IsStandardDeviationFit

Flag for a fitted standard deviation model

A boolean flag, always false , as this class estimates the
standard deviation of a prediction from the residuals of the fit
rather than fitting a model for it. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Flag for a fitted standard deviation model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
RegressionGAM.Knots


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 200
RegressionGAM: property Knots

Knots of the spline fitting

A numeric vector with one entry per predictor, the number of breaks
the spline of that predictor is fitted over. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Knots of the spline fitting



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
RegressionGAM.ModelParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 359
RegressionGAM: property ModelParameters

Parameters the model was fitted with

A structure holding the fitting parameters. Under the boosted-tree
engine it carries MATLAB&rsquo;s own fields, with Type reading
'regression' ; under the spline engine it describes that scheme
instead, since none of the tree vocabulary applies to it.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
Parameters the model was fitted with



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
RegressionGAM.ModelwInt


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 222
RegressionGAM: property ModelwInt

Model with interaction terms

A structure of the same fields as BaseModel , for the model
fitted with the interaction terms, and empty when none was asked for.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
Model with interaction terms



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
RegressionGAM.NumObservations


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 220
RegressionGAM: property NumObservations

Number of observations

A positive integer, the number of observations of the training data
the model was fitted on, rows with missing values excluded. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Number of observations



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
RegressionGAM.NumPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 155
RegressionGAM: property NumPredictors

Number of predictors

A positive integer, the number of predictors of the training data.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Number of predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
RegressionGAM.Order


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 188
RegressionGAM: property Order

Order of the spline fitting

A numeric vector with one entry per predictor, the polynomial order of
the spline of that predictor. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Order of the spline fitting



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
RegressionGAM.PairDetectionBinEdges


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 483
RegressionGAM: property PairDetectionBinEdges

Bin edges used to detect interactions

A cell array with one row vector per predictor, holding the coarse cut
points the residuals of the predictor phase were laid on while pairs
were being tested. The grid is eight equal-frequency bins whatever the
sample size, as MATLAB&rsquo;s is. It is empty when the model carries no
interaction terms, and empty throughout under the spline engine, which
does not bin.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Bin edges used to detect interactions



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
RegressionGAM.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 205
RegressionGAM: property PredictorNames

Names of the predictor variables

A cell array of character vectors naming the predictors, in the order
they appear in the training data. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Names of the predictor variables



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
RegressionGAM.ReasonForTermination


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 338
RegressionGAM: property ReasonForTermination

Why each fitting phase stopped

A structure with the fields PredictorTrees and
InteractionTrees , each saying why that phase ended. A phase
that never ran reports an empty character vector. It is empty under
the spline engine, which has no tree budget to exhaust.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
Why each fitting phase stopped



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
RegressionGAM.RegressionGAM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 542
RegressionGAM: obj = RegressionGAM ( X , Y )
RegressionGAM: obj = RegressionGAM (&hellip;, name , value )

Fit a generalized additive model for regression.

X is an N&times;P numeric matrix of predictor data, one
observation per row, and Y is the continuous response of those
N observations. The fit runs at construction, so obj
arrives fitted.

The name / value pairs the fit accepts, and the validation
each one is held to, are listed in help RegressionGAM .
fitrgam is the documented way to reach this constructor and
takes the same pairs.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Fit a generalized additive model for regression.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
RegressionGAM.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 141
RegressionGAM: property ResponseName

Response variable name

A character vector naming the response variable Y . This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Response variable name



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
RegressionGAM.ResponseTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 313
RegressionGAM: property ResponseTransform

Transformation applied to the predicted response

A function handle applied to the response the model predicts. Add or
change it using dot notation, as in
obj .ResponseTransform = 'log' or
obj .ResponseTransform = @function_handle . It defaults
to 'none' , the identity.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Transformation applied to the predicted response



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
RegressionGAM.RowsUsed


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 378
RegressionGAM: property RowsUsed

Rows used for fitting

A logical column vector with the same length as the observations in the
original predictor data X , true for each row that was used for
fitting the RegressionGAM model. It is empty, [] ,
when every observation was used, so a non-empty value means that rows
holding missing values were dropped. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
Rows used for fitting



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
RegressionGAM.Tol


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 201
RegressionGAM: property Tol

Tolerance for convergence

A positive scalar, the largest change in the residual sum of squares
of a backfitting cycle that counts as converged. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
Tolerance for convergence



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
RegressionGAM.TreeModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 420
RegressionGAM: property TreeModel

The fitted shape functions and interaction surfaces

A structure with fields ShapeValues , PairValues and
Pairs , holding what the boosted-tree engine fitted. MATLAB
exposes no equivalent, reporting its bin edges but never the values on
them, so this is an Octave extension. It is empty under the spline
engine, whose fit lives in BaseModel and ModelwInt .

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51
The fitted shape functions and interaction surfaces



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
RegressionGAM.W


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 175
RegressionGAM: property W

Observation weights

A numeric column vector with one entry per observation used for
training, normalised to sum to one. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
Observation weights



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
RegressionGAM.X


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 167
RegressionGAM: property X

Predictor data

A numeric matrix with one row per observation and one column per
predictor of the training data. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
Predictor data



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
RegressionGAM.Y


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 146
RegressionGAM: property Y

Response data

A numeric column vector with one entry per observation of the
training data. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
Response data



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
RegressionGAM.addInteractions


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1079
RegressionGAM: obj = addInteractions ( obj , interactions )

Add interaction terms to a fitted model.

obj = addInteractions ( obj , interactions ) fits
the interaction terms named by interactions on top of the terms
the model already carries and returns the updated model. The univariate
fit is left alone, so predict with
'IncludeInteractions' set false answers exactly as it
answered before.

interactions takes the forms the constructor&rsquo;s
'Interactions' option takes: a nonnegative integer count of
terms, a logical matrix with a column per predictor, or 'all' .

A model already carrying interaction terms is not extended, which is
what MATLAB refuses too. A model fitted from a 'Formula' names
every term it has, interactions among them, and is refused for the same
reason.

Which terms a count selects is this implementation&rsquo;s own: they are
taken in the order nchoosek lists the pairs, where MATLAB ranks
them by how much each contributes. The constructor&rsquo;s option chooses
the same way, so the two agree with each other.

See also:
fitrgam,
RegressionGAM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
Add interaction terms to a fitted model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
RegressionGAM.compact


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 250
RegressionGAM: CMdl = compact ( obj )

Create a CompactRegressionGAM object.

CMdl = compact ( obj ) returns a compact version of
the model, which predicts as it does but keeps no training data.

See also:
RegressionGAM,
CompactRegressionGAM,
fitrgam


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Create a CompactRegressionGAM object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
RegressionGAM.crossval


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1041
RegressionGAM: CVMdl = crossval ( obj )
RegressionGAM: CVMdl = crossval (&hellip;, name , value )

Cross validate a Generalized Additive Model regression object.

CVMdl = crossval ( obj ) returns a cross-validated
model object, CVMdl , from a trained model, obj , using
10-fold cross-validation by default.

CVMdl = crossval ( obj , name , value )
specifies additional name-value pair arguments to customize the
cross-validation process.

Name Value
'KFold' Specify the number of folds to use in
k-fold cross-validation. "KFold", k , where k is an
integer greater than 1.
'Holdout' Specify the fraction of the data to
hold out for testing. "Holdout", p , where p is a
scalar in the range (0,1) .
'Leaveout' Specify whether to perform
leave-one-out cross-validation. "Leaveout", Value , where
Value is &rsquo;on&rsquo; or &rsquo;off&rsquo;.
'CVPartition' Specify a cvpartition
object used for cross-validation. "CVPartition", cv ,
where isa ( cv , "cvpartition") = 1.

See also:
fitrgam,
RegressionGAM,
cvpartition,
RegressionPartitionedModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 62
Cross validate a Generalized Additive Model regression object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
RegressionGAM.loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 650
RegressionGAM: L = loss ( obj , X , Y )
RegressionGAM: L = loss (&hellip;, name , value )

Regression loss of a generalized additive model.

L = loss ( obj , X , Y ) returns the weighted
mean squared error of the model on the rows of X against the true
response Y .

L = loss (&hellip;, name , value ) accepts the
following name-value pairs:

"LossFun" selects the loss, either "mse" , the default,
or a function handle taking the true response, the predicted response
and the weights, and returning a numeric scalar.

"Weights" holds one weight per row of X , normalised to
sum to one before it is applied.

See also:
RegressionGAM,
fitrgam,
predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Regression loss of a generalized additive model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
RegressionGAM.predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1690
RegressionGAM: yFit = predict ( obj , Xfit )
RegressionGAM: yFit = predict (&hellip;, Name , Value )
RegressionGAM: [ yFit , ySD , yInt ] = predict (&hellip;)

Predict new data points using generalized additive model regression
object.

yFit = predict ( obj , Xfit returns a vector of
predicted responses, yFit , for the predictor data in matrix
Xfit based on the Generalized Additive Model in obj .
Xfit must have the same number of features/variables as the
training data in obj .

obj must be a RegressionGAM class object.

[ yFit , ySD , yInt ] = predict ( obj ,
Xfit
also returns the standard deviations, ySD , and prediction
intervals,
yInt , of the response variable yFit , evaluated at each
observation in the predictor data Xfit .

yFit = predict (&hellip;, Name , Value ) returns
the
aforementioned results with additional properties specified by
Name-Value pair arguments listed below.

Name Value
'alpha' significance level of the prediction
intervals yInt , specified as scalar in range [0,1] . The
default value is 0.05, which corresponds to 95% prediction intervals.
'includeinteractions' a boolean flag to include
interactions to predict new values based on Xfit . By default,
'includeinteractions' is true when the GAM model in
obj
contains a obj.Formula or obj.Interactions fields.
Otherwise, is set to false . If set to true when no
interactions are present in the trained model, it will result to an
error. If set to
false when using a model that includes interactions, the
predictions
will be made on the basic model without any interaction terms. This way
you can make predictions from the same GAM model without having to
retrain it.

See also:
fitrgam,
RegressionGAM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 75
Predict new data points using generalized additive model regression object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
RegressionGAM.resubLoss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 355
RegressionGAM: L = resubLoss ( obj )
RegressionGAM: L = resubLoss (&hellip;, name , value )

Regression loss of a generalized additive model on its training data.

L = resubLoss ( obj ) returns the weighted mean
squared error of the model on the data it was fitted on. It accepts
the same Name-Value pairs as loss .

See also:
RegressionGAM,
fitrgam,
loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 69
Regression loss of a generalized additive model on its training data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
RegressionGAM.resubPredict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 242
RegressionGAM: yFit = resubPredict ( obj )

Predict the training response with the model it was fitted on.

yFit = resubPredict ( obj ) is predict applied
to the observations the model was fitted on.

See also:
RegressionGAM,
fitrgam,
predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 62
Predict the training response with the model it was fitted on.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
RegressionGAM.resume


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 931
RegressionGAM: Mdl = resume ( obj , numTrees )

Resume training a generalized additive model.

Mdl = resume ( obj , numTrees ) adds
numTrees more trees to obj and returns the result. The
original model is not modified.

Training continues in the phase that ran last, which is what MATLAB
does: a model carrying interaction terms gains interaction trees and
its predictor shape functions are left alone, while a model without
them gains predictor trees. A round starts at its initial learning
rate whatever its number, so the model this returns is the model a
single fit of the combined budget would have produced.

numTrees must be a positive integer scalar. Resuming raises
where there is nothing left to gain, rather than returning the model
unchanged, and it is not available under
'FitMethod', 'splines' : a backfit that has converged to its
tolerance has no budget to extend.

See also:
RegressionGAM,
fitrgam,
addInteractions


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
Resume training a generalized additive model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
RegressionGAM.savemodel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 211
RegressionGAM: savemodel ( obj , filename )

Save a RegressionGAM object.

savemodel ( obj , filename ) saves a RegressionGAM
object into a file defined by filename .

See also:
loadmodel,
fitrgam,
RegressionGAM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
Save a RegressionGAM object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
RegressionGP


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 5099
statistics: obj = RegressionGP ( X , Y )
statistics: obj = RegressionGP (&hellip;, name , value )

Create a RegressionGP object containing a Gaussian process
regression model.

obj = RegressionGP ( X , Y ) returns a Gaussian
process regression model, obj , with X being the predictor data
and Y the continuous response of the observations in X .

X must be an NxP numeric matrix of predictor data, where rows
correspond to observations and columns to features.

Y must be an Nx1 numeric vector holding the response of the
corresponding predictor data in X . Y must have the same number
of rows as X .

A Gaussian process places a prior over functions, given by the covariance
function, and conditions it on the observations. The response is modelled
as H&times;Beta plus a draw from that process plus independent noise of
standard deviation Sigma , where H is the explicit basis. The
covariance parameters and Sigma are estimated by maximizing the log
marginal likelihood, and Beta follows from them in closed form as
the generalized least squares estimate.

obj = RegressionGP (&hellip;, name , value ) returns a
model with additional options specified by Name-Value pair
arguments listed below.

Name Value
'KernelFunction' A character vector naming the covariance
function, or a function handle taking two matrices of points and a parameter
vector. The default is 'squaredexponential' . The supported names
are listed below.
'KernelParameters' A numeric vector of initial values for
the covariance parameters. Its length depends on the covariance function.
These are starting values for the optimization, not fixed values.
'BasisFunction' A character vector naming the explicit
basis, one of 'none' , 'constant' , 'linear' or
'pureQuadratic' , or a function handle taking X and returning
the basis matrix. The default is 'constant' .
'Beta' A numeric vector of basis coefficients. These are
used as known values only when 'FitMethod' is 'none' .
'Sigma' A positive scalar, the initial value of the noise
standard deviation. The default is std ( Y ) / sqrt (2) .
'ConstantSigma' A logical scalar. When true the
noise standard deviation is held at its initial value instead of being
estimated. The default is false .
'SigmaLowerBound' A positive scalar bounding the noise
standard deviation from below. The default is
1e-2 * std ( Y ) .
'FitMethod' A character vector, either 'exact' to
estimate the parameters or 'none' to keep them at their initial
values. The default is 'exact' .
'PredictMethod' A character vector. Only 'exact'
is implemented, which is also the only method under which a standard
deviation and a prediction interval are available.
'Optimizer' A character vector naming the optimizer used
to maximize the log marginal likelihood. 'quasinewton' and
'fminunc' name the same dense solver and are the default,
'lbfgs' selects limited-memory BFGS, which holds a fixed number of
curvature pairs rather than a full inverse Hessian and is the cheaper
choice when the kernel carries many parameters, and 'fminsearch'
is derivative-free.
'Standardize' A logical scalar specifying whether the
predictor data should be centred and scaled before training. The same
transformation is applied by predict . The default is false .
'Weights' An Nx1 numeric vector of non-negative
observation weights. The default is a vector of ones.
'PredictorNames' A cell array of character vectors
naming the predictors, in the order they appear in X .
'ResponseName' A character vector naming the response.
The default is 'Y' .
'ResponseTransform' A character vector or a function
handle applied to the response the model predicts. The default is
'none' .

The supported values for 'KernelFunction' are:

Value Parameters
'exponential' [SigmaL; SigmaF]
'squaredexponential' [SigmaL; SigmaF]
'matern32' [SigmaL; SigmaF]
'matern52' [SigmaL; SigmaF]
'rationalquadratic' [SigmaL; AlphaRQ; SigmaF]
'ardexponential' [LengthScale1; &hellip;; SigmaF]
'ardsquaredexponential' [LengthScale1; &hellip;; SigmaF]
'ardmatern32' [LengthScale1; &hellip;; SigmaF]
'ardmatern52' [LengthScale1; &hellip;; SigmaF]
'ardrationalquadratic' [LengthScale1; &hellip;; AlphaRQ; SigmaF]

The automatic relevance determination kernels carry one length scale per
predictor, so a predictor the response does not depend on is given a large
length scale and stops contributing.

The supported values for 'ResponseTransform' are:

Value Description
'none' x (no transformation)
'identity' x (no transformation)
'exp' exp (x)
'log' log (x)

Two deviations from MATLAB are deliberate and documented. The distance
between points is accumulated one predictor at a time instead of by the
expanded form MATLAB uses by default, because the expanded form does not
return exactly zero for a point against itself and the rough kernels
amplify that residue through their square root. The approximate fitting
and prediction methods, 'sd' , 'sr' , 'fic' and
'bcd' , together with the active set options that serve them, are
not implemented and are refused rather than silently ignored.

See also:
fitrgp,
CompactRegressionGP,
RegressionSVM,
RegressionGAM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 76
Create a RegressionGP object containing a Gaussian process regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
RegressionGP.ActiveSetHistory


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 393
RegressionGP: property ActiveSetHistory

History of the active set selection

Always empty. It is declared for MATLAB compatibility, where
it records the active set chosen at each iteration by a fit method that
builds one. This class implements the exact method alone, which uses
the whole of the training data and selects nothing, so there is no
history to record. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
History of the active set selection



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
RegressionGP.ActiveSetMethod


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 116
RegressionGP: property ActiveSetMethod

Method used to select the active set

'Random' . This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
Method used to select the active set



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
RegressionGP.ActiveSetSize


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 116
RegressionGP: property ActiveSetSize

Size of the active set

A positive integer scalar. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Size of the active set



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
RegressionGP.ActiveSetVectors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 281
RegressionGP: property ActiveSetVectors

Subset of the training data used for predictions

An MxP numeric matrix, standardized where the model standardized
its predictors. It is the whole of the training data, since only the
exact method is implemented. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Subset of the training data used for predictions



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
RegressionGP.Alpha


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 231
RegressionGP: property Alpha

Weights the predictions are made from

An Nx1 numeric vector. A prediction is the basis term plus the
covariance between the new point and the active set, weighted by these.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Weights the predictions are made from



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
RegressionGP.BCDInformation


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 272
RegressionGP: property BCDInformation

Block coordinate descent information

Always empty. It is declared for MATLAB compatibility, where
it records a block coordinate descent. This class does not use that
method, so there is nothing to report. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
Block coordinate descent information



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
RegressionGP.BasisFunction


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 187
RegressionGP: property BasisFunction

Explicit basis of the model

'None' , 'Constant' , 'Linear' ,
'PureQuadratic' , or the function handle that was supplied. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Explicit basis of the model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
RegressionGP.Beta


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 185
RegressionGP: property Beta

Estimated coefficients of the explicit basis

A numeric vector with one element per basis term, empty when the basis
is 'None' . This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 44
Estimated coefficients of the explicit basis



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
RegressionGP.BinEdges


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 308
RegressionGP: property BinEdges

Bin edges of the predictors

A cell array with one entry per predictor, holding that predictor&rsquo;s bin
edges where the model discretized it before fitting. It is empty here
and stays empty: a Gaussian process takes its predictors as they are.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Bin edges of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
RegressionGP.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 227
RegressionGP: property CategoricalPredictors

Indices of the categorical predictors

A vector of positive integers indexing the columns of X that
hold categorical predictors, or empty when none does. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
RegressionGP.ExpandedPredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 254
RegressionGP: property ExpandedPredictorNames

Expanded predictor variable names

A cell array of character vectors. It differs from
PredictorNames only where a categorical predictor has been
expanded into indicator variables. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
Expanded predictor variable names



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
RegressionGP.FitMethod


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 268
RegressionGP: property FitMethod

Method used to estimate the parameters

'Exact' when the covariance parameters and the noise were
estimated by maximizing the log marginal likelihood, and 'None'
when they were kept at their initial values. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
Method used to estimate the parameters



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
RegressionGP.HyperparameterOptimizationResults


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 355
RegressionGP: property HyperparameterOptimizationResults

Results of the hyperparameter optimization

Always empty. It is declared for MATLAB compatibility, where
it holds what an automatic search over the hyperparameters found. This
class fits the parameters it is given and runs no such search, so there
is nothing to report. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Results of the hyperparameter optimization



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
RegressionGP.IsActiveSetVector


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 171
RegressionGP: property IsActiveSetVector

Which observations are in the active set

A logical vector with one element per training observation. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
Which observations are in the active set



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
RegressionGP.KernelFunction


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 192
RegressionGP: property KernelFunction

Form of the covariance function

A character vector naming the covariance function, or the function
handle that was supplied. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Form of the covariance function



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
RegressionGP.KernelInformation


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 245
RegressionGP: property KernelInformation

Covariance function and its parameters

A structure with fields Name , KernelParameters and
KernelParameterNames , the last naming each parameter in the
order they are stored. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
Covariance function and its parameters



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
RegressionGP.LogLikelihood


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 171
RegressionGP: property LogLikelihood

Maximized log marginal likelihood

A scalar, or empty when FitMethod is 'None' and nothing
was maximized. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
Maximized log marginal likelihood



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
RegressionGP.ModelParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1121
RegressionGP: property ModelParameters

Parameters used to train the model

A structure holding the options the fit was performed under. MATLAB
returns an object of its own class here; a structure carries the same
information and is what every other learner in this package returns.

Beta , Sigma and KernelParameters are the
starting values the fit was given, empty or zero where it was
given none, as they are in MATLAB. What the fit found is reported by
the Beta and Sigma properties and by
KernelInformation . Beta defaults to a zero for every
column the basis contributes, so a 'linear' basis over three
predictors starts at four zeros.

SigmaLowerBound is the exception and is reported as it was
resolved. MATLAB publishes no top-level field of that name, keeping
it inside an Options structure this class does not carry.

The fields MATLAB reports for its approximate fitting methods
( ActiveSet , Options , OptimizerOptions ,
ConstantKernelParameters , InitialStepSize ,
InitialSigmaLowerBoundTolerance , Verbose and
CacheSize ) are absent, this class implementing exact fitting
alone. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
Parameters used to train the model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
RegressionGP.NumObservations


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 210
RegressionGP: property NumObservations

Number of observations used to train the model

A positive integer scalar, counting only the rows that survived the
removal of missing values. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
Number of observations used to train the model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
RegressionGP.PredictMethod


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 108
RegressionGP: property PredictMethod

Method used to make predictions

'Exact' . This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Method used to make predictions



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
RegressionGP.PredictorLocation


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 199
RegressionGP: property PredictorLocation

Means the predictors were centred by

A 1xP numeric vector when the model standardized its predictors,
and empty when it did not. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
Means the predictors were centred by



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
RegressionGP.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 149
RegressionGP: property PredictorNames

Predictor variable names

A cell array of character vectors, one per column of X . This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
Predictor variable names



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
RegressionGP.PredictorScale


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 209
RegressionGP: property PredictorScale

Standard deviations the predictors were scaled by

A 1xP numeric vector when the model standardized its predictors,
and empty when it did not. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Standard deviations the predictors were scaled by



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
RegressionGP.RegressionGP


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 528
RegressionGP: obj = RegressionGP ( X , Y )
RegressionGP: obj = RegressionGP (&hellip;, name , value )

Fit a Gaussian process regression model.

X is an N&times;P numeric matrix of predictor data, one
observation per row, and Y is the continuous response of those
N observations. The fit runs at construction, so obj
arrives fitted.

The name / value pairs the fit accepts, and the validation
each one is held to, are listed in help RegressionGP .
fitrgp is the documented way to reach this constructor and
takes the same pairs.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
Fit a Gaussian process regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
RegressionGP.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 108
RegressionGP: property ResponseName

Response variable name

A character vector. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Response variable name



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
RegressionGP.ResponseTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 197
RegressionGP: property ResponseTransform

Transformation applied to the predicted response

A character vector, or the text of the function handle that was
supplied. Assigning to it accepts either.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Transformation applied to the predicted response



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
RegressionGP.RowsUsed


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 244
RegressionGP: property RowsUsed

Rows of the original data used to train the model

A logical vector with one element per row of the data as supplied, true
where the row was used. It is empty when no row was dropped. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Rows of the original data used to train the model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
RegressionGP.Sigma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 112
RegressionGP: property Sigma

Estimated noise standard deviation

A positive scalar. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
Estimated noise standard deviation



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
RegressionGP.W


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 149
RegressionGP: property W

Observation weights

An Nx1 numeric vector, one weight per observation used to train
the model. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
Observation weights



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
RegressionGP.X


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 131
RegressionGP: property X

Predictor data

An NxP numeric matrix, as it was supplied to the constructor.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
Predictor data



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
RegressionGP.Y


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 130
RegressionGP: property Y

Response data

An Nx1 numeric vector, as it was supplied to the constructor.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
Response data



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
RegressionGP.compact


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 282
RegressionGP: CMdl = compact ( obj )

Return a compact Gaussian process regression model.

CMdl = compact ( obj ) returns a
CompactRegressionGP object holding what is needed to predict
and nothing else: the training data, the response and everything that
describes them are dropped.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51
Return a compact Gaussian process regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
RegressionGP.crossval


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 395
RegressionGP: CVMdl = crossval ( obj )
RegressionGP: CVMdl = crossval (&hellip;, name , value )

Cross validate a Gaussian process model.

CVMdl = crossval ( obj ) returns a
RegressionPartitionedModel built from the model obj by
ten-fold cross validation.

CVMdl = crossval (&hellip;, name , value ) accepts
'KFold' , 'Holdout' , 'Leaveout' and
'CVPartition' , of which at most one may be given.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
Cross validate a Gaussian process model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
RegressionGP.loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 472
RegressionGP: L = loss ( obj , X , Y )
RegressionGP: L = loss (&hellip;, name , value )

Compute the regression loss of a Gaussian process model.

L = loss ( obj , X , Y ) returns the mean
squared error of the model obj on the data X and Y .

L = loss (&hellip;, name , value ) accepts
'LossFun' , either 'mse' , 'mae' ,
'epsiloninsensitive' or a function handle taking the observed
and the predicted response, and 'Weights' , a vector of
non-negative observation weights.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 56
Compute the regression loss of a Gaussian process model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
RegressionGP.postFitStatistics


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 571
RegressionGP: [ loores , neff ] = postFitStatistics ( obj )

Compute the leave-one-out residuals of a Gaussian process model.

[ loores , neff ] = postFitStatistics ( obj )
returns the Nx1 vector of leave-one-out residuals of the model
obj , and the number of effective parameters the fit uses. Neither
requires refitting the model: both follow from the factorization the fit
already produced.

The coefficients of the explicit basis are treated as estimated, which
is what FitMethod 'Exact' makes them, while the
covariance parameters and the noise are treated as known.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 64
Compute the leave-one-out residuals of a Gaussian process model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
RegressionGP.predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 954
RegressionGP: yFit = predict ( obj , XC )
RegressionGP: [ yFit , ySD , yInt ] = predict ( obj , XC )
RegressionGP: [&hellip;] = predict (&hellip;, 'Alpha' , alpha )

Predict the response for new data with a Gaussian process model.

yFit = predict ( obj , XC ) returns the predicted
response of the RegressionGP model obj at the points in
XC , which must have as many columns as the model has predictors.

[ yFit , ySD , yInt ] = predict (&hellip;) also
returns the standard deviation of each predicted response and the
prediction intervals. The standard deviation is that of a new
response , so it carries the noise as well as the uncertainty of
the latent function, and the interval is the normal quantile of the
level times it.

[&hellip;] = predict (&hellip;, 'Alpha' , alpha ) sets
the significance level of the intervals, so that they are
100 &times; (1 - alpha ) per cent intervals. alpha must be
a scalar in the range [0, 1] and defaults to 0.05 .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 64
Predict the response for new data with a Gaussian process model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
RegressionGP.resubLoss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 287
RegressionGP: L = resubLoss ( obj )
RegressionGP: L = resubLoss (&hellip;, name , value )

Compute the resubstitution loss of a Gaussian process model.

L = resubLoss ( obj ) returns the loss of the model
obj on the data it was trained on, and accepts the same
Name-Value pairs as loss .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 60
Compute the resubstitution loss of a Gaussian process model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
RegressionGP.resubPredict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 333
RegressionGP: yFit = resubPredict ( obj )
RegressionGP: [ yFit , ySD , yInt ] = resubPredict ( obj )

Predict the response of the training data with a Gaussian process model.

yFit = resubPredict ( obj ) returns the response the
RegressionGP model obj predicts at its own training data,
and the further outputs are those of predict .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 72
Predict the response of the training data with a Gaussian process model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
RegressionGP.savemodel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 183
RegressionGP: savemodel ( obj , filename )

Save a Gaussian process model to a file.

savemodel ( obj , filename ) saves the model obj
into filename in a form loadmodel can read back.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
Save a Gaussian process model to a file.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
RegressionKernel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1288
statistics: RegressionKernel

Gaussian kernel regression model for large data.

A RegressionKernel object maps the predictors into a randomized
feature space whose inner product approximates a Gaussian kernel, and then
fits a linear model there. A kernel regression is therefore as nonlinear
as a support vector machine with a Gaussian kernel, while costing what a
linear fit costs: nothing of size NxN is ever formed.

The expansion is the random Fourier basis of Rahimi and Recht, drawn once
when the model is fitted and kept with it, so predict maps new data
through the same basis. MATLAB approximates the same kernel by the
Fastfood construction, which reaches the same distribution more cheaply;
the two are interchangeable in distribution but not draw by draw, and the
draws come from different generators in any case, so the predictions of a
model fitted here and one fitted in MATLAB differ even from the same seed.
What does not differ is what they estimate.

Like RegressionLinear the object holds no copy of the training
data. It does hold the basis and the coefficients, so it is bounded by
the number of expansion dimensions rather than by the number of
observations.

Create a RegressionKernel object with fitrkernel .

See also:
fitrkernel,
RegressionLinear,
RegressionSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Gaussian kernel regression model for large data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
RegressionKernel.BoxConstraint


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 306
RegressionKernel: property BoxConstraint

Box constraint of the support vector machine

A positive scalar. It is the reciprocal of the product of
Lambda and the number of observations, so setting either of
the two in the constructor fixes the other, and giving both is an
error. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 44
Box constraint of the support vector machine



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
RegressionKernel.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 187
RegressionKernel: property CategoricalPredictors

Indices of the categorical predictors

A row vector of column indices, empty when every predictor is
numeric. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
RegressionKernel.Epsilon


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 362
RegressionKernel: property Epsilon

Half the width of the epsilon-insensitive band

A nonnegative scalar for a support vector machine, and empty for a
least squares fit, which has no such band. It defaults to the
interquartile range of the response over 13.49, an estimate of its
standard deviation, or to 0.1 when that range is zero. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
Half the width of the epsilon-insensitive band



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
RegressionKernel.ExpandedPredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 245
RegressionKernel: property ExpandedPredictorNames

Names of the predictors as the fit saw them

A cell array of character vectors. These name the original
predictors, not the expansion dimensions, which have no names. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
Names of the predictors as the fit saw them



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
RegressionKernel.FittedLoss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 184
RegressionKernel: property FittedLoss

Loss function the fit minimized

'epsiloninsensitive' for a support vector machine and
'mse' for a least squares fit. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Loss function the fit minimized



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
RegressionKernel.KernelScale


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 225
RegressionKernel: property KernelScale

Scale of the Gaussian kernel

A positive scalar dividing every predictor before the expansion, so a
larger scale makes the kernel wider and the fit smoother. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
Scale of the Gaussian kernel



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
RegressionKernel.Lambda


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 188
RegressionKernel: property Lambda

Regularization strength

A nonnegative scalar, the reciprocal of the product of
BoxConstraint and the number of observations. This property
is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
Regularization strength



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
RegressionKernel.Learner


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 139
RegressionKernel: property Learner

Linear model fitted in the expanded space

Either 'svm' or 'leastsquares' . This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Linear model fitted in the expanded space



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
RegressionKernel.ModelParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 233
RegressionKernel: property ModelParameters

Fitting options, as they were given

A structure holding every parameter of the fit, with the
'auto' values as they were given rather than as they were
resolved. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
Fitting options, as they were given



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
RegressionKernel.Mu


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 198
RegressionKernel: property Mu

Predictor means used to standardize

A row vector with one element per predictor, or empty when the model
was fitted without standardizing. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
Predictor means used to standardize



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
RegressionKernel.NumExpansionDimensions


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 341
RegressionKernel: property NumExpansionDimensions

Number of dimensions of the expanded space

A positive integer scalar. It defaults to
2 .^ ceil (min (log2 ( p ) + 5, 15)) for p
predictors, so four predictors give 128 dimensions. More dimensions
approximate the kernel more closely and cost proportionally more.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Number of dimensions of the expanded space



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
RegressionKernel.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 213
RegressionKernel: property PredictorNames

Names of the predictors

A cell array of character vectors with one name per column of the
training data, defaulting to 'x1' , 'x2' and so on.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
Names of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
RegressionKernel.RegressionKernel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2022
RegressionKernel: obj = RegressionKernel ( X , Y )
RegressionKernel: obj = RegressionKernel (&hellip;, name , value )

Fit a Gaussian kernel regression model.

obj = RegressionKernel ( X , Y ) fits a support
vector machine in a randomized Gaussian kernel space to the NxP
predictor matrix X and the Nx1 continuous response
Y .

obj = RegressionKernel (&hellip;, name , value )
takes the following Name-Value pairs.

Name Value
'Learner' 'svm' , the default, or
'leastsquares' .
'Epsilon' Half the width of the insensitive band,
a nonnegative scalar or 'auto' , which is the interquartile
range of Y over 13.49. It applies to a support vector machine
alone.
'NumExpansionDimensions' 'auto' , the
default, or a positive integer.
'KernelScale' 1 by default, a positive
scalar, or 'auto' , which takes the median distance between the
observations.
'Lambda' 'auto' , the default, which is the
reciprocal of the number of observations, or a nonnegative scalar. It
cannot be given beside 'BoxConstraint' .
'BoxConstraint' A positive scalar, 1 by
default. It applies to a support vector machine alone.
'Standardize' Whether to centre and scale the
predictors, false by default.
'BetaTolerance' Relative tolerance on the
coefficients, 1e-4 by default.
'GradientTolerance' Absolute tolerance on the
gradient&rsquo;s infinity norm, 1e-6 by default.
'IterationLimit' Largest number of iterations,
1000 by default.
'HessianHistorySize' Number of curvature pairs the
solver keeps, 15 by default.
'BlockSize' Memory the expansion may occupy, in
megabytes, 4e3 by default.
'ResponseTransform' A transformation applied to the
predicted response, named or given as a function handle.
'Weights' One nonnegative weight per observation.
'PredictorNames' One name per predictor.
'ResponseName' A name for the response.
'CategoricalPredictors' Indices of the categorical
predictors.

The fit is always by limited-memory BFGS, the only solver MATLAB
offers a kernel model, and always under a ridge penalty.

See also:
fitrkernel,
RegressionLinear


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
Fit a Gaussian kernel regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
RegressionKernel.Regularization


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 209
RegressionKernel: property Regularization

Penalty on the coefficients

Always 'ridge (L2)' : a kernel model fits in the expanded
space, where a lasso penalty has nothing to select. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Penalty on the coefficients



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
RegressionKernel.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 130
RegressionKernel: property ResponseName

Name of the response

A character vector, defaulting to 'Y' . This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Name of the response



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
RegressionKernel.ResponseTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 201
RegressionKernel: property ResponseTransform

Transformation applied to the predicted response

A character vector, or the text of the function handle that was
supplied. Assigning to it accepts either.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Transformation applied to the predicted response



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
RegressionKernel.Sigma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 215
RegressionKernel: property Sigma

Predictor standard deviations used to standardize

A row vector with one element per predictor, or empty when the model
was fitted without standardizing. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Predictor standard deviations used to standardize



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
RegressionKernel.loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 412
RegressionKernel: l = loss ( obj , X , Y )
RegressionKernel: l = loss (&hellip;, name , value )

Regression loss on new data.

l = loss ( obj , X , Y ) returns the mean
squared error.

l = loss (&hellip;, name , value ) takes
'LossFun' , either 'mse' or
'epsiloninsensitive' , and 'Weights' . The
epsilon-insensitive loss needs a band to be insensitive within, so it
is offered by a support vector machine alone.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
Regression loss on new data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
RegressionKernel.predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 248
RegressionKernel: yFit = predict ( obj , XC )

Predict the response of new observations.

yFit = predict ( obj , XC ) maps each row of
XC through the model&rsquo;s own random basis and returns the
predicted response, with ResponseTransform applied.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Predict the response of new observations.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
RegressionKernel.resume


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 841
RegressionKernel: obj = resume ( obj , X , Y )
RegressionKernel: obj = resume (&hellip;, name , value )

Continue fitting a kernel regression model.

obj = resume ( obj , X , Y ) restarts the
optimization from the coefficients the model already carries, through
the basis it already holds. It takes 'BetaTolerance' ,
'GradientTolerance' and 'IterationLimit' , each
defaulting to what the model was fitted with, and 'Weights' .

X and Y must be the data the model was fitted to; the
object keeps no copy of them, which is what makes it small. Neither
does it keep the observation weights, so a model fitted with
'Weights' must be given them again here or it will resume
against uniform ones. MATLAB behaves the same way: measured on
R2024a, resuming a weighted fit without passing the weights back
reaches the objective of the unweighted fit.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
Continue fitting a kernel regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
RegressionKernel.savemodel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 215
RegressionKernel: savemodel ( obj , filename )

Save a kernel regression model to a file.

savemodel ( obj , filename ) saves the model
obj into filename in a form loadmodel can read
back, the random basis included.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Save a kernel regression model to a file.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
RegressionLinear


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1080
statistics: RegressionLinear

Linear regression model for high dimensional data.

A RegressionLinear object fits a linear model,
X * Beta + Bias , to a continuous response by minimizing a
regularized average loss. The loss is the epsilon-insensitive loss for a
support vector machine and the squared error for a least squares fit, and
the penalty is either a ridge or a lasso one.

Unlike the other regression models of this package the object holds no
copy of the training data: the coefficients, the intercept and the fitting
options are the whole model. That is what makes it suited to data with
more predictors than a kernel matrix could carry, and it is why the class
has no compact method and no resubstitution methods.

A vector of regularization strengths fits one model per value in a single
object. Beta is then a PxL matrix and Bias a
1xL row, every method returns one column per strength, and
selectModels narrows the object down to the strengths worth
keeping.

Create a RegressionLinear object with fitrlinear .

See also:
fitrlinear,
RegressionKernel,
RegressionSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
Linear regression model for high dimensional data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
RegressionLinear.Beta


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 195
RegressionLinear: property Beta

Fitted linear coefficients

A Px1 column, or a PxL matrix with one column per
regularization strength when Lambda holds more than one. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
Fitted linear coefficients



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
RegressionLinear.Bias


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 224
RegressionLinear: property Bias

Fitted intercept

A scalar, or a 1xL row with one element per regularization
strength. It is zero throughout when the model was fitted with
'FitBias' set to false. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
Fitted intercept



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
RegressionLinear.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 187
RegressionLinear: property CategoricalPredictors

Indices of the categorical predictors

A row vector of column indices, empty when every predictor is
numeric. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
RegressionLinear.Epsilon


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 362
RegressionLinear: property Epsilon

Half the width of the epsilon-insensitive band

A nonnegative scalar for a support vector machine, and empty for a
least squares fit, which has no such band. It defaults to the
interquartile range of the response over 13.49, an estimate of its
standard deviation, or to 0.1 when that range is zero. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
Half the width of the epsilon-insensitive band



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
RegressionLinear.ExpandedPredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 253
RegressionLinear: property ExpandedPredictorNames

Names of the predictors as the fit saw them

A cell array of character vectors. It equals PredictorNames
unless categorical predictors were expanded into indicator variables.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
Names of the predictors as the fit saw them



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
RegressionLinear.FittedLoss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 278
RegressionLinear: property FittedLoss

Loss function the fit minimized

'epsiloninsensitive' for a support vector machine and
'mse' for a least squares fit. This is the loss of the
objective, which is not the loss loss reports unless it is
asked for. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Loss function the fit minimized



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
RegressionLinear.Lambda


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 235
RegressionLinear: property Lambda

Regularization strength

A nonnegative scalar, or a 1xL row of them in ascending order.
It defaults to the reciprocal of the number of observations used to
train the model. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
Regularization strength



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
RegressionLinear.Learner


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 137
RegressionLinear: property Learner

Linear regression model that was fitted

Either 'svm' or 'leastsquares' . This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
Linear regression model that was fitted



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
RegressionLinear.ModelParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 264
RegressionLinear: property ModelParameters

Fitting options, as they were given

A structure holding every parameter of the fit, including the ones
that a different solver would have used and the 'auto' values
before they were resolved. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
Fitting options, as they were given



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
RegressionLinear.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 213
RegressionLinear: property PredictorNames

Names of the predictors

A cell array of character vectors with one name per column of the
training data, defaulting to 'x1' , 'x2' and so on.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
Names of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
RegressionLinear.RegressionLinear


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3251
RegressionLinear: obj = RegressionLinear ( X , Y )
RegressionLinear: obj = RegressionLinear (&hellip;, name , value )

Fit a linear regression model.

obj = RegressionLinear ( X , Y ) fits a linear
support vector machine to the NxP predictor matrix X and
the Nx1 continuous response Y .

obj = RegressionLinear (&hellip;, name ,
value ) takes the following Name-Value pairs.

Name Value
'Learner' 'svm' , the default, or
'leastsquares' . The first minimizes the epsilon-insensitive
loss and the second the squared error.
'Epsilon' Half the width of the insensitive band,
a nonnegative scalar or 'auto' , which is the interquartile
range of Y over 13.49. It applies to a support vector machine
alone.
'Regularization' 'ridge' or
'lasso' . It defaults to 'lasso' when the solver is
'sparsa' and to 'ridge' otherwise.
'Lambda' 'auto' , the default, which is the
reciprocal of the number of observations, or a nonnegative scalar, or
a vector of them. A vector fits one model per value.
'Solver' One of 'sgd' , 'asgd' ,
'dual' , 'bfgs' , 'lbfgs' and 'sparsa' ,
or a cell array of them applied in turn, each warm starting the next.
'Beta' Initial coefficients, a Px1 column or
a PxL matrix. It defaults to zeros.
'Bias' Initial intercept, a scalar or a 1xL
row. It defaults to the weighted mean of Y for a least squares
fit and to its weighted median for a support vector machine.
'FitBias' Whether to fit an intercept at all, true
by default.
'PostFitBias' Whether to refit the intercept once
the coefficients are settled, false by default.
'ObservationsIn' 'rows' , the default, or
'columns' , which transposes X before fitting.
'BetaTolerance' Relative tolerance on the
coefficients, 1e-4 by default.
'GradientTolerance' Absolute tolerance on the
gradient&rsquo;s infinity norm, 1e-6 by default.
'DeltaGradientTolerance' Tolerance on the
complementarity gap of the 'dual' solver, 0.1 by
default.
'IterationLimit' Largest number of iterations,
1000 by default.
'PassLimit' Largest number of passes over the data
for the stochastic solvers, 1 by default, and 10 for
'dual' .
'BatchSize' Mini-batch size of the stochastic
solvers, 10 by default.
'BatchLimit' Largest number of mini-batches.
'LearnRate' Step size of the stochastic solvers.
'OptimizeLearnRate' Whether to halve the step size
when the objective rises, true by default.
'TruncationPeriod' Number of mini-batches between
soft thresholdings under a lasso penalty, 10 by default.
'NumCheckConvergence' Number of passes between
convergence checks of the 'dual' solver, 2 by
default. MathWorks documents 5 ; R2024a and R2026a both
report 2 .
'HessianHistorySize' Number of curvature pairs the
quasi-Newton solvers keep, 15 by default.
'ResponseTransform' A transformation applied to the
predicted response, named or given as a function handle.
'Weights' One nonnegative weight per observation.
'PredictorNames' One name per predictor.
'ResponseName' A name for the response.
'CategoricalPredictors' Indices of the categorical
predictors.

The default solver is 'sparsa' under a lasso penalty. Under a
ridge penalty it is 'bfgs' when there are no more than 100
predictors, and beyond that 'dual' for a support vector
machine and 'sgd' for a least squares fit.

See also:
fitrlinear,
RegressionKernel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
Fit a linear regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
RegressionLinear.Regularization


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 130
RegressionLinear: property Regularization

Penalty on the coefficients

'ridge (L2)' or 'lasso (L1)' . This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Penalty on the coefficients



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
RegressionLinear.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 130
RegressionLinear: property ResponseName

Name of the response

A character vector, defaulting to 'Y' . This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Name of the response



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
RegressionLinear.ResponseTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 201
RegressionLinear: property ResponseTransform

Transformation applied to the predicted response

A character vector, or the text of the function handle that was
supplied. Assigning to it accepts either.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Transformation applied to the predicted response



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
RegressionLinear.loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 451
RegressionLinear: l = loss ( obj , X , Y )
RegressionLinear: l = loss (&hellip;, name , value )

Regression loss on new data.

l = loss ( obj , X , Y ) returns the mean
squared error, one value per regularization strength.

l = loss (&hellip;, name , value ) takes
'LossFun' , either 'mse' or
'epsiloninsensitive' , and 'Weights' . The
epsilon-insensitive loss needs a band to be insensitive within, so it
is offered by a support vector machine alone.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
Regression loss on new data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
RegressionLinear.predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 249
RegressionLinear: yFit = predict ( obj , XC )

Predict the response of new observations.

yFit = predict ( obj , XC ) returns one
predicted value per row of XC , and one column per regularization
strength. ResponseTransform is applied to the result.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Predict the response of new observations.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
RegressionLinear.savemodel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 188
RegressionLinear: savemodel ( obj , filename )

Save a linear regression model to a file.

savemodel ( obj , filename ) saves the model
obj into filename in a form loadmodel can read
back.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Save a linear regression model to a file.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
RegressionLinear.selectModels


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 255
RegressionLinear: sub = selectModels ( obj , idx )

Keep a subset of the fitted regularization strengths.

sub = selectModels ( obj , idx ) returns a model
holding only the strengths idx names, which may be indices into
Lambda or a logical vector over it.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 53
Keep a subset of the fitted regularization strengths.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
RegressionNeuralNetwork


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4468
statistics: obj = RegressionNeuralNetwork ( X , Y )
statistics: obj = RegressionNeuralNetwork (&hellip;, name , value )

Create a RegressionNeuralNetwork object containing a neural network
regression model.

obj = RegressionNeuralNetwork ( X , Y ) returns a
neural network regression model, obj , with X being the predictor
data and Y the continuous response of the observations in X .

X must be an NxP numeric matrix of predictor data, where rows
correspond to observations and columns to features.

Y must be an Nx1 numeric vector holding the response of the
corresponding predictor data in X . Y must have the same number
of rows as X .

The network is trained against the mean squared error, and its output layer
applies the identity, so a prediction is an unrestricted real number rather
than a score over classes. This is the only difference in the engine
between this class and ClassificationNeuralNetwork ; everything else,
the layer sizes, the activations, the learning rate and the initialisation,
behaves identically.

obj = RegressionNeuralNetwork (&hellip;, name ,
value ) returns a model with additional options specified by
Name-Value pair arguments listed below.

Name Value
'Standardize' A logical scalar specifying whether the
predictor data should be centred and scaled before training. The same
transformation is applied by predict . The default is false .
'PredictorNames' A cell array of character vectors
naming the predictors, in the order they appear in X .
'ResponseName' A character vector naming the response.
The default is 'Y' .
'ResponseTransform' A character vector naming one of the
supported transformations, or a function handle, applied to the predicted
response by predict and resubPredict . The default is
'none' .
'LayerSizes' A positive integer vector specifying the
number of units in each fully connected hidden layer. The default is 10,
one hidden layer of ten units.
'Activations' A character vector or cell array of
character vectors specifying the activation of the hidden layers. The
supported functions are 'linear' , 'sigmoid' ,
'relu' , 'tanh' , 'lrelu' , 'prelu' ,
'elu' , 'gelu' and 'none' . The default is
'relu' .
'OutputLayerActivation' A character vector specifying
the activation of the output layer. The default is 'none' , the
identity, which is what a regression output calls for. The supported
values are the same as for 'Activations' .
'LearningRate' A positive scalar specifying the learning
rate for gradient descent. The default is 0.003. A larger rate can drive
every unit of a hidden layer negative, after which a rectifier passes no
gradient and the network stops training.
Applies only when 'Solver' is 'sgd' .
'Solver' A character vector naming the solver that
trains the network, either 'lbfgs' or 'sgd' . The
default is 'lbfgs' , which minimizes the loss over the whole
training set at once by limited-memory BFGS, as MATLAB does. It takes
no learning rate, stops on the three tolerances below, and reaches a
lower training loss in fewer passes over the data, though each of its
iterations costs several passes where an epoch costs one.
'sgd' visits the samples one at a time and steps down the
gradient of each, running for 'IterationLimit' epochs; it was
the default before version 1.9.0.
'GradientTolerance' A nonnegative scalar. Training
stops once the gradient&rsquo;s infinity norm falls to or below it, which is
the quantity MATLAB tests too. The default is 1e-6 . Applies
only when 'Solver' is 'lbfgs' .
'StepTolerance' A nonnegative scalar. Training
stops once the step&rsquo;s infinity norm falls to or below it, which is the
quantity MATLAB tests too. The default is 1e-6 . Applies only
when 'Solver' is 'lbfgs' .
'LossTolerance' A real scalar. Training stops once
the training loss falls to or below it. The test is on the loss
itself and not on its change, matching MATLAB; pass -Inf to
switch it off. The default is 1e-6 . Applies only when
'Solver' is 'lbfgs' .
'IterationLimit' A positive integer specifying the
maximum number of training iterations. The default is 1000.
Under 'sgd' this counts epochs, under
'lbfgs' solver iterations.
'DisplayInfo' A logical scalar specifying whether to
print information during training. The default is false .

The supported values for 'ResponseTransform' are:

Value Description
'none' x (no transformation)
'identity' x (no transformation)
'exp' exp (x)
'log' log (x)

See also:
fitrnet,
ClassificationNeuralNetwork,
fcnntrain,
fcnnpredict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 85
Create a RegressionNeuralNetwork object containing a neural network regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
RegressionNeuralNetwork.Activations


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 239
RegressionNeuralNetwork: property Activations

Activation functions of the hidden layers

A character vector, applying to every hidden layer, or a cell array of
character vectors with one entry per hidden layer. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Activation functions of the hidden layers



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
RegressionNeuralNetwork.BinEdges


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 371
RegressionNeuralNetwork: property BinEdges

Bin edges of the predictors

A cell array with one entry per predictor, holding that predictor&rsquo;s bin
edges where the learner discretized it before fitting. It is empty here
and stays empty: this learner fits the predictors as they are, and
MATLAB&rsquo;s reports an empty cell for it as well.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Bin edges of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
RegressionNeuralNetwork.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 235
RegressionNeuralNetwork: property CategoricalPredictors

Indices of the categorical predictors

A numeric vector of column indices into X naming the predictors
treated as categorical, and empty when none is. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
RegressionNeuralNetwork.ConvergenceInfo


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 578
RegressionNeuralNetwork: property ConvergenceInfo

Information recorded during training

A structure with the fields Time , the seconds training took, and
TrainingLoss , the mean squared error of the network at the end of
each iteration. This property is read-only.

Under 'lbfgs' the structure carries Gradient and
Step , the two quantities the solver measured to decide it had
converged, and ConvergenceCriterion , naming the test that
stopped it. It carries no Accuracy : MATLAB reports none, and
measuring it would cost a pass over the whole training set at every
iteration.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
Information recorded during training



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
RegressionNeuralNetwork.DisplayInfo


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 131
RegressionNeuralNetwork: property DisplayInfo

Whether training printed its progress

A logical scalar. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Whether training printed its progress



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
RegressionNeuralNetwork.ExpandedPredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 268
RegressionNeuralNetwork: property ExpandedPredictorNames

Names of the predictors as the model expanded them

A cell array of character vectors. It matches PredictorNames
unless a categorical predictor was expanded into indicator variables.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
Names of the predictors as the model expanded them



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 57
RegressionNeuralNetwork.HyperparameterOptimizationResults


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 366
RegressionNeuralNetwork: property HyperparameterOptimizationResults

Results of the hyperparameter optimization

Always empty. It is declared for MATLAB compatibility, where
it holds what an automatic search over the hyperparameters found. This
class fits the parameters it is given and runs no such search, so there
is nothing to report. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Results of the hyperparameter optimization



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
RegressionNeuralNetwork.IterationLimit


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 143
RegressionNeuralNetwork: property IterationLimit

Maximum number of training iterations

A positive integer scalar. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Maximum number of training iterations



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
RegressionNeuralNetwork.LayerBiases


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 232
RegressionNeuralNetwork: property LayerBiases

Biases the network learned

A cell array with one entry per layer, the output layer included.
LayerBiases{i} is a column with one entry per unit of layer
i . This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
Biases the network learned



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
RegressionNeuralNetwork.LayerSizes


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 252
RegressionNeuralNetwork: property LayerSizes

Sizes of the fully connected hidden layers

A row vector of positive integers, one per hidden layer. It does not
include the output layer, whose width is the number of responses. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Sizes of the fully connected hidden layers



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
RegressionNeuralNetwork.LayerWeights


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 258
RegressionNeuralNetwork: property LayerWeights

Weights the network learned

A cell array with one entry per layer, the output layer included.
LayerWeights{i} has one row per unit of layer i and one
column per input to that layer. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Weights the network learned



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
RegressionNeuralNetwork.LearningRate


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 218
RegressionNeuralNetwork: property LearningRate

Learning rate for gradient descent

A positive scalar value defining the learning rate used by the gradient
descent algorithm during training. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
Learning rate for gradient descent



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
RegressionNeuralNetwork.ModelParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1172
RegressionNeuralNetwork: property ModelParameters

Parameters of the trained network

A structure holding the fit as it was asked for: LayerSizes ,
Activations , OutputLayerActivation ,
LayerWeightsInitializers , Solver ,
LearningRate , IterationLimit ,
GradientTolerance , LossTolerance ,
StepTolerance , DisplayInfo , StandardizeData ,
and the Version , Method and Type tags.

What came out of the fit is elsewhere: the LayerWeights and
LayerBiases properties hold the network, TrainingHistory
the series and ConvergenceInfo where it stopped.

LayerWeightsInitializers names the scheme each layer&rsquo;s weights
were drawn with, the output layer last: 'he' for a rectifying
activation and 'glorot' for a symmetric one. It is a report,
not a setting, the engine choosing per layer from the activation and
offering no way to override it.

OutputLayerActivation , Solver and LearningRate
are this package&rsquo;s own; MATLAB has no counterpart for them. The fields
it reports that this class does not accept as arguments
( Lambda , the validation set and its patience and frequency,
InitialStepSize and the two initializer settings) are absent.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
Parameters of the trained network



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
RegressionNeuralNetwork.Mu


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 211
RegressionNeuralNetwork: property Mu

Mean of the predictors

A row vector with one entry per predictor, used for standardization.
Empty when the predictor data were not standardized. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Mean of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
RegressionNeuralNetwork.NumObservations


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 221
RegressionNeuralNetwork: property NumObservations

Number of observations used to train the model

A positive integer scalar, counting only the rows that survived the
removal of missing values. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
Number of observations used to train the model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
RegressionNeuralNetwork.NumPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 154
RegressionNeuralNetwork: property NumPredictors

Number of predictors

A positive integer scalar, the number of columns of X . This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Number of predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
RegressionNeuralNetwork.OutputLayerActivation


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 237
RegressionNeuralNetwork: property OutputLayerActivation

Activation function of the output layer

A character vector. The default, 'none' , applies the identity,
so a prediction is an unrestricted real number. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
Activation function of the output layer



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
RegressionNeuralNetwork.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 159
RegressionNeuralNetwork: property PredictorNames

Names of the predictors

A cell array of character vectors, one per column of X . This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
Names of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
RegressionNeuralNetwork.RegressionNeuralNetwork


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 340
RegressionNeuralNetwork: obj = RegressionNeuralNetwork ( X , Y )
RegressionNeuralNetwork: obj = RegressionNeuralNetwork (&hellip;, name , value )

Create a RegressionNeuralNetwork object containing a neural
network regression model.

See the class documentation for the accepted Name-Value pairs.

See also:
fitrnet,
RegressionNeuralNetwork


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 85
Create a RegressionNeuralNetwork object containing a neural network regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
RegressionNeuralNetwork.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 126
RegressionNeuralNetwork: property ResponseName

Name of the response variable

A character vector. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Name of the response variable



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
RegressionNeuralNetwork.ResponseTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 316
RegressionNeuralNetwork: property ResponseTransform

Transformation applied to the predicted response

A function handle, applied by predict and resubPredict to
the network&rsquo;s output. It defaults to the identity and may be set after
construction, either to a handle or to the name of a supported
transformation.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Transformation applied to the predicted response



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
RegressionNeuralNetwork.RowsUsed


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 398
RegressionNeuralNetwork: property RowsUsed

Rows used for fitting

A logical column vector with the same length as the observations in the
original predictor data X , true for each row that was used for
fitting the RegressionNeuralNetwork model. It is empty, [] ,
when every observation was used, so a non-empty value means that rows
holding missing values were dropped. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
Rows used for fitting



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
RegressionNeuralNetwork.Sigma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 228
RegressionNeuralNetwork: property Sigma

Standard deviation of the predictors

A row vector with one entry per predictor, used for standardization.
Empty when the predictor data were not standardized. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
Standard deviation of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
RegressionNeuralNetwork.Solver


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 210
RegressionNeuralNetwork: property Solver

Solver used to train the network

A character vector, either 'Gradient Descent' for the
stochastic solver or 'LBFGS' for the full-batch one.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Solver used to train the network



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
RegressionNeuralNetwork.TrainingHistory


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 423
RegressionNeuralNetwork: property TrainingHistory

Iteration by iteration record of the fit

A table with the variables Iteration and
TrainingLoss , one row per training iteration. This property is
read-only.

The columns follow the solver. Under 'sgd' they are
Iteration and TrainingLoss , with TrainingAccuracy
for a classifier. Under 'lbfgs' they are Iteration ,
TrainingLoss , Gradient and Step , as MATLAB&rsquo;s are.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
Iteration by iteration record of the fit



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
RegressionNeuralNetwork.W


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 205
RegressionNeuralNetwork: property W

Observation weights

A numeric column vector with one entry per training observation. It
defaults to a uniform weight for every observation. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
Observation weights



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
RegressionNeuralNetwork.X


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 196
RegressionNeuralNetwork: property X

Predictor data

An NxP numeric matrix, as it was supplied to the constructor,
before any rows carrying missing values were dropped. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
Predictor data



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
RegressionNeuralNetwork.Y


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 141
RegressionNeuralNetwork: property Y

Response data

An Nx1 numeric vector, as it was supplied to the constructor.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
Response data



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
RegressionNeuralNetwork.compact


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 386
RegressionNeuralNetwork: CMdl = compact ( obj )

Create a CompactRegressionNeuralNetwork object.

CMdl = compact ( obj ) returns a compact version of
the RegressionNeuralNetwork object obj , which keeps the
trained network but drops the training data, so it predicts identically
while carrying no observations.

See also:
fitrnet,
RegressionNeuralNetwork,
CompactRegressionNeuralNetwork


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
Create a CompactRegressionNeuralNetwork object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
RegressionNeuralNetwork.crossval


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 909
RegressionNeuralNetwork: CVMdl = crossval ( obj )
RegressionNeuralNetwork: CVMdl = crossval (&hellip;, name , value )

Cross validate a neural network regression model.

CVMdl = crossval ( obj ) returns a
RegressionPartitionedModel holding one refit of obj per
fold of a ten-fold partition, or of an n -fold one where the
model has fewer than ten observations.

obj must be a RegressionNeuralNetwork class object.

CVMdl = crossval (&hellip;, name , value )
accepts one, and only one, of the following Name-Value pairs.

Name Value
'KFold' An integer greater than 1, the number of
folds.
'Holdout' A scalar in (0, 1) , the fraction
of observations held out for testing.
'Leaveout' 'on' or 'off' , whether
to hold out one observation at a time.
'CVPartition' A cvpartition object over as
many observations as the model was trained on.

See also:
RegressionNeuralNetwork,
RegressionPartitionedModel,
cvpartition


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Cross validate a neural network regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
RegressionNeuralNetwork.loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 995
RegressionNeuralNetwork: L = loss ( obj , X , Y )
RegressionNeuralNetwork: L = loss (&hellip;, name , value )

Compute the regression loss of a neural network model.

L = loss ( obj , X , Y ) returns the
weighted mean squared error between the response Y and the
response the model predicts for X .

obj must be a RegressionNeuralNetwork class object.

X must be a numeric matrix with the same number of predictors as
the data the model was trained on.

Y must be a numeric vector with as many rows as X .

L = loss (&hellip;, 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, so
scaling them all by the same factor leaves the loss unchanged.

See also:
RegressionNeuralNetwork,
fitrnet


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 54
Compute the regression loss of a neural network model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
RegressionNeuralNetwork.predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 576
RegressionNeuralNetwork: yFit = predict ( obj , XC )

Predict the response for new data with a neural network regression
model.

yFit = predict ( obj , XC ) returns a column
vector holding the predicted response for each row of XC , using
the network stored in obj .

obj must be a RegressionNeuralNetwork class object.

XC must be a numeric matrix with the same number of predictors as
the data the model was trained on.

The transformation named by ResponseTransform is applied to the
network&rsquo;s output before it is returned.

See also:
RegressionNeuralNetwork,
fitrnet


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 73
Predict the response for new data with a neural network regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
RegressionNeuralNetwork.resubLoss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 433
RegressionNeuralNetwork: L = resubLoss ( obj )
RegressionNeuralNetwork: L = resubLoss (&hellip;, name , value )

Compute the resubstitution regression loss of a neural network model.

L = resubLoss ( obj ) returns the weighted mean
squared error of the model on the data it was trained on. It accepts
the same Name-Value pairs as loss .

obj must be a RegressionNeuralNetwork class object.

See also:
RegressionNeuralNetwork,
fitrnet


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 69
Compute the resubstitution regression loss of a neural network model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
RegressionNeuralNetwork.resubPredict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 417
RegressionNeuralNetwork: yFit = resubPredict ( obj )

Predict the response of the training data with a neural network
regression model.

yFit = resubPredict ( obj ) returns a column vector
holding the predicted response for every observation the model was
trained on, that is the rows of obj.X selected by
obj.RowsUsed .

obj must be a RegressionNeuralNetwork class object.

See also:
RegressionNeuralNetwork,
fitrnet


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 81
Predict the response of the training data with a neural network regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
RegressionNeuralNetwork.savemodel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 329
RegressionNeuralNetwork: savemodel ( obj , filename )

Save a neural network regression model to a file.

savemodel ( obj , filename ) saves every property of
the RegressionNeuralNetwork object obj into
filename in binary format, so that it can be read back with
loadmodel .

See also:
loadmodel,
RegressionNeuralNetwork,
fitrnet


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Save a neural network regression model to a file.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
RegressionPartitionedKernel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1022
statistics: RegressionPartitionedKernel

Cross-validated Gaussian kernel regression model.

A RegressionPartitionedKernel object holds one
RegressionKernel per fold of a partition, each fitted to the
observations the fold trains on. kfoldPredict predicts each
observation with the fold that held it out , so what it returns is
an out-of-sample prediction.

A RegressionKernel stores no copy of its training data and so has
no resubstitution methods and no compact form. This class is what
takes their place: cross-validation is the way a kernel model is asked
how it would do on data it has not seen.

Every fold draws its own random basis, as it must, being its own fit.
Two folds therefore approximate the same kernel through different
expansions, which is a source of variation between folds over and above
the data they were given. A larger 'NumExpansionDimensions'
narrows it.

Create one with fitrlinear and a cross-validation option, or
directly.

See also:
fitrlinear,
RegressionKernel,
RegressionPartitionedKernel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Cross-validated Gaussian kernel regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
RegressionPartitionedKernel.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 198
RegressionPartitionedKernel: property CategoricalPredictors

Indices of the categorical predictors

A row vector of column indices, empty when every predictor is
numeric. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
RegressionPartitionedKernel.CrossValidatedModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 176
RegressionPartitionedKernel: property CrossValidatedModel

Name of the model that was cross-validated

Always 'Linear' , the short name MATLAB uses. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Name of the model that was cross-validated



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
RegressionPartitionedKernel.KFold


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 218
RegressionPartitionedKernel: property KFold

Number of folds

A positive integer scalar. A holdout partition has one fold and a
leave-one-out partition has as many as there are observations. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
Number of folds



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
RegressionPartitionedKernel.ModelParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1151
RegressionPartitionedKernel: property ModelParameters

What was cross-validated, and how

A structure holding the parameters the folds were fitted with, carried
through from the learner that was cross validated, beside
NLearn , the number of folds, and the Version ,
Method and Type tags of this class, with
LearnerTemplates naming the backing. The
learner&rsquo;s own tags are replaced rather than kept, so a cross-validated
SVM reports Method as 'PartitionedKernel' and not
'SVM' .

Deviation from MATLAB. MATLAB reports the parameter record of
the cross-validation ensemble here rather than of the learner,
so it says nothing at all about how the folds were fitted: of its
eighteen fields only the fold count, its partitioner and a fit template
carry anything, and the rest are boosting settings left inert. Nor can
the parameters be reached through the folds, a compact model carrying
none in MATLAB. This class reports the fit instead, which is strictly
more than MATLAB offers, and everything MATLAB&rsquo;s record does carry is
published here as the KFold , Partition , X ,
Y , W and CrossValidatedModel properties.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
What was cross-validated, and how



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
RegressionPartitionedKernel.NumObservations


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 217
RegressionPartitionedKernel: property NumObservations

Number of observations the partition covers

A positive integer scalar, counting the rows that survived the removal
of missing values. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
Number of observations the partition covers



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
RegressionPartitionedKernel.Partition


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 151
RegressionPartitionedKernel: property Partition

The partition itself

A cvpartition object over the retained observations. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
The partition itself



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
RegressionPartitionedKernel.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 141
RegressionPartitionedKernel: property PredictorNames

Names of the predictors

A cell array of character vectors. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
Names of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 55
RegressionPartitionedKernel.RegressionPartitionedKernel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 972
RegressionPartitionedKernel: obj = RegressionPartitionedKernel ( X , Y )
RegressionPartitionedKernel: obj = RegressionPartitionedKernel (&hellip;, name , value )

Cross-validate a linear regression model.

obj = RegressionPartitionedKernel ( X , Y )
partitions the data into ten folds and fits a
RegressionKernel to each.

obj = RegressionPartitionedKernel (&hellip;, name ,
value ) takes one of 'KFold' , 'Holdout' ,
'Leaveout' and 'CVPartition' to say how to partition,
and any option RegressionKernel takes to say how to fit.
'CrossVal' is accepted and has no effect here, this class
being cross-validated by construction.

Anything left as 'auto' is resolved by each fold against its
own training rows rather than once over the whole data, so ten folds
of a hundred observations each get a Lambda of one ninetieth
rather than one hundredth, and each its own Epsilon and
KernelScale . Both are MATLAB&rsquo;s behaviour, measured.

See also:
fitrlinear,
RegressionKernel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Cross-validate a linear regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
RegressionPartitionedKernel.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 141
RegressionPartitionedKernel: property ResponseName

Name of the response

A character vector, defaulting to 'Y' . This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Name of the response



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
RegressionPartitionedKernel.ResponseTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 332
RegressionPartitionedKernel: property ResponseTransform

Transformation applied to the predicted response

A character vector, or the text of the function handle that was
supplied, which may be assigned after the model is built. The fold
models carry no transform of their own; this one is applied once to
the assembled predictions.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Transformation applied to the predicted response



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
RegressionPartitionedKernel.Trained


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 208
RegressionPartitionedKernel: property Trained

The models fitted to the folds

A cell column with one RegressionKernel per fold, each fitted
to the observations its fold trains on. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
The models fitted to the folds



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
RegressionPartitionedKernel.W


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 127
RegressionPartitionedKernel: property W

Observation weights

An Nx1 numeric vector summing to one. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
Observation weights



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
RegressionPartitionedKernel.Y


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 130
RegressionPartitionedKernel: property Y

Response of the retained observations

An Nx1 numeric vector. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Response of the retained observations



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
RegressionPartitionedKernel.kfoldLoss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 458
RegressionPartitionedKernel: l = kfoldLoss ( obj )
RegressionPartitionedKernel: l = kfoldLoss (&hellip;, name , value )

Out-of-fold regression loss.

l = kfoldLoss ( obj ) returns the out-of-fold mean
squared error.

l = kfoldLoss (&hellip;, name , value ) takes
'LossFun' , either 'mse' or
'epsiloninsensitive' ; 'Folds' , a subset of the folds
to average over; and 'Mode' , either 'average' , the
default, or 'individual' , which returns one row per fold.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
Out-of-fold regression loss.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
RegressionPartitionedKernel.kfoldPredict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 306
RegressionPartitionedKernel: yFit = kfoldPredict ( obj )

Out-of-fold prediction for every observation.

Each observation is predicted by the fold that held it out, so the
predictions are out-of-sample. An observation that no fold held out,
which under a holdout partition is most of them, comes back
NaN .


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
Out-of-fold prediction for every observation.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
RegressionPartitionedLinear


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 883
statistics: RegressionPartitionedLinear

Cross-validated linear regression model.

A RegressionPartitionedLinear object holds one
RegressionLinear per fold of a partition, each fitted to the
observations the fold trains on. kfoldPredict predicts each
observation with the fold that held it out , so what it returns is
an out-of-sample prediction.

A RegressionLinear stores no copy of its training data and so has
no resubstitution methods and no compact form. This class is what
takes their place: cross-validation is the way a linear model is asked
how it would do on data it has not seen.

When the fold models carry a whole regularization path, both methods
return one column per strength, in the order of the 'Lambda' that
was asked for.

Create one with fitrlinear and a cross-validation option, or
directly.

See also:
fitrlinear,
RegressionLinear,
RegressionPartitionedKernel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
Cross-validated linear regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
RegressionPartitionedLinear.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 198
RegressionPartitionedLinear: property CategoricalPredictors

Indices of the categorical predictors

A row vector of column indices, empty when every predictor is
numeric. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
RegressionPartitionedLinear.CrossValidatedModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 176
RegressionPartitionedLinear: property CrossValidatedModel

Name of the model that was cross-validated

Always 'Linear' , the short name MATLAB uses. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Name of the model that was cross-validated



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
RegressionPartitionedLinear.KFold


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 218
RegressionPartitionedLinear: property KFold

Number of folds

A positive integer scalar. A holdout partition has one fold and a
leave-one-out partition has as many as there are observations. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
Number of folds



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
RegressionPartitionedLinear.ModelParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1151
RegressionPartitionedLinear: property ModelParameters

What was cross-validated, and how

A structure holding the parameters the folds were fitted with, carried
through from the learner that was cross validated, beside
NLearn , the number of folds, and the Version ,
Method and Type tags of this class, with
LearnerTemplates naming the backing. The
learner&rsquo;s own tags are replaced rather than kept, so a cross-validated
SVM reports Method as 'PartitionedLinear' and not
'SVM' .

Deviation from MATLAB. MATLAB reports the parameter record of
the cross-validation ensemble here rather than of the learner,
so it says nothing at all about how the folds were fitted: of its
eighteen fields only the fold count, its partitioner and a fit template
carry anything, and the rest are boosting settings left inert. Nor can
the parameters be reached through the folds, a compact model carrying
none in MATLAB. This class reports the fit instead, which is strictly
more than MATLAB offers, and everything MATLAB&rsquo;s record does carry is
published here as the KFold , Partition , X ,
Y , W and CrossValidatedModel properties.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
What was cross-validated, and how



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
RegressionPartitionedLinear.NumObservations


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 217
RegressionPartitionedLinear: property NumObservations

Number of observations the partition covers

A positive integer scalar, counting the rows that survived the removal
of missing values. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
Number of observations the partition covers



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
RegressionPartitionedLinear.Partition


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 151
RegressionPartitionedLinear: property Partition

The partition itself

A cvpartition object over the retained observations. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
The partition itself



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
RegressionPartitionedLinear.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 141
RegressionPartitionedLinear: property PredictorNames

Names of the predictors

A cell array of character vectors. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
Names of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 55
RegressionPartitionedLinear.RegressionPartitionedLinear


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 956
RegressionPartitionedLinear: obj = RegressionPartitionedLinear ( X , Y )
RegressionPartitionedLinear: obj = RegressionPartitionedLinear (&hellip;, name , value )

Cross-validate a linear regression model.

obj = RegressionPartitionedLinear ( X , Y )
partitions the data into ten folds and fits a
RegressionLinear to each.

obj = RegressionPartitionedLinear (&hellip;, name ,
value ) takes one of 'KFold' , 'Holdout' ,
'Leaveout' and 'CVPartition' to say how to partition,
and any option RegressionLinear takes to say how to fit.
'CrossVal' is accepted and has no effect here, this class
being cross-validated by construction.

Anything left as 'auto' is resolved by each fold against its
own training rows rather than once over the whole data, so ten folds
of a hundred observations each get a Lambda of one ninetieth
rather than one hundredth, and each its own Epsilon . Both are
MATLAB&rsquo;s behaviour, measured.

See also:
fitrlinear,
RegressionLinear


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
Cross-validate a linear regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
RegressionPartitionedLinear.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 141
RegressionPartitionedLinear: property ResponseName

Name of the response

A character vector, defaulting to 'Y' . This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Name of the response



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
RegressionPartitionedLinear.ResponseTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 332
RegressionPartitionedLinear: property ResponseTransform

Transformation applied to the predicted response

A character vector, or the text of the function handle that was
supplied, which may be assigned after the model is built. The fold
models carry no transform of their own; this one is applied once to
the assembled predictions.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Transformation applied to the predicted response



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
RegressionPartitionedLinear.Trained


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 208
RegressionPartitionedLinear: property Trained

The models fitted to the folds

A cell column with one RegressionLinear per fold, each fitted
to the observations its fold trains on. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
The models fitted to the folds



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
RegressionPartitionedLinear.W


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 127
RegressionPartitionedLinear: property W

Observation weights

An Nx1 numeric vector summing to one. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
Observation weights



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
RegressionPartitionedLinear.Y


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 130
RegressionPartitionedLinear: property Y

Response of the retained observations

An Nx1 numeric vector. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Response of the retained observations



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
RegressionPartitionedLinear.kfoldLoss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 458
RegressionPartitionedLinear: l = kfoldLoss ( obj )
RegressionPartitionedLinear: l = kfoldLoss (&hellip;, name , value )

Out-of-fold regression loss.

l = kfoldLoss ( obj ) returns the out-of-fold mean
squared error.

l = kfoldLoss (&hellip;, name , value ) takes
'LossFun' , either 'mse' or
'epsiloninsensitive' ; 'Folds' , a subset of the folds
to average over; and 'Mode' , either 'average' , the
default, or 'individual' , which returns one row per fold.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
Out-of-fold regression loss.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
RegressionPartitionedLinear.kfoldPredict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 373
RegressionPartitionedLinear: yFit = kfoldPredict ( obj )

Out-of-fold prediction for every observation.

Each observation is predicted by the fold that held it out, so the
predictions are out-of-sample. An observation that no fold held out,
which under a holdout partition is most of them, comes back
NaN .

With L regularization strengths yFit has one column per
strength.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
Out-of-fold prediction for every observation.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
RegressionPartitionedModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 990
statistics: obj = RegressionPartitionedModel ( Mdl , Partition )

Create a RegressionPartitionedModel object, a regression model
cross validated over a partition of its training data.

obj = RegressionPartitionedModel ( Mdl , Partition )
refits Mdl once per fold of Partition , each time on the
observations that fold holds out of its test set, and stores the compact
form of every fit in Trained . It is normally reached through
crossval ( Mdl ) rather than called directly.

Mdl must be a RegressionGAM , a
RegressionNeuralNetwork , or a RegressionSVM object.

Partition must be a cvpartition object over as many
observations as Mdl was trained on.

Every observation is held out by exactly one fold under k -fold or
leave-one-out partitioning, so kfoldPredict can answer for it with a
model that never saw it. Under a holdout partition only the test set is
answered for, and the rest come back NaN .

See also:
crossval,
cvpartition,
RegressionGAM,
RegressionNeuralNetwork,
RegressionSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 117
Create a RegressionPartitionedModel object, a regression model cross validated over a partition of its training data.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
RegressionPartitionedModel.BinEdges


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 535
RegressionPartitionedModel: property BinEdges

Bin edges of the predictors

A cell array with one entry per predictor, holding that predictor&rsquo;s bin
edges where the learner discretized it before fitting. It is carried
over from the model that was cross validated, and is empty whenever that
model did no binning, which is every learner this package implements:
MATLAB fills it only for its generalized additive model, which bins
because it is built from boosted trees where ours is built from splines.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Bin edges of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
RegressionPartitionedModel.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 186
RegressionPartitionedModel: property CategoricalPredictors

Indices of the categorical predictors

A numeric vector of column indices, and empty when none is. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
RegressionPartitionedModel.CrossValidatedModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 358
RegressionPartitionedModel: property CrossValidatedModel

Name of the cross-validated model

A character vector holding the short name of the learner that was
cross validated, as MATLAB reports it: 'GAM' , 'GP' ,
'NeuralNetwork' or 'SVM' . It is not the class name of
that learner, and the classification side uses the same names. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
Name of the cross-validated model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
RegressionPartitionedModel.IsStandardDeviationFit


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 830
RegressionPartitionedModel: property IsStandardDeviationFit

Whether the folds fitted a standard deviation model

A logical scalar for a generalized additive model backing, taken from
the model that was cross validated, and empty for every other backing.

MATLAB carries this on RegressionPartitionedGAM , one of five
per-learner partitioned classes this package deliberately does not have
(see crossval ). With one class serving every backing the
property has to be declared for all of them, so it is empty where it
does not apply. It is placed last rather than first, where MATLAB&rsquo;s
subclass shows it, because that subclass also moves
ResponseTransform to the end and no single order can match both
of MATLAB&rsquo;s classes; matching the general one and appending is the only
coherent choice.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51
Whether the folds fitted a standard deviation model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
RegressionPartitionedModel.KFold


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 115
RegressionPartitionedModel: property KFold

Number of folds

A positive integer scalar. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
Number of folds



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
RegressionPartitionedModel.ModelParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1111
RegressionPartitionedModel: property ModelParameters

Parameters the folds were fitted with

A structure holding the parameters the folds were fitted with, carried
through from the learner that was cross validated, beside
NLearn , the number of folds, and the Version ,
Method and Type tags of this class. The
learner&rsquo;s own tags are replaced rather than kept, so a cross-validated
SVM reports Method as 'PartitionedModel' and not
'SVM' .

Deviation from MATLAB. MATLAB reports the parameter record of
the cross-validation ensemble here rather than of the learner,
so it says nothing at all about how the folds were fitted: of its
eighteen fields only the fold count, its partitioner and a fit template
carry anything, and the rest are boosting settings left inert. Nor can
the parameters be reached through the folds, a compact model carrying
none in MATLAB. This class reports the fit instead, which is strictly
more than MATLAB offers, and everything MATLAB&rsquo;s record does carry is
published here as the KFold , Partition , X ,
Y , W and CrossValidatedModel properties.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Parameters the folds were fitted with



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
RegressionPartitionedModel.NumObservations


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 132
RegressionPartitionedModel: property NumObservations

Number of observations

A positive integer scalar. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Number of observations



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 44
RegressionPartitionedModel.NumTrainedPerFold


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 724
RegressionPartitionedModel: property NumTrainedPerFold

How many trees each fold fitted

A scalar structure with fields PredictorTrees and
InteractionTrees , each a row with one entry per fold, for a
generalized additive model backing, and empty for every other.

It reports what each fold actually fitted, which the budget in
ModelParameters does not: a phase stops early when it can no
longer improve the fit, and the folds need not stop at the same place.

MATLAB carries this on its per-learner partitioned GAM classes, which
this package deliberately does not have (see crossval ), so like
IsStandardDeviationFit it is declared here for every backing
and left empty where it does not apply.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
How many trees each fold fitted



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
RegressionPartitionedModel.Partition


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 132
RegressionPartitionedModel: property Partition

The partition the folds came from

A cvpartition object. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
The partition the folds came from



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 41
RegressionPartitionedModel.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 140
RegressionPartitionedModel: property PredictorNames

Names of the predictors

A cell array of character vectors. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
Names of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 53
RegressionPartitionedModel.RegressionPartitionedModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 243
RegressionPartitionedModel: obj = RegressionPartitionedModel ( Mdl , Partition )

Create a RegressionPartitionedModel object.

See the class documentation for what it holds and how it is reached.

See also:
crossval,
RegressionPartitionedModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
Create a RegressionPartitionedModel object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
RegressionPartitionedModel.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 129
RegressionPartitionedModel: property ResponseName

Name of the response variable

A character vector. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Name of the response variable



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 44
RegressionPartitionedModel.ResponseTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 206
RegressionPartitionedModel: property ResponseTransform

Transformation applied to the predicted response

A function handle, carried over from the model that was cross
validated. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Transformation applied to the predicted response



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
RegressionPartitionedModel.Trained


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 219
RegressionPartitionedModel: property Trained

The models fitted to each fold

A cell array with one compact model per fold, each fitted on the
observations its fold holds out of the test set. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
The models fitted to each fold



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
RegressionPartitionedModel.W


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 144
RegressionPartitionedModel: property W

Observation weights

A numeric column vector with one entry per observation. This property
is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
Observation weights



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
RegressionPartitionedModel.X


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 201
RegressionPartitionedModel: property X

Predictor data

A numeric matrix holding the observations the model was trained on,
the rows carrying missing values already removed. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
Predictor data



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
RegressionPartitionedModel.Y


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 136
RegressionPartitionedModel: property Y

Response data

A numeric column vector with one entry per row of X . This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
Response data



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
RegressionPartitionedModel.kfoldLoss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1044
RegressionPartitionedModel: L = kfoldLoss ( obj )
RegressionPartitionedModel: L = kfoldLoss (&hellip;, name , value )

Compute the cross-validated regression loss.

L = kfoldLoss ( obj ) returns the weighted mean
squared error between the response and the out-of-fold predictions of
kfoldPredict , over every observation some fold tests.

obj must be a RegressionPartitionedModel class object.

L = kfoldLoss (&hellip;, name , value ) accepts
the following Name-Value pairs.

Name Value
'LossFun' 'mse' , the default,
'epsiloninsensitive' , or a function handle called as
lossfun ( Y , yFit , W ) returning a scalar.
The epsilon -insensitive loss belongs to a support vector model
and is refused for any other, there being no tube to measure against.
'Mode' 'average' , the default, which returns
one number over the observations of every fold asked for, or
'individual' , which returns one number per fold.
'Folds' A vector of fold indices to restrict the
loss to. It defaults to every fold.

See also:
RegressionPartitionedModel,
kfoldPredict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 44
Compute the cross-validated regression loss.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
RegressionPartitionedModel.kfoldPredict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1426
RegressionPartitionedModel: yFit = kfoldPredict ( obj )
RegressionPartitionedModel: [ yFit , ySD , yInt ] = kfoldPredict ( obj )
RegressionPartitionedModel: [&hellip;] = kfoldPredict (&hellip;, 'Alpha' , alpha )

Predict the response of every observation from the fold that held it
out.

yFit = kfoldPredict ( obj ) returns a column vector
with one entry per observation, each predicted by the fold&rsquo;s model that
did not see it during training. An observation no fold tests, which a
holdout partition leaves outside its test set, comes back NaN .

obj must be a RegressionPartitionedModel class object.

[ yFit , ySD , yInt ] = kfoldPredict ( obj )
also returns the standard deviation ySD of each predicted
response and the two-column matrix yInt of prediction intervals,
each answered for by the fold that held the observation out. A
RegressionGP backing is the only one that fits the uncertainty
its predictions carry, so any other raises here. An untested
observation is NaN in all three.

[&hellip;] = kfoldPredict (&hellip;, 'Alpha' , alpha )
sets the significance level of the prediction intervals, which default
to 95 per cent at an alpha of 0.05.

ySD does not follow ResponseTransform and the other two
outputs do, the same rule RegressionGP.predict applies: a
predicted response and an interval endpoint are on the response scale
and a standard deviation is not.

See also:
RegressionPartitionedModel,
kfoldLoss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 73
Predict the response of every observation from the fold that held it out.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
RegressionPartitionedModel.kfoldfun


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 774
RegressionPartitionedModel: vals = kfoldfun ( obj , fun )

Apply a function to each fold of a cross-validated model.

vals = kfoldfun ( obj , fun ) calls fun once
per fold and returns a K&times;M numeric matrix whose row k is
what fun returned for fold k .

fun is a function handle taking seven inputs and returning a
numeric vector of the same length every time it is called:

testvals = fun ( M , Xtrain , Ytrain , Wtrain , &hellip;
Xtest , Ytest , Wtest )

M is the model the fold was fitted with, taken from
obj .Trained{k} ; Xtrain , Ytrain and
Wtrain are the predictors, response and weights of the
observations that fold was trained on, and Xtest , Ytest and
Wtest those of the observations it held out.

See also:
RegressionPartitionedModel,
kfoldPredict,
kfoldLoss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 57
Apply a function to each fold of a cross-validated model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
RegressionSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3168
statistics: obj = RegressionSVM ( X , Y )
statistics: obj = RegressionSVM (&hellip;, name , value )

Create a RegressionSVM object containing a support vector machine
regression model.

obj = RegressionSVM ( X , Y ) returns a support vector
regression model, obj , with X being the predictor data and
Y the continuous response of the observations in X .

X must be an NxP numeric matrix of predictor data, where rows
correspond to observations and columns to features.

Y must be an Nx1 numeric vector holding the response of the
corresponding predictor data in X . Y must have the same number
of rows as X .

The model is fitted by epsilon -insensitive regression: errors smaller
than Epsilon cost nothing, so only the observations outside that
tube become support vectors. Epsilon defaults to
iqr ( Y ) / 13.49 , a robust estimate of a tenth of the response&rsquo;s
standard deviation, which is what MATLAB uses.

obj = RegressionSVM (&hellip;, name , value ) returns
a model with additional options specified by Name-Value pair
arguments listed below.

Name Value
'Standardize' A logical scalar specifying whether the
predictor data should be centred and scaled before training. The same
transformation is applied by predict . The default is false .
'PredictorNames' A cell array of character vectors
naming the predictors, in the order they appear in X .
'ResponseName' A character vector naming the response.
The default is 'Y' .
'ResponseTransform' A character vector naming one of the
supported transformations, or a function handle, applied to the predicted
response by predict and resubPredict . The default is
'none' .
'Epsilon' A non-negative scalar, the half-width of the
insensitive tube. The default is iqr ( Y ) / 13.49 , or
0.1 where that is zero.
'BoxConstraint' A positive scalar bounding the dual
coefficients, the cost of an error outside the tube. The default is 1.
'KernelFunction' A character vector naming the kernel,
one of 'linear' , the default, 'rbf' , 'gaussian' ,
'polynomial' or 'sigmoid' .
'PolynomialOrder' A positive integer, the order of the
polynomial kernel. The default is 3. It is ignored by every other kernel.
'KernelScale' A positive scalar dividing the predictors
before the kernel is applied. The default is 1.
'KernelOffset' A non-negative scalar added to the kernel
value. The default is 0.
'SVMtype' A character vector selecting the formulation,
either 'eps_svr' , the default, or 'nu_svr' . MATLAB fits
only the epsilon form; 'nu_svr' is an Octave extension, in
which Nu bounds the fraction of support vectors and Epsilon
is determined by the fit rather than given.
'Nu' A scalar in (0, 1] used by
'nu_svr' . The default is 0.5.
'CacheSize' A positive scalar, the kernel cache in
megabytes. The default is 1000.
'Tolerance' A non-negative scalar, the tolerance of the
termination criterion. The default is 1e-6 .
'Shrinking' Either 0 or 1, whether to use the shrinking
heuristic. The default is 1.

The supported values for 'ResponseTransform' are:

Value Description
'none' x (no transformation)
'identity' x (no transformation)
'exp' exp (x)
'log' log (x)

See also:
fitrsvm,
ClassificationSVM,
RegressionNeuralNetwork


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 83
Create a RegressionSVM object containing a support vector machine regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
RegressionSVM.Alpha


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 418
RegressionSVM: property Alpha

Dual coefficients of the support vectors

A numeric column vector with one entry per support vector, holding the
difference of the two multipliers each observation carries. Unlike a
classifier&rsquo;s, these are signed: there are no labels to take the sign
into, so an observation above the tube and one below it are told apart
by the sign of its coefficient. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
Dual coefficients of the support vectors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
RegressionSVM.Beta


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 275
RegressionSVM: property Beta

Primal coefficients, one per predictor

A numeric column vector, equal to
obj.SupportVectors' * obj.Alpha . It exists only for a linear
kernel; for any other kernel there is no primal representation and this
is empty. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
Primal coefficients, one per predictor



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
RegressionSVM.Bias


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 174
RegressionSVM: property Bias

Intercept of the fitted function

A numeric scalar. With a linear kernel the prediction is
X * obj.Beta + obj.Bias . This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
Intercept of the fitted function



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
RegressionSVM.BinEdges


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 361
RegressionSVM: property BinEdges

Bin edges of the predictors

A cell array with one entry per predictor, holding that predictor&rsquo;s bin
edges where the learner discretized it before fitting. It is empty here
and stays empty: this learner fits the predictors as they are, and
MATLAB&rsquo;s reports an empty cell for it as well.

This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
Bin edges of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
RegressionSVM.BoxConstraints


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 265
RegressionSVM: property BoxConstraints

Box constraints

A numeric column vector with one entry per observation, holding the box
constraint the fit applied to it. A regression has no classes to
reweight, so every entry is BoxConstraint . This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
Box constraints



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
RegressionSVM.CategoricalPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 173
RegressionSVM: property CategoricalPredictors

Indices of the categorical predictors

A numeric vector of column indices, and empty when none is. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Indices of the categorical predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
RegressionSVM.Epsilon


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 226
RegressionSVM: property Epsilon

Half-width of the insensitive tube

A non-negative scalar. An error smaller than Epsilon costs
nothing, so only observations outside the tube become support vectors.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
Half-width of the insensitive tube



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
RegressionSVM.ExpandedPredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 162
RegressionSVM: property ExpandedPredictorNames

Names of the predictors as the model expanded them

A cell array of character vectors. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
Names of the predictors as the model expanded them



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
RegressionSVM.HyperparameterOptimizationResults


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 356
RegressionSVM: property HyperparameterOptimizationResults

Results of the hyperparameter optimization

Always empty. It is declared for MATLAB compatibility, where
it holds what an automatic search over the hyperparameters found. This
class fits the parameters it is given and runs no such search, so there
is nothing to report. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Results of the hyperparameter optimization



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
RegressionSVM.IsSupportVector


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 182
RegressionSVM: property IsSupportVector

Which training observations are support vectors

A logical column vector with one entry per training observation. This
property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
Which training observations are support vectors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
RegressionSVM.KernelParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 368
RegressionSVM: property KernelParameters

Parameters of the kernel function

A structure with fields Function and Scale , and
Order for a polynomial kernel. Function names the
kernel as MATLAB names it, so a radial basis kernel reports
'gaussian' whichever spelling was given; the kernel the fit was
handed is unchanged in ModelParameters . This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
Parameters of the kernel function



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
RegressionSVM.ModelParameters


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 734
RegressionSVM: property ModelParameters

Parameters the model was fitted with

A structure holding the SVM formulation, the kernel and its parameters,
the box constraint, Epsilon and the solver settings. The engine
is LIBSVM and the record is LIBSVM&rsquo;s, so SVMtype names its
formulation and Tolerance and Shrinking are its own
controls; the parameters MathWorks reports for its SMO and ISDA solvers
are absent, this class running neither.

KernelPolynomialOrder belongs to the polynomial kernel alone
and is empty under every other, as it is in MATLAB. Nu is
reported here where MATLAB leaves it empty on a regression model, this
class offering 'nu_svr' through SVMtype and the value
being a real one. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
Parameters the model was fitted with



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
RegressionSVM.Mu


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 201
RegressionSVM: property Mu

Mean of the predictors

A row vector with one entry per predictor, used for standardization.
Empty when the predictor data were not standardized. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
Mean of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
RegressionSVM.NumObservations


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 211
RegressionSVM: property NumObservations

Number of observations used to train the model

A positive integer scalar, counting only the rows that survived the
removal of missing values. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
Number of observations used to train the model



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
RegressionSVM.NumPredictors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 115
RegressionSVM: property NumPredictors

Number of predictors

A positive integer scalar. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
Number of predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
RegressionSVM.PredictorNames


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 127
RegressionSVM: property PredictorNames

Names of the predictors

A cell array of character vectors. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
Names of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
RegressionSVM.RegressionSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 288
RegressionSVM: obj = RegressionSVM ( X , Y )
RegressionSVM: obj = RegressionSVM (&hellip;, name , value )

Create a RegressionSVM object containing a support vector
machine regression model.

See the class documentation for the accepted Name-Value pairs.

See also:
fitrsvm,
RegressionSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 83
Create a RegressionSVM object containing a support vector machine regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
RegressionSVM.ResponseName


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 116
RegressionSVM: property ResponseName

Name of the response variable

A character vector. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Name of the response variable



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
RegressionSVM.ResponseTransform


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 304
RegressionSVM: property ResponseTransform

Transformation applied to the predicted response

A function handle, applied by predict and resubPredict to
the model&rsquo;s output. It defaults to the identity and may be set after
construction, either to a handle or to the name of a supported
transformation.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Transformation applied to the predicted response



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
RegressionSVM.RowsUsed


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 378
RegressionSVM: property RowsUsed

Rows used for fitting

A logical column vector with the same length as the observations in the
original predictor data X , true for each row that was used for
fitting the RegressionSVM model. It is empty, [] ,
when every observation was used, so a non-empty value means that rows
holding missing values were dropped. This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
Rows used for fitting



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
RegressionSVM.Sigma


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 218
RegressionSVM: property Sigma

Standard deviation of the predictors

A row vector with one entry per predictor, used for standardization.
Empty when the predictor data were not standardized. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
Standard deviation of the predictors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
RegressionSVM.SupportVectors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 224
RegressionSVM: property SupportVectors

The support vectors themselves

A numeric matrix with one row per support vector, on the scale the
model was trained on, standardized where Mu is non-empty.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
The support vectors themselves



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
RegressionSVM.W


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 188
RegressionSVM: property W

Observation weights

A numeric column vector with one entry per training observation,
normalized to sum to one, as MATLAB reports it. This property is
read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
Observation weights



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
RegressionSVM.X


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 132
RegressionSVM: property X

Predictor data

An NxP numeric matrix, as it was supplied to the constructor.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
Predictor data



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
RegressionSVM.Y


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 131
RegressionSVM: property Y

Response data

An Nx1 numeric vector, as it was supplied to the constructor.
This property is read-only.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
Response data



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
RegressionSVM.compact


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 359
RegressionSVM: CMdl = compact ( obj )

Create a CompactRegressionSVM object.

CMdl = compact ( obj ) returns a compact version of
the RegressionSVM object obj , which keeps the support
vectors and their coefficients but drops the training data, so it
predicts identically while carrying no observations.

See also:
fitrsvm,
RegressionSVM,
CompactRegressionSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
Create a CompactRegressionSVM object.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
RegressionSVM.crossval


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 869
RegressionSVM: CVMdl = crossval ( obj )
RegressionSVM: CVMdl = crossval (&hellip;, name , value )

Cross validate a support vector regression model.

CVMdl = crossval ( obj ) returns a
RegressionPartitionedModel holding one refit of obj per
fold of a ten-fold partition, or of an n -fold one where the
model has fewer than ten observations.

obj must be a RegressionSVM class object.

CVMdl = crossval (&hellip;, name , value )
accepts one, and only one, of the following Name-Value pairs.

Name Value
'KFold' An integer greater than 1, the number of
folds.
'Holdout' A scalar in (0, 1) , the fraction
of observations held out for testing.
'Leaveout' 'on' or 'off' , whether
to hold out one observation at a time.
'CVPartition' A cvpartition object over as
many observations as the model was trained on.

See also:
RegressionSVM,
RegressionPartitionedModel,
cvpartition


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Cross validate a support vector regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
RegressionSVM.discardSupportVectors


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 591
RegressionSVM: obj = discardSupportVectors ( obj )

Discard the support vectors of a linear SVM model.

obj = discardSupportVectors ( obj ) empties
Alpha and SupportVectors , leaving Beta and
Bias to decide every prediction. A linear kernel needs
nothing else, so the returned model predicts what it predicted
before while carrying one vector in place of many.

The kernel must be linear. Under any other the support vectors are
part of the decision function and cannot be dropped. Discarding twice
is not an error and changes nothing.

See also:
fitrsvm,
RegressionSVM,
CompactRegressionSVM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
Discard the support vectors of a linear SVM model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
RegressionSVM.loss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1078
RegressionSVM: L = loss ( obj , X , Y )
RegressionSVM: L = loss (&hellip;, name , value )

Compute the regression loss of a support vector machine model.

L = loss ( obj , X , Y ) returns the
weighted mean squared error between the response Y and the
response the model predicts for X .

obj must be a RegressionSVM class object.

X must be a numeric matrix with the same number of predictors as
the data the model was trained on.

Y must be a numeric vector with as many rows as X .

L = loss (&hellip;, name , value ) accepts the
following Name-Value pairs.

Name Value
'LossFun' 'mse' , the default,
'epsiloninsensitive' , or a function handle called as
lossfun ( Y , yFit , W ) returning a scalar.
The epsilon -insensitive loss charges nothing for an error inside
the tube, max (0, abs ( Y - yFit ) - Epsilon) , which is
the quantity the fit itself minimizes.
'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:
RegressionSVM,
fitrsvm


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 62
Compute the regression loss of a support vector machine model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
RegressionSVM.predict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 510
RegressionSVM: yFit = predict ( obj , XC )

Predict the response for new data with a support vector regression
model.

yFit = predict ( obj , XC ) returns a column
vector holding the predicted response for each row of XC .

obj must be a RegressionSVM class object.

XC must be a numeric matrix with the same number of predictors as
the data the model was trained on.

The transformation named by ResponseTransform is applied to the
model&rsquo;s output before it is returned.

See also:
RegressionSVM,
fitrsvm


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 73
Predict the response for new data with a support vector regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
RegressionSVM.resubLoss


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 401
RegressionSVM: L = resubLoss ( obj )
RegressionSVM: L = resubLoss (&hellip;, name , value )

Compute the resubstitution regression loss of a support vector machine
model.

L = resubLoss ( obj ) returns the weighted mean
squared error of the model on the data it was trained on. It accepts
the same Name-Value pairs as loss .

obj must be a RegressionSVM class object.

See also:
RegressionSVM,
fitrsvm


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 77
Compute the resubstitution regression loss of a support vector machine model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
RegressionSVM.resubPredict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 334
RegressionSVM: yFit = resubPredict ( obj )

Predict the response of the training data with a support vector
regression model.

yFit = resubPredict ( obj ) returns a column vector
holding the predicted response for every observation the model was
trained on.

obj must be a RegressionSVM class object.

See also:
RegressionSVM,
fitrsvm


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 81
Predict the response of the training data with a support vector regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
RegressionSVM.savemodel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 299
RegressionSVM: savemodel ( obj , filename )

Save a support vector regression model to a file.

savemodel ( obj , filename ) saves every property of
the RegressionSVM object obj into filename in
binary format, so that it can be read back with loadmodel .

See also:
loadmodel,
RegressionSVM,
fitrsvm


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
Save a support vector regression model to a file.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
fitcdiscr


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3115
statistics: Mdl = fitcdiscr ( X , Y )
statistics: Mdl = fitcdiscr (&hellip;, name , value )

Fit a Linear Discriminant Analysis classification model.

Mdl = fitcdiscr ( X , Y ) returns a Linear Discriminant
Analysis (LDA) classification model, Mdl , with X being the
predictor data, and Y the class labels of observations in X .

X must be a N&times;P numeric matrix of predictor data where rows
correspond to observations and columns correspond to features or variables.

Y is N&times;1 matrix or cell matrix containing the class labels of
corresponding predictor data in X . Y can be numerical, logical,
char array or cell array of character vectors. Y must have same number
of rows as X .

Mdl = fitcdiscr (&hellip;, name , value ) returns a
Linear Discriminant Analysis model with additional options specified by
Name-Value pair arguments listed below.

Model Parameters

Name Value
'PredictorNames' A cell array of character vectors
specifying the names of the predictors. The length of this array must match
the number of columns in X .
'ResponseName' A character vector specifying the
name of the response variable.
'ClassNames' Names of the classes in the class
labels, Y , used for fitting the Discriminant model. ClassNames
are of the same type as the class labels in Y .
'Prior' A numeric vector specifying the prior
probabilities for each class. The order of the elements in Prior
corresponds to the order of the classes in ClassNames .
Alternatively, you can specify 'empirical' to use the empirical
class probabilities or 'uniform' to assume equal class probabilities.
'Cost' A N&times;R numeric matrix containing
misclassification cost for the corresponding instances in X where
R is the number of unique categories in Y . If an instance is
correctly classified into its category the cost is calculated to be 1,
otherwise 0. cost matrix can be altered use Mdl.cost = somecost .
default value cost = ones(rows(X),numel(unique(Y))) .
'DiscrimType' A character vector naming the type of
discriminant analysis to perform, one of 'linear' (default),
'quadratic' , 'diagLinear' , 'diagQuadratic' ,
'pseudoLinear' or 'pseudoQuadratic' . A linear type pools
one covariance across the classes and a quadratic type estimates one per
class; a 'diag' type keeps only the variances, and a
'pseudo' type inverts a singular covariance rather than refusing
it. The property may be reassigned after fitting, but only within its own
family, since the family decides which covariances the fit estimates.
'FillCoeffs' A character vector or string scalar
with values 'on' or 'off' specifying whether to fill the
coefficients after fitting. If set to 'on' , the coefficients are
computed during model fitting, which can be useful for prediction.
'Gamma' A numeric scalar specifying the
regularization parameter for the covariance matrix. It adjusts the linear
discriminant analysis to make the model more stable in the presence of
multicollinearity or small sample sizes. A value of 0 corresponds to no
regularization, while a value of 1 corresponds to
a completely regularized model.

See also:
ClassificationDiscriminant


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 56
Fit a Linear Discriminant Analysis classification model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
fitcgam


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6651
statistics: Mdl = fitcgam ( X , Y )
statistics: Mdl = fitcgam (&hellip;, name , value )

Fit a Generalized Additive Model (GAM) for binary classification.

Mdl = fitcgam ( X , Y ) returns a GAM classification
model, Mdl , with X being the predictor data, and Y the
binary class labels of observations in X .

X must be a N&times;P numeric matrix of predictor data where rows
correspond to observations and columns correspond to features or variables.

Y is N&times;1 numeric vector containing binary class labels,
typically 0 or 1.

Mdl = fitcgam (&hellip;, name , value ) returns a
GAM classification model with additional options specified by
Name-Value pair arguments listed below.

Model Parameters

Name Value
'FitMethod' A character vector selecting the weak
learner, either 'boostedtrees' or 'splines' . The default
is 'boostedtrees' , which boosts one shallow decision tree per
predictor and is the scheme MATLAB uses. 'splines' boosts a
smoothing spline per predictor instead and is an Octave extension. The
two take different options and an option meant for one is refused by the
other rather than ignored, so the rows below say which engine each
belongs to.
'PredictorNames' A cell array of character vectors
specifying the names of the predictors. The length of this array must match
the number of columns in X .
'ResponseName' A character vector specifying the
name of the response variable.
'ClassNames' Names of the classes in the class
labels, Y , used for fitting the Discriminant model. ClassNames
are of the same type as the class labels in Y .
'Cost' A N&times;R numeric matrix containing
misclassification cost for the corresponding instances in X where
R is the number of unique categories in Y . If an instance is
correctly classified into its category the cost is calculated to be 1,
otherwise 0. cost matrix can be altered use Mdl.cost = somecost .
default value cost = ones(rows(X),numel(unique(Y))) .
'Formula' (spline option) A model specification given as a
string in
the form 'Y ~ terms' where Y represents the response variable
and terms the predictor variables. The formula can be used to
specify a subset of variables for training model. For example:
'Y ~ x1 + x2 + x3 + x4 + x1:x2 + x2:x3' specifies four linear terms
for the first four columns of for predictor data, and x1:x2 and
x2:x3 specify the two interaction terms for 1st-2nd and 3rd-4th
columns respectively. Only these terms will be used for training the model,
but X must have at least as many columns as referenced in the formula.
If Predictor Variable names have been defined, then the terms in the formula
must reference to those. When 'formula' is specified, all terms used
for training the model are referenced in the IntMatrix field of the
obj class object as a matrix containing the column indexes for each
term including both the predictors and the interactions used.
'Interactions' A logical matrix, a positive integer
scalar, or the string 'all' for defining the interactions between
predictor variables. When given a logical matrix, it must have the same
number of columns as X and each row corresponds to a different
interaction term combining the predictors indexed as true . Each
interaction term is appended as a column vector after the available predictor
column in X . When 'all' is defined, then all possible
combinations of interactions are appended in X before training. At the
moment, parsing a positive integer has the same effect as the 'all'
option. When 'interactions' is specified, only the interaction terms
appended to X are referenced in the IntMatrix field of the
obj class object.
'Knots' (spline option) A scalar or a row vector
with the same
columns as X . It defines the knots for fitting a polynomial when
training the GAM. As a scalar, it is expanded to a row vector. The default
value is 5, hence expanded to ones (1, columns (X)) * 5 . You can
parse a row vector with different number of knots for each predictor
variable to be fitted with, although not recommended.
'Order' (spline option) A scalar or a row vector
with the same
columns as X . It defines the order of the polynomial when training the
GAM. As a scalar, it is expanded to a row vector. The default values is 3,
hence expanded to ones (1, columns (X)) * 3 . You can parse a row
vector with different number of polynomial order for each predictor variable
to be fitted with, although not recommended.
'DoF' (spline option) A scalar or a row vector
with the same columns
as X . It defines the degrees of freedom for fitting a polynomial when
training the GAM. As a scalar, it is expanded to a row vector. The default
value is 8, hence expanded to ones (1, columns (X)) * 8 . You can
parse a row vector with different degrees of freedom for each predictor
variable to be fitted with, although not recommended.

The rows above marked as spline options require
'FitMethod', 'splines' . The remaining options belong to the
boosted-tree engine and require 'FitMethod', 'boostedtrees' , which
is the default.

Name Value
'NumTreesPerPredictor' A positive integer, the number of
boosting rounds of the predictor phase. It is a budget rather than a
count: a fit that stops improving ends earlier and reports so. The default
is 300.
'NumTreesPerInteraction' A positive integer, the same
budget for the interaction phase. The default is 100.
'MaxNumSplitsPerPredictor' A positive integer, the
largest number of splits any one predictor tree may make. The default is
1, which makes each tree a stump.
'MaxNumSplitsPerInteraction' The same limit for a tree
over a pair of predictors. The default is 4.
'InitialLearnRateForPredictors' A value greater than 0
and at most 1, the step a round of the predictor phase starts at. A round
that fails to improve the fit is retried at half the step, so this is an
initial value rather than a fixed one. The default is 1.
'InitialLearnRateForInteractions' The same for the
interaction phase. The default is 1.
'MaxPValue' A value between 0 and 1. A candidate pair
of predictors is kept only if its interaction test gives a p -value
no larger than this. The default is 1, which keeps every pair asked for.
'Verbose' A non-negative integer. Greater than zero
prints a trace of the fit. The default is 0.
'NumPrint' A positive integer, how often the trace
reports: the first round and then every NumPrint rounds. The
default is 10.

You can parse either a 'Formula' or an 'Interactions'
optional parameter. Parsing both parameters will result an error.
Accordingly, you can only pass up to two parameters among 'Knots' ,
'Order' , and 'DoF' to define the required polynomial for
training the GAM model.

See also:
ClassificationGAM


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 65
Fit a Generalized Additive Model (GAM) for binary classification.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
fitckernel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1171
statistics: Mdl = fitckernel ( X , Y )
statistics: Mdl = fitckernel (&hellip;, name , value )
statistics: [ Mdl , FitInfo ] = fitckernel (&hellip;)

Fit a Gaussian kernel binary classifier.

Mdl = fitckernel ( X , Y ) returns a
ClassificationKernel object fitted to the predictor data X
and the two class response Y , where X is an NxP
numeric matrix and Y has as many rows as X .

Mdl = fitckernel (&hellip;, name , value ) passes
the given Name-Value pairs to the model. They are documented
under ClassificationKernel , and the ones most often wanted are
'Learner' , 'NumExpansionDimensions' ,
'KernelScale' , 'Lambda' , 'BoxConstraint' and
'Standardize' .

[ Mdl , FitInfo ] = fitckernel (&hellip;) also returns a
structure describing the optimization: the objective it reached, the
gradient it left, and the tolerances it was given.

Mdl = fitckernel (&hellip;, cvopt , value ) returns a
ClassificationPartitionedKernel
instead when one of 'CrossVal' , 'KFold' ,
'Holdout' , 'Leaveout' and 'CVPartition' is
given. A cross-validated model describes no single fit, so
FitInfo is not available beside it.

See also:
ClassificationKernel,
ClassificationLinear,
fitclinear


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
Fit a Gaussian kernel binary classifier.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
fitcknn


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10489
statistics: Mdl = fitcknn ( X , Y )
statistics: Mdl = fitcknn (&hellip;, name , value )

Fit a k-Nearest Neighbor classification model.

Mdl = fitcknn ( X , Y ) returns a k-Nearest Neighbor
classification model, Mdl , with X being the predictor data, and
Y the class labels of observations in X .

X must be a N&times;P numeric matrix of predictor data where rows
correspond to observations and columns correspond to features or variables.

Y is N&times;1 matrix or cell matrix containing the class labels of
corresponding predictor data in X . Y can be numerical, logical,
char array or cell array of character vectors. Y must have same number
of rows as X .

Mdl = fitcknn (&hellip;, name , value ) returns a
k-Nearest Neighbor classification model with additional options specified by
Name-Value pair arguments listed below.

Model Parameters

Name Value
'Standardize' A boolean flag indicating whether
the data in X should be standardized prior to training.
'PredictorNames' A cell array of character vectors
specifying the predictor variable names. The variable names are assumed to
be in the same order as they appear in the training data X .
'ResponseName' A character vector specifying the name
of the response variable.
'ClassNames' Names of the classes in the class
labels, Y , used for fitting the kNN model. ClassNames are of
the same type as the class labels in Y .
'Prior' A numeric vector specifying the prior
probabilities for each class. The order of the elements in Prior
corresponds to the order of the classes in ClassNames .
'Cost' A N&times;R numeric matrix containing
misclassification cost for the corresponding instances in X where
R is the number of unique categories in Y . If an instance is
correctly classified into its category the cost is calculated to be 1,
otherwise 0. cost matrix can be altered use Mdl.cost = somecost .
default value cost = ones(rows(X),numel(unique(Y))) .
'ScoreTransform' A character vector defining one of
the following functions or a user defined function handle, which is used
for transforming the prediction scores returned by the predict and
resubPredict methods. Default value is 'none' .

Value Description
'doublelogit' 1 ./ (1 + exp (-2 &times; x))
'invlogit' log (x ./ (1 - x))
'ismax' Sets the score for the class with the largest
score to 1, and sets the scores for all other classes to 0
'logit' 1 ./ (1 + exp (-x))
'none' x (no transformation)
'identity' x (no transformation)
'sign' -1 for x < 0, 0 for x = 0, 1 for x > 0
'symmetric' 2 &times; x - 1
'symmetricismax' Sets the score for the class with
the largest score to 1, and sets the scores for all other classes to -1
'symmetriclogit' 2 ./ (1 + exp (-x)) - 1

Name Value
'BreakTies' Tie-breaking algorithm used by predict
when multiple classes have the same smallest cost. By default, ties occur
when multiple classes have the same number of nearest points among the
k nearest neighbors. The available options are specified by the
following character arrays:

Value Description
'smallest' This is the default and it favors the
class with the smallest index among the tied groups, i.e. the one that
appears first in the training labelled data.
'nearest' This favors the class with the nearest
neighbor among the tied groups, i.e. the class with the closest member point
according to the distance metric used.
'random' This randomly picks one class among the
tied groups.

Name Value
'BucketSize' The maximum number of data points in the
leaf node of the Kd-tree and it must be a positive integer. By default, it
is 50. This argument is meaningful only when the selected search method is
'kdtree' .
'NumNeighbors' A positive integer value specifying
the number of nearest neighbors to be found in the kNN search. By default,
it is 1.
'Exponent' A positive scalar (usually an integer)
specifying the Minkowski distance exponent. This argument is only valid when
the selected distance metric is 'minkowski' . By default it is 2.
'Scale' A nonnegative numeric vector specifying the
scale parameters for the standardized Euclidean distance. The vector length
must be equal to the number of columns in X . This argument is only
valid when the selected distance metric is 'seuclidean' , in which
case each coordinate of X is scaled by the corresponding element of
'scale' , as is each query point in Y . By default, the scale
parameter is the standard deviation of each coordinate in X . If a
variable in X is constant, i.e. zero variance, this value is forced
to 1 to avoid division by zero. This is the equivalent of this variable not
being standardized.
'Cov' A square matrix with the same number of columns
as X specifying the covariance matrix for computing the mahalanobis
distance. This must be a positive definite matrix matching. This argument
is only valid when the selected distance metric is 'mahalanobis' .
'Distance' is the distance metric used by
knnsearch as specified below:

Value Description
'euclidean' Euclidean distance.
'seuclidean' standardized Euclidean distance. Each
coordinate difference between the rows in X and the query matrix
Y is scaled by dividing by the corresponding element of the standard
deviation computed from X . To specify a different scaling, use the
'Scale' name-value argument.
'cityblock' City block distance.
'chebychev' Chebychev distance (maximum coordinate
difference).
'minkowski' Minkowski distance. The default exponent
is 2. To specify a different exponent, use the 'P' name-value
argument.
'mahalanobis' Mahalanobis distance, computed using a
positive definite covariance matrix. To change the value of the covariance
matrix, use the 'Cov' name-value argument.
'cosine' Cosine distance.
'correlation' One minus the sample linear correlation
between observations (treated as sequences of values).
'spearman' One minus the sample Spearman&rsquo;s rank
correlation between observations (treated as sequences of values).
'hamming' Hamming distance, which is the percentage
of coordinates that differ.
'jaccard' One minus the Jaccard coefficient, which is
the percentage of nonzero coordinates that differ.
@distfun Custom distance function handle. A distance
function of the form function D2 = distfun ( XI , YI ) ,
where XI is a 1&times;P vector containing a single observation in
P -dimensional space, YI is an N&times;P matrix containing an
arbitrary number of observations in the same P -dimensional space, and
D2 is an N&times;P vector of distances, where ( D2 k) is
the distance between observations XI and ( YI k,:) .

Name Value
'DistanceWeight' A distance weighting function,
specified either as a function handle, which accepts a matrix of nonnegative
distances and returns a matrix the same size containing nonnegative distance
weights, or one of the following values: 'equal' , which corresponds
to no weighting; 'inverse' , which corresponds to a weight equal to
1/distance ; 'squaredinverse' , which corresponds to a weight
equal to 1/distance^2 .
'CacheSize' A positive scalar, the cache size in
megabytes, 1000 by default. It is stored and reported for compatibility
and does not affect the fit or any prediction : a nearest-neighbour
model keeps no Gram matrix to cache, holding its training data and
computing each distance when asked. MATLAB hides the same property from
properties , where this package reports it.
'IncludeTies' A boolean flag to indicate if the
returned values should contain the indices that have same distance as the
K^th neighbor. When false , knnsearch chooses the
observation with the smallest index among the observations that have the same
distance from a query point. When true , knnsearch includes
all nearest neighbors whose distances are equal to the K^th smallest
distance in the output arguments. To specify K , use the 'K'
name-value pair argument.
'NSMethod' is the nearest neighbor search method used
by knnsearch as specified below.

Value Description
'kdtree' Creates and uses a Kd-tree to find nearest
neighbors. 'kdtree' is the default value when the number of columns
in X is less than or equal to 10, X is not sparse, and the
distance metric is 'euclidean' , 'cityblock' ,
'manhattan' , 'chebychev' , or 'minkowski' . Otherwise,
the default value is 'exhaustive' . This argument is only valid when
the distance metric is one of the four aforementioned metrics.
'exhaustive' Uses the exhaustive search algorithm by
computing the distance values from all the points in X to each point in
Y .

Cross Validation Options

Name Value
'Crossval' Cross-validation flag specified as
'on' or 'off' . If 'on' is specified, a 10-fold
cross validation is performed and a ClassificationPartitionedModel is
returned in Mdl . To override this cross-validation setting, use only
one of the following Name-Value pair arguments.
'CVPartition' A cvpartition object that
specifies the type of cross-validation and the indexing for the training and
validation sets. A ClassificationPartitionedModel is returned in
Mdl and the trained model is stored in the Trained property.
'Holdout' Fraction of the data used for holdout
validation, specified as a scalar value in the range [0,1] . When
specified, a randomly selected percentage is reserved as validation data and
the remaining set is used for training. The trained model is stored in the
Trained property of the ClassificationPartitionedModel returned
in Mdl . 'Holdout' partitioning attempts to ensure that each
partition represents the classes proportionately.
'KFold' Number of folds to use in the cross-validated
model, specified as a positive integer value greater than 1. When specified,
then the data is randomly partitioned in k sets and for each set, the
set is reserved as validation data while the remaining k-1 sets are
used for training. The trained models are stored in the Trained
property of the ClassificationPartitionedModel returned in Mdl .
'KFold' partitioning attempts to ensure that each partition
represents the classes proportionately.
'Leaveout' Leave-one-out cross-validation flag
specified as 'on' or 'off' . If 'on' is specified,
then for each of the n observations (where n is the number of
observations, excluding missing observations, specified in the
NumObservations property of the model), one observation is reserved as
validation data while the remaining observations are used for training. The
trained models are stored in the Trained property of the
ClassificationPartitionedModel returned in Mdl .

See also:
ClassificationKNN,
ClassificationPartitionedModel,
knnsearch,
rangesearch,
pdist2


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
Fit a k-Nearest Neighbor classification model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
fitclinear


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1240
statistics: Mdl = fitclinear ( X , Y )
statistics: Mdl = fitclinear (&hellip;, name , value )
statistics: [ Mdl , FitInfo ] = fitclinear (&hellip;)

Fit a linear binary classifier.

Mdl = fitclinear ( X , Y ) returns a
ClassificationLinear object fitted to the predictor data X
and the two class response Y , where X is an NxP
numeric matrix and Y has as many rows as X .

Mdl = fitclinear (&hellip;, name , value ) passes
the given Name-Value pairs to the model. They are documented
under ClassificationLinear , and the ones most often wanted are
'Learner' , 'Regularization' , 'Lambda' ,
'Solver' and 'ObservationsIn' .

[ Mdl , FitInfo ] = fitclinear (&hellip;) also returns a
structure describing the optimization: what it converged to, how far it
got, and which tolerance stopped it. Its fields follow the solver, so a
dual fit reports the dual variables and a mini-batch fit the batch it
stopped on.

Mdl = fitclinear (&hellip;, cvopt , value ) returns a
ClassificationPartitionedLinear
instead when one of 'CrossVal' , 'KFold' ,
'Holdout' , 'Leaveout' and 'CVPartition' is
given. A cross-validated model describes no single fit, so
FitInfo is not available beside it.

See also:
ClassificationLinear,
ClassificationKernel,
fitckernel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Fit a linear binary classifier.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
fitcnb


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 3518
statistics: Mdl = fitcnb ( X , Y )
statistics: Mdl = fitcnb (&hellip;, name , value )

Fit a naive Bayes classification model.

Mdl = fitcnb ( X , Y ) returns a naive Bayes
classification model, Mdl , with X being the predictor data and
Y the class labels of the observations in X .

X must be a N&times;P numeric matrix of predictor data where rows
correspond to observations and columns correspond to features or variables.

Y is an N&times;1 matrix or cell matrix containing the class labels
of the corresponding predictor data in X . Y can be numeric,
logical, a character array or a cell array of character vectors. Y
must have the same number of rows as X .

A naive Bayes model fits one univariate density to each predictor within
each class, and treats the predictors as conditionally independent given the
class. An observation&rsquo;s likelihood under a class is therefore the product
of its per-predictor densities, and its posterior follows by Bayes&rsquo; rule
from the class prior.

Mdl = fitcnb (&hellip;, name , value ) returns a naive
Bayes model with additional options specified by Name-Value pair
arguments listed below.

Model Parameters

Name Value
'PredictorNames' A cell array of character vectors
specifying the names of the predictors. The length of this array must match
the number of columns in X .
'ResponseName' A character vector specifying the name of
the response variable.
'ClassNames' Names of the classes in the class labels,
Y , used for fitting the model. ClassNames are of the same
type as the class labels in Y . Naming a subset of the classes keeps
only the observations belonging to them.
'Prior' A numeric vector specifying the prior probability
of each class, in the order of ClassNames , or the character vector
'empirical' (default) to take the class frequencies, or
'uniform' to give every class the same probability.
'Cost' A square numeric matrix of misclassification
costs, where Cost(i,j) is the cost of classifying an observation of
class i into class j . The default is one off the diagonal and
zero on it.
'ScoreTransform' A character vector naming a transform
applied to the posterior returned by predict , or a function handle
taking and returning a matrix of the same size. The default is
'none' .
'DistributionNames' A character vector naming the
distribution fitted to every predictor, or a cell array of character vectors
naming one per predictor. Supported are 'normal' (default),
'kernel' , 'mvmn' for a categorical predictor, and
'mn' for token counts. 'mn' describes the whole predictor
vector at once and so cannot be named for only some predictors.
'Kernel' The smoothing kernel of the predictors fitted
with a kernel density, one of 'normal' (default), 'box' ,
'epanechnikov' or 'triangle' , given once for every predictor
or once per predictor.
'Support' The support of the kernel densities, either
'unbounded' (default), 'positive' , or a two element numeric
vector giving finite bounds.
'Width' The bandwidth of the kernel densities, given as a
scalar, as one value per predictor, as one per class, or as a matrix of one
per class and predictor. By default each density chooses its own.

A predictor that takes one value throughout a class has no normal density
to fit, and that combination of class and predictor is refused rather than
answered. Only the combination is refused, not the model: giving that
predictor a 'kernel' or a 'mvmn' distribution fits the same
data, and leaves the other predictors normal.

See also:
ClassificationNaiveBayes


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
Fit a naive Bayes classification model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
fitcnet


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 5846
statistics: Mdl = fitcnet ( X , Y )
statistics: Mdl = fitcnet (&hellip;, name , value )

Fit a Neural Network classification model.

Mdl = fitcnet ( X , Y ) returns a Neural Network
classification model, Mdl , with X being the predictor data, and
Y the class labels of observations in X .

X must be a N&times;P numeric matrix of predictor data where rows
correspond to observations and columns correspond to features or variables.

Y is N&times;1 matrix or cell matrix containing the class labels of
corresponding predictor data in X . Y can contain any type of
categorical data. Y must have same numbers of rows as X .

Mdl = fitcnet (&hellip;, name , value ) returns a
Neural Network classification model with additional options specified by
Name-Value pair arguments listed below.

Model Parameters

Name Value
'Standardize' A boolean flag indicating whether
the data in X should be standardized prior to training.
'PredictorNames' A cell array of character vectors
specifying the predictor variable names. The variable names are assumed to
be in the same order as they appear in the training data X .
'ResponseName' A character vector specifying the name
of the response variable.
'ClassNames' Names of the classes in the class
labels, Y , used for fitting the Neural Network model.
ClassNames are of the same type as the class labels in Y .
'Prior' A numeric vector specifying the prior
probabilities for each class. The order of the elements in Prior
corresponds to the order of the classes in ClassNames .
'LayerSizes' A vector of positive integers that
defines the sizes of the fully connected layers in the neural network model.
Each element in LayerSizes corresponds to the number of outputs for the
respective fully connected layer in the neural network model.
The default value is 10.
'LearningRate' A positive scalar value that defines
the learning rate during the gradient descent. Default value is 0.003.
A larger rate can drive every unit of a hidden layer negative, after which
a rectifier passes no gradient and the network stops training.
Applies only when 'Solver' is 'sgd' .
'Solver' A character vector naming the solver that
trains the network, either 'lbfgs' or 'sgd' . The
default is 'lbfgs' , which minimizes the loss over the whole
training set at once by limited-memory BFGS, as MATLAB does. It takes
no learning rate, stops on the three tolerances below, and reaches a
lower training loss in fewer passes over the data, though each of its
iterations costs several passes where an epoch costs one.
'sgd' visits the samples one at a time and steps down the
gradient of each, running for 'IterationLimit' epochs; it was
the default before version 1.9.0.
'GradientTolerance' A nonnegative scalar. Training
stops once the gradient&rsquo;s infinity norm falls to or below it, which is
the quantity MATLAB tests too. The default is 1e-6 . Applies
only when 'Solver' is 'lbfgs' .
'StepTolerance' A nonnegative scalar. Training
stops once the step&rsquo;s infinity norm falls to or below it, which is the
quantity MATLAB tests too. The default is 1e-6 . Applies only
when 'Solver' is 'lbfgs' .
'LossTolerance' A real scalar. Training stops once
the training loss falls to or below it. The test is on the loss
itself and not on its change, matching MATLAB; pass -Inf to
switch it off. The default is 1e-6 . Applies only when
'Solver' is 'lbfgs' .
'Activations' A character vector or a cellstr vector
specifying the activation functions for the hidden layers of the neural
network (excluding the output layer). The available activation functions
are 'linear' , 'sigmoid' , 'relu' , 'tanh' ,
'softmax' , 'lrelu' , 'prelu' , 'elu' ,
'gelu' , and 'none' . The default value is 'relu' .
'OutputLayerActivation' A character vector specifying
the activation function for the output layer of the neural network. The
available activation functions are the same as for 'Activations' .
The default value is 'softmax' , which makes the returned scores a
probability over the classes and trains the network against cross entropy;
any other value trains it against the mean squared error.
'IterationLimit' A positive integer scalar that
specifies the maximum number of training iterations. The default value is
1000.
Under 'sgd' this counts epochs, under
'lbfgs' solver iterations.
'DisplayInfo' A boolean flag indicating whether to
print information during training. Default is false .
'ScoreTransform' A character vector defining one of
the following functions or a user defined function handle, which is used
for transforming the prediction scores returned by the predict and
resubPredict methods. Default value is 'none' .

Value Description
'doublelogit' 1 ./ (1 + exp (-2 &times; x))
'invlogit' log (x ./ (1 - x))
'ismax' Sets the score for the class with the largest
score to 1, and sets the scores for all other classes to 0
'logit' 1 ./ (1 + exp (-x))
'none' x (no transformation)
'identity' x (no transformation)
'sign' -1 for x < 0, 0 for x = 0, 1 for x > 0
'symmetric' 2 &times; x - 1
'symmetricismax' Sets the score for the class with
the largest score to 1, and sets the scores for all other classes to -1
'symmetriclogit' 2 ./ (1 + exp (-x)) - 1

The weights of each layer are drawn from a uniform range whose half-width
is set by that layer&rsquo;s activation, and the scheme cannot be chosen: a
rectifying activation ( 'relu' , 'lrelu' , 'prelu' ,
'elu' , 'gelu' ) takes the He range
sqrt (6 / fan_in) , because it passes only half of its input, and
the remaining activations take the Glorot range
sqrt (6 / (fan_in + fan_out)) , which accounts for the backward pass
as well. A network whose layers do not share an activation is therefore
built with both schemes. What each layer was given is reported by the
LayerWeightsInitializers field of the fitted model&rsquo;s
ModelParameters .

See also:
ClassificationNeuralNetwork


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
Fit a Neural Network classification model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
fitcsvm


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7419
statistics: Mdl = fitcsvm ( X , Y )
statistics: Mdl = fitcsvm (&hellip;, name , value )

Fit a Support Vector Machine classification model.

Mdl = fitcsvm ( X , Y ) returns a Support Vector
Machine classification model, Mdl , with X being the predictor
data, and Y the class labels of observations in X .

X must be a N&times;P numeric matrix of predictor data where rows
correspond to observations and columns correspond to features or variables.

Y is N&times;1 matrix or cell matrix containing the class labels of
corresponding predictor data in X . Y can be numerical, logical,
char array or cell array of character vectors. Y must have same number
of rows as X .

Mdl = fitcsvm (&hellip;, name , value ) returns a
Support Vector Machine model with additional options specified by
Name-Value pair arguments listed below.

Model Parameters

Name Value
'Standardize' A boolean flag indicating whether
the data in X should be standardized prior to training.
'PredictorNames' A cell array of character vectors
specifying the predictor variable names. The variable names are assumed to
be in the same order as they appear in the training data X .
'ResponseName' A character vector specifying the name
of the response variable.
'ClassNames' Names of the classes in the class
labels, Y , used for fitting the kNN model. ClassNames are of
the same type as the class labels in Y .
'SVMtype' Specifies the type of SVM used for training
the ClassificationSVM model. By default, the type of SVM is defined
by setting other parameters and/or by the data itself. Setting the
'SVMtype' parameter overrides the default behavior and it accepts the
following options:

Value Description
'C_SVC' It is the standard SVM formulation for
classification tasks. It aims to find the optimal hyperplane that separates
different classes by maximizing the margin between them while allowing some
misclassifications. The parameter 'C' controls the trade-off between
maximizing the margin and minimizing the classification error. It is the
default type, unless otherwise specified.
'nu_SVC' It is a variation of the standard SVM that
introduces a parameter ν (nu) as an upper bound on the fraction of
margin errors and a lower bound on the fraction of support vectors. This
formulation provides more control over the number of support vectors and the
margin errors, making it useful for specific classification scenarios. It is
the default type, when the 'OutlierFraction' parameter is set.
'one_class_SVM' It is used for anomaly detection and
novelty detection tasks. It aims to separate the data points of a single
class from the origin in a high-dimensional feature space. This method is
particularly useful for identifying outliers or unusual patterns in the data.
It is the default type, when the 'Nu' parameter is set or when there
is a single class in Y . When 'one_class_SVM' is set by the
'SVMtype' pair argument, Y has no effect and any classes are
ignored.

Name Value
'OutlierFraction' The expected proportion of outliers
in the training data, specified as a scalar value in the range [0,1] .
When specified, the type of SVM model is switched to 'nu_SVC' and
'OutlierFraction' defines the ν (nu) parameter.
'KernelFunction' A character vector specifying the
method for computing elements of the Gram matrix. The available kernel
functions are 'gaussian' or 'rbf' , 'linear' ,
'polynomial' , and 'sigmoid' . For one-class learning, the
default Kernel function is 'rbf' . For two-class learning the default
is 'linear' .
'PolynomialOrder' A positive integer that specifies
the order of polynomial in kernel function. The default value is 3. Unless
the 'KernelFunction' is set to 'polynomial' , this parameter
is ignored.
'KernelScale' A positive scalar that specifies a
scaling factor for the γ (gamma) parameter, which can be seen as the
inverse of the radius of influence of samples selected by the model as
support vectors. The γ (gamma) parameter is computed as
gamma = KernelScale / (number of features) . The default value
for 'KernelScale' is 1.
'KernelOffset' A nonnegative scalar that specifies
the coef0 in kernel function. For the polynomial kernel, it influences
the polynomial&rsquo;s shift, and for the sigmoid kernel, it affects the hyperbolic
tangent&rsquo;s shift. The default value for 'KernelOffset' is 0.
'BoxConstraint' A positive scalar that specifies the
upper bound of the Lagrange multipliers, i.e. the parameter C, which is used
for training 'C_SVC' and 'one_class_SVM' type of models. It
determines the trade-off between maximizing the margin and minimizing the
classification error. The default value for 'BoxConstraint' is 1.
'Nu' A positive scalar, in the range (0,1]
that specifies the parameter ν (nu) for training 'nu_SVC' and
'one_class_SVM' type of models. Unless overridden by setting the
'SVMtype' parameter, setting the 'Nu' parameter always forces
the training model type to 'one_class_SVM' , in which case, the number
of classes in Y is ignored. The default value for 'Nu' is 1.
'CacheSize' A positive scalar that specifies the
memory requirements (in MB) for storing the Gram matrix. The default is 1000.
'Tolerance' A nonnegative scalar that specifies
the tolerance of termination criterion. The default value is 1e-6.
'Shrinking' Specifies whether to use shrinking
heuristics. It accepts either 0 or 1. The default value is 1.

Cross Validation Options

Name Value
'Crossval' Cross-validation flag specified as
'on' or 'off' . If 'on' is specified, a 10-fold
cross validation is performed and a ClassificationPartitionedModel is
returned in Mdl . To override this cross-validation setting, use only
one of the following Name-Value pair arguments.
'CVPartition' A cvpartition object that
specifies the type of cross-validation and the indexing for the training and
validation sets. A ClassificationPartitionedModel is returned in
Mdl and the trained model is stored in the Trained property.
'Holdout' Fraction of the data used for holdout
validation, specified as a scalar value in the range [0,1] . When
specified, a randomly selected percentage is reserved as validation data and
the remaining set is used for training. The trained model is stored in the
Trained property of the ClassificationPartitionedModel returned
in Mdl . 'Holdout' partitioning attempts to ensure that each
partition represents the classes proportionately.
'KFold' Number of folds to use in the cross-validated
model, specified as a positive integer value greater than 1. When specified,
then the data is randomly partitioned in k sets and for each set, the
set is reserved as validation data while the remaining k-1 sets are
used for training. The trained models are stored in the Trained
property of the ClassificationPartitionedModel returned in Mdl .
'KFold' partitioning attempts to ensure that each partition
represents the classes proportionately.
'Leaveout' Leave-one-out cross-validation flag
specified as 'on' or 'off' . If 'on' is specified,
then for each of the n observations (where n is the number of
observations, excluding missing observations, specified in the
NumObservations property of the model), one observation is reserved as
validation data while the remaining observations are used for training. The
trained models are stored in the Trained property of the
ClassificationPartitionedModel returned in Mdl .

See also:
ClassificationSVM,
ClassificationPartitionedModel,
svmtrain,
svmpredict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
Fit a Support Vector Machine classification model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
fitrgam


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6454
statistics: obj = fitrgam ( X , Y )
statistics: obj = fitrgam ( X , Y , name , value )

Fit a Generalized Additive Model (GAM) for regression.

obj = fitrgam ( X , Y ) returns an object of
class RegressionGAM, with matrix X containing the predictor data and
vector Y containing the continuous response data.

X must be a N&times;P numeric matrix of input data where rows
correspond to observations and columns correspond to features or variables.
X will be used to train the GAM model.

Y must be N&times;1 numeric vector containing the response data
corresponding to the predictor data in X . Y must have same
number of rows as X .

obj = fitrgam (&hellip;, name , value ) returns
an object of class RegressionGAM with additional properties specified by
Name-Value pair arguments listed below.

Name Value
'FitMethod' A character vector selecting the weak
learner, either 'boostedtrees' or 'splines' . The default
is 'boostedtrees' , which boosts one shallow decision tree per
predictor and is the scheme MATLAB uses. 'splines' boosts a
smoothing spline per predictor instead and is an Octave extension. The
two take different options and an option meant for one is refused by the
other rather than ignored, so the rows below say which engine each
belongs to.
'predictors' Predictor Variable names, specified as
a row vector cell of strings with the same length as the columns in X .
If omitted, the program will generate default variable names
(x1, x2, ..., xn) for each column in X .
'responsename' Response Variable Name, specified as
a string. If omitted, the default value is 'Y' .
'formula' (spline option) a model specification given as a
string in
the form 'Y ~ terms' where Y represents the response variable
and terms the predictor variables. The formula can be used to
specify a subset of variables for training model. For example:
'Y ~ x1 + x2 + x3 + x4 + x1:x2 + x2:x3' specifies four linear terms
for the first four columns of for predictor data, and x1:x2 and
x2:x3 specify the two interaction terms for 1st-2nd and 3rd-4th
columns respectively. Only these terms will be used for training the model,
but X must have at least as many columns as referenced in the formula.
If Predictor Variable names have been defined, then the terms in the formula
must reference to those. When 'formula' is specified, all terms used
for training the model are referenced in the IntMatrix field of the
obj class object as a matrix containing the column indexes for each
term including both the predictors and the interactions used.
'interactions' a logical matrix, a positive integer
scalar, or the string 'all' for defining the interactions between
predictor variables. When given a logical matrix, it must have the same
number of columns as X and each row corresponds to a different
interaction term combining the predictors indexed as true . Each
interaction term is appended as a column vector after the available predictor
column in X . When 'all' is defined, then all possible
combinations of interactions are appended in X before training. At the
moment, parsing a positive integer has the same effect as the 'all'
option. When 'interactions' is specified, only the interaction terms
appended to X are referenced in the IntMatrix field of the
obj class object.
'knots' (spline option) a scalar or a row vector with the
same
columns as X . It defines the knots for fitting a polynomial when
training the GAM. As a scalar, it is expanded to a row vector. The default
value is 5, hence expanded to ones (1, columns (X)) * 5 . You can
parse a row vector with different number of knots for each predictor
variable to be fitted with, although not recommended.
'order' (spline option) a scalar or a row vector with the
same
columns as X . It defines the order of the polynomial when training the
GAM. As a scalar, it is expanded to a row vector. The default values is 3,
hence expanded to ones (1, columns (X)) * 3 . You can parse a row
vector with different number of polynomial order for each predictor variable
to be fitted with, although not recommended.
'dof' (spline option) a scalar or a row vector with the
same columns
as X . It defines the degrees of freedom for fitting a polynomial when
training the GAM. As a scalar, it is expanded to a row vector. The default
value is 8, hence expanded to ones (1, columns (X)) * 8 . You can
parse a row vector with different degrees of freedom for each predictor
variable to be fitted with, although not recommended.
'tol' (spline option) a positive scalar to set the
tolerance for
convergence during training. By default, it is set to 1e-3 .

The rows above marked as spline options require
'FitMethod', 'splines' . The remaining options belong to the
boosted-tree engine and require 'FitMethod', 'boostedtrees' , which
is the default.

Name Value
'NumTreesPerPredictor' A positive integer, the number of
boosting rounds of the predictor phase. It is a budget rather than a
count: a fit that stops improving ends earlier and reports so. The default
is 300.
'NumTreesPerInteraction' A positive integer, the same
budget for the interaction phase. The default is 100.
'MaxNumSplitsPerPredictor' A positive integer, the
largest number of splits any one predictor tree may make. The default is
1, which makes each tree a stump.
'MaxNumSplitsPerInteraction' The same limit for a tree
over a pair of predictors. The default is 4.
'InitialLearnRateForPredictors' A value greater than 0
and at most 1, the step a round of the predictor phase starts at. A round
that fails to improve the fit is retried at half the step, so this is an
initial value rather than a fixed one. The default is 1.
'InitialLearnRateForInteractions' The same for the
interaction phase. The default is 1.
'MaxPValue' A value between 0 and 1. A candidate pair
of predictors is kept only if its interaction test gives a p -value
no larger than this. The default is 1, which keeps every pair asked for.
'Verbose' A non-negative integer. Greater than zero
prints a trace of the fit. The default is 0.
'NumPrint' A positive integer, how often the trace
reports: the first round and then every NumPrint rounds. The
default is 10.

You can parse either a 'formula' or an 'interactions'
optional parameter. Parsing both parameters will result an error.
Accordingly, you can only pass up to two parameters among 'knots' ,
'order' , and 'dof' to define the required polynomial for
training the GAM model.

See also:
RegressionGAM,
regress,
regress_gp


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 54
Fit a Generalized Additive Model (GAM) for regression.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
fitrgp


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 852
statistics: Mdl = fitrgp ( X , Y )
statistics: Mdl = fitrgp (&hellip;, name , value )

Fit a Gaussian process regression model.

Mdl = fitrgp ( X , Y ) returns a RegressionGP
object fitted to the predictor data X and the continuous response
Y , where X is an NxP numeric matrix and Y an
Nx1 numeric vector with as many rows as X .

Mdl = fitrgp (&hellip;, name , value ) passes the
given Name-Value pairs to the model. They are documented under
RegressionGP , and the ones most often wanted are
'KernelFunction' , 'BasisFunction' , 'Standardize' ,
'Sigma' and 'FitMethod' .

When any of 'CrossVal' , 'KFold' , 'Holdout' ,
'Leaveout' or 'CVPartition' is given, a cross validated
model is returned instead, as a RegressionPartitionedModel . Only
one of them may be given at a time.

See also:
RegressionGP,
CompactRegressionGP,
RegressionPartitionedModel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
Fit a Gaussian process regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
fitrkernel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1170
statistics: Mdl = fitrkernel ( X , Y )
statistics: Mdl = fitrkernel (&hellip;, name , value )
statistics: [ Mdl , FitInfo ] = fitrkernel (&hellip;)

Fit a Gaussian kernel regression model.

Mdl = fitrkernel ( X , Y ) returns a
RegressionKernel object fitted to the predictor data X and
the continuous response Y , where X is an NxP numeric
matrix and Y an Nx1 numeric vector with as many rows as
X .

Mdl = fitrkernel (&hellip;, name , value ) passes
the given Name-Value pairs to the model. They are documented
under RegressionKernel , and the ones most often wanted are
'Learner' , 'Epsilon' ,
'NumExpansionDimensions' , 'KernelScale' ,
'Lambda' and 'BoxConstraint' .

[ Mdl , FitInfo ] = fitrkernel (&hellip;) also returns a
structure describing the optimization: the objective it reached, the
gradient it left, and the tolerances it was given.

Mdl = fitrkernel (&hellip;, cvopt , value ) returns a
RegressionPartitionedKernel
instead when one of 'CrossVal' , 'KFold' ,
'Holdout' , 'Leaveout' and 'CVPartition' is
given. A cross-validated model describes no single fit, so
FitInfo is not available beside it.

See also:
RegressionKernel,
RegressionLinear,
fitrlinear


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
Fit a Gaussian kernel regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
fitrlinear


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1236
statistics: Mdl = fitrlinear ( X , Y )
statistics: Mdl = fitrlinear (&hellip;, name , value )
statistics: [ Mdl , FitInfo ] = fitrlinear (&hellip;)

Fit a linear regression model.

Mdl = fitrlinear ( X , Y ) returns a
RegressionLinear object fitted to the predictor data X and
the continuous response Y , where X is an NxP numeric
matrix and Y an Nx1 numeric vector with as many rows as
X .

Mdl = fitrlinear (&hellip;, name , value ) passes
the given Name-Value pairs to the model. They are documented
under RegressionLinear , and the ones most often wanted are
'Learner' , 'Epsilon' , 'Regularization' ,
'Lambda' and 'Solver' .

[ Mdl , FitInfo ] = fitrlinear (&hellip;) also returns a
structure describing the optimization: what it converged to, how far it
got, and which tolerance stopped it. Its fields follow the solver, so a
dual fit reports the dual variables and a mini-batch fit the batch it
stopped on.

Mdl = fitrlinear (&hellip;, cvopt , value ) returns a
RegressionPartitionedLinear
instead when one of 'CrossVal' , 'KFold' ,
'Holdout' , 'Leaveout' and 'CVPartition' is
given. A cross-validated model describes no single fit, so
FitInfo is not available beside it.

See also:
RegressionLinear,
RegressionKernel,
fitrkernel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
Fit a linear regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
fitrnet


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4969
statistics: Mdl = fitrnet ( X , Y )
statistics: Mdl = fitrnet (&hellip;, name , value )

Fit a neural network regression model.

Mdl = fitrnet ( X , Y ) returns a neural network
regression model, Mdl , with X being the predictor data and
Y the continuous response of the observations in X .

X must be an NxP numeric matrix of predictor data, where rows
correspond to observations and columns to features or variables.

Y must be an Nx1 numeric vector holding the response of the
corresponding predictor data in X . Y must have the same number
of rows as X .

The network is trained against the mean squared error and its output layer
applies the identity, so a prediction is an unrestricted real number. Use
fitcnet where the response names a class rather than a quantity.

Mdl = fitrnet (&hellip;, name , value ) returns a
neural network regression model with additional options specified by
Name-Value pair arguments listed below.

Model Parameters

Name Value
'Standardize' A logical scalar indicating whether the
data in X should be centred and scaled before training. The same
transformation is applied by predict . The default is false .
'PredictorNames' A cell array of character vectors
specifying the predictor variable names, in the order they appear in
X .
'ResponseName' A character vector specifying the name of
the response variable. The default is 'Y' .
'ResponseTransform' A character vector naming one of
'none' , 'identity' , 'exp' or 'log' , or a
function handle of one argument, applied to the predicted response by
predict and resubPredict . The default is 'none' .
'LayerSizes' A vector of positive integers defining the
number of units in each fully connected hidden layer. The default value is
10, a single hidden layer of ten units.
'LearningRate' A positive scalar value that defines the
learning rate during the gradient descent. Default value is 0.003. A
larger rate can drive every unit of a hidden layer negative, after which a
rectifier passes no gradient and the network stops training.
Applies only when 'Solver' is 'sgd' .
'Solver' A character vector naming the solver that
trains the network, either 'lbfgs' or 'sgd' . The
default is 'lbfgs' , which minimizes the loss over the whole
training set at once by limited-memory BFGS, as MATLAB does. It takes
no learning rate, stops on the three tolerances below, and reaches a
lower training loss in fewer passes over the data, though each of its
iterations costs several passes where an epoch costs one.
'sgd' visits the samples one at a time and steps down the
gradient of each, running for 'IterationLimit' epochs; it was
the default before version 1.9.0.
'GradientTolerance' A nonnegative scalar. Training
stops once the gradient&rsquo;s infinity norm falls to or below it, which is
the quantity MATLAB tests too. The default is 1e-6 . Applies
only when 'Solver' is 'lbfgs' .
'StepTolerance' A nonnegative scalar. Training
stops once the step&rsquo;s infinity norm falls to or below it, which is the
quantity MATLAB tests too. The default is 1e-6 . Applies only
when 'Solver' is 'lbfgs' .
'LossTolerance' A real scalar. Training stops once
the training loss falls to or below it. The test is on the loss
itself and not on its change, matching MATLAB; pass -Inf to
switch it off. The default is 1e-6 . Applies only when
'Solver' is 'lbfgs' .
'Activations' A character vector or a cellstr vector
specifying the activation functions for the hidden layers of the neural
network, excluding the output layer. The available activation functions
are 'linear' , 'none' , 'sigmoid' , 'relu' ,
'tanh' , 'lrelu' , 'prelu' , 'elu' and
'gelu' . The default value is 'relu' .
'OutputLayerActivation' A character vector specifying
the activation function for the output layer. The available functions are
the same as for 'Activations' . The default value is
'none' , the identity, which is what a regression output calls for;
anything else bounds the prediction to that function&rsquo;s range.
'IterationLimit' A positive integer scalar specifying
the maximum number of training iterations. The default value is 1000.
Under 'sgd' this counts epochs, under
'lbfgs' solver iterations.
'DisplayInfo' A logical scalar indicating whether to
print information during training. Default is false .

The weights of each layer are drawn from a uniform range whose half-width
is set by that layer&rsquo;s activation, and the scheme cannot be chosen: a
rectifying activation ( 'relu' , 'lrelu' , 'prelu' ,
'elu' , 'gelu' ) takes the He range
sqrt (6 / fan_in) , because it passes only half of its input, and
the remaining activations take the Glorot range
sqrt (6 / (fan_in + fan_out)) , which accounts for the backward pass
as well. A network whose layers do not share an activation is therefore
built with both schemes. What each layer was given is reported by the
LayerWeightsInitializers field of the fitted model&rsquo;s
ModelParameters .

See also:
RegressionNeuralNetwork,
fitcnet,
fcnntrain,
fcnnpredict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
Fit a neural network regression model.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
fitrsvm


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2995
statistics: Mdl = fitrsvm ( X , Y )
statistics: Mdl = fitrsvm (&hellip;, name , value )

Fit a support vector machine regression model.

Mdl = fitrsvm ( X , Y ) returns a support vector
regression model, Mdl , with X being the predictor data and
Y the continuous response of the observations in X .

X must be an NxP numeric matrix of predictor data, where rows
correspond to observations and columns to features or variables.

Y must be an Nx1 numeric vector holding the response of the
corresponding predictor data in X . Y must have the same number
of rows as X .

The model is fitted by epsilon -insensitive regression: an error
smaller than Epsilon costs nothing, so only the observations
outside that tube become support vectors. Use fitcsvm where the
response names a class rather than a quantity.

Mdl = fitrsvm (&hellip;, name , value ) returns a
model with additional options specified by Name-Value pair
arguments listed below.

Model Parameters

Name Value
'Standardize' A logical scalar indicating whether the
data in X should be centred and scaled before training. The same
transformation is applied by predict . The default is false .
'PredictorNames' A cell array of character vectors
specifying the predictor variable names, in the order they appear in
X .
'ResponseName' A character vector specifying the name of
the response variable. The default is 'Y' .
'ResponseTransform' A character vector naming one of
'none' , 'identity' , 'exp' or 'log' , or a
function handle of one argument, applied to the predicted response. The
default is 'none' .
'Epsilon' A non-negative scalar, the half-width of the
insensitive tube. The default is iqr ( Y ) / 13.49 , a robust
estimate of a tenth of the response&rsquo;s standard deviation, which is what
MATLAB uses; where that is zero it falls back to 0.1 .
'BoxConstraint' A positive scalar bounding the dual
coefficients, the cost of an error outside the tube. The default is 1.
'KernelFunction' A character vector naming the kernel,
one of 'linear' , the default, 'rbf' , 'gaussian' ,
'polynomial' or 'sigmoid' .
'PolynomialOrder' A positive integer, the order of the
polynomial kernel. The default is 3. It is ignored by every other kernel.
'KernelScale' A positive scalar dividing the predictors
before the kernel is applied. The default is 1.
'KernelOffset' A non-negative scalar added to the kernel
value. The default is 0.
'SVMtype' A character vector selecting the formulation,
either 'eps_svr' , the default, or 'nu_svr' . MATLAB fits
only the epsilon form; 'nu_svr' is an Octave extension.
'Nu' A scalar in (0, 1] used by
'nu_svr' , bounding the fraction of support vectors. The default
is 0.5.
'CacheSize' A positive scalar, the kernel cache in
megabytes. The default is 1000.
'Tolerance' A non-negative scalar, the tolerance of the
termination criterion. The default is 1e-6 .
'Shrinking' Either 0 or 1, whether to use the shrinking
heuristic. The default is 1.

See also:
RegressionSVM,
fitcsvm,
fitrnet,
svmtrain,
svmpredict


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
Fit a support vector machine regression model.





