Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

nLinearCoeffs

Class: CompactClassificationDiscriminant

Number of nonzero linear coefficients

Syntax

ncoeffs = nLinearCoeffs(obj)
ncoeffs = nLinearCoeffs(obj,delta)

Description

ncoeffs = nLinearCoeffs(obj) returns the number of nonzero linear coefficients in the linear discriminant model obj.

ncoeffs = nLinearCoeffs(obj,delta) returns the number of nonzero linear coefficients for threshold parameter delta.

Input Arguments

obj

Discriminant analysis classifier, produced using fitcdiscr.

delta

Scalar or vector value of the Delta parameter. See Gamma and Delta.

Output Arguments

ncoeffs

Nonnegative integer, the number of nonzero coefficients in the discriminant analysis model obj.

If you call nLinearCoeffs with a delta argument, ncoeffs is the number of nonzero linear coefficients for threshold parameter delta. If delta is a vector, ncoeffs is a vector with the same number of elements.

If obj is a quadratic discriminant model, ncoeffs is the number of predictors in obj.

Examples

expand all

Find the number of nonzero coefficients in a discriminant analysis classifier for various Delta values.

Create a discriminant analysis classifier from the fishseriris data.

load fisheriris
obj = fitcdiscr(meas,species);

Find the number of nonzero coefficients in obj.

ncoeffs = nLinearCoeffs(obj)
ncoeffs =

     4

Find the number of nonzero coefficients for delta = 1, 2, 4, and 8.

delta = [1 2 4 8];
ncoeffs = nLinearCoeffs(obj,delta)
ncoeffs =

     4
     4
     3
     0

The DeltaPredictor property gives the values of delta where the number of nonzero coefficients changes.

ncoeffs2 = nLinearCoeffs(obj,obj.DeltaPredictor)
ncoeffs2 =

     4
     3
     1
     2

Definitions

expand all

Was this topic helpful?