main content

compact support vector machine regression model -凯发k8网页登录

package: classreg.learning.regr

compact support vector machine regression model

description

compactregressionsvm is a compact support vector machine (svm) regression model. it consumes less memory than a full, trained support vector machine model (regressionsvm model) because it does not store the data used to train the model.

because the compact model does not store the training data, you cannot use it to perform certain tasks, such as cross validation. however, you can use a compact svm regression model to predict responses using new input data.

construction

compactmdl = compact(mdl) returns a compact svm regression model compactmdl from a full, trained svm regression model, mdl. for more information, see .

input arguments

full, trained svm regression model, specified as a regressionsvm model returned by fitrsvm.

properties

dual problem coefficients, specified as a vector of numeric values. alpha contains m elements, where m is the number of support vectors in the trained svm regression model. the dual problem introduces two lagrange multipliers for each support vector. the values of alpha are the differences between the two estimated lagrange multipliers for the support vectors. for more details, see .

if you specified to remove duplicates using removeduplicates, then, for a particular set of duplicate observations that are support vectors, alpha contains one coefficient corresponding to the entire set. that is, matlab® attributes a nonzero coefficient to one observation from the set of duplicates and a coefficient of 0 to all other duplicate observations in the set.

data types: single | double

primal linear problem coefficients, stored as a numeric vector of length p, where p is the number of predictors in the svm regression model.

the values in beta are the linear coefficients for the primal optimization problem.

if the model is obtained using a kernel function other than 'linear', this property is empty ('[]').

the method computes predicted response values for the model as yfit = (x/s)×beta bias, wheres is the value of the kernel scale stored in the kernelparameters.scale property.

data types: double

bias term in the svm regression model, stored as a scalar value.

data types: double

categorical predictor indices, specified as a vector of positive integers. categoricalpredictors contains index values indicating that the corresponding predictors are categorical. the index values are between 1 and p, where p is the number of predictors used to train the model. if none of the predictors are categorical, then this property is empty ([]).

data types: single | double

expanded predictor names, stored as a cell array of character vectors.

if the model uses encoding for categorical variables, then expandedpredictornames includes the names that describe the expanded variables. otherwise, expandedpredictornames is the same as predictornames.

data types: cell

kernel function parameters, stored as a structure with the following fields.

fielddescription
function kernel function name (a character vector).
scalenumeric scale factor used to divide predictor values.

you can specify values for kernelparameters.function and kernelparameters.scale by using the kernelfunction and kernelscale name-value pair arguments in fitrsvm, respectively.

data types: struct

predictor means, stored as a vector of numeric values.

if the training data is standardized, then mu is a numeric vector of length p, where p is the number of predictors used to train the model. in this case, the method centers predictor matrix x by subtracting the corresponding element of mu from each column.

if the training data is not standardized, then mu is empty ('[]').

data types: single | double

predictor names, stored as a cell array of character vectors containing the name of each predictor in the order in which they appear in x. predictornames has a length equal to the number of columns in x.

data types: cell

response variable name, stored as a character vector.

data types: char

response transformation function, specified as 'none' or a function handle. responsetransform describes how the software transforms raw response values.

for a matlab function or a function that you define, enter its function handle. for example, you can enter mdl.responsetransform = @function, where function accepts a numeric vector of the original responses and returns a numeric vector of the same size containing the transformed responses.

data types: char | function_handle

predictor standard deviations, stored as a vector of numeric values.

if the training data is standardized, then sigma is a numeric vector of length p, where p is the number of predictors used to train the model. in this case, the method scales the predictor matrix x by dividing each column by the corresponding element of sigma, after centering each element using mu.

if the training data is not standardized, then sigma is empty ('[]').

data types: single | double

support vectors, stored as an m-by-p matrix of numeric values. m is the number of support vectors (sum(mdl.issupportvector)), and p is the number of predictors in x.

if you specified to remove duplicates using removeduplicates, then for a given set of duplicate observations that are support vectors, supportvectors contains one unique support vector.

data types: single | double

object functions

discardsupportvectorsdiscard support vectors for linear support vector machine (svm) regression model
gather properties of statistics and machine learning toolbox object from gpu
convert support vector machine (svm) regression model to incremental learner
limelocal interpretable model-agnostic explanations (lime)
regression error for support vector machine regression model
partialdependencecompute partial dependence
plotpartialdependencecreate partial dependence plot (pdp) and individual conditional expectation (ice) plots
predict responses using support vector machine regression model
shapleyshapley values
updateupdate model parameters for code generation

copy semantics

value. to learn how value classes affect copy operations, see .

examples

this example shows how to reduce the size of a full, trained svm regression model by discarding the training data and some information related to the training process.

this example uses the abalone data from the uci machine learning repository. download the data and save it in your current directory with the name 'abalone.data'. read the data into a table.

tbl = readtable('abalone.data','filetype','text','readvariablenames',false);
rng default  % for reproducibility

the sample data contains 4177 observations. all of the predictor variables are continuous except for sex, which is a categorical variable with possible values 'm' (for males), 'f' (for females), and 'i' (for infants). the goal is to predict the number of rings on the abalone, and thereby determine its age, using physical measurements.

train an svm regression model using a gaussian kernel function and an automatic kernel scale. standardize the data.

mdl = fitrsvm(tbl,'var9','kernelfunction','gaussian','kernelscale','auto','standardize',true)
mdl = 
  regressionsvm
           predictornames: {1x8 cell}
             responsename: 'var9'
    categoricalpredictors: 1
        responsetransform: 'none'
                    alpha: [3635x1 double]
                     bias: 10.8144
         kernelparameters: [1x1 struct]
                       mu: [1x10 double]
                    sigma: [1x10 double]
          numobservations: 4177
           boxconstraints: [4177x1 double]
          convergenceinfo: [1x1 struct]
          issupportvector: [4177x1 logical]
                   solver: 'smo'
  properties, methods

compact the model.

compactmdl = compact(mdl)
compactmdl = 
  classreg.learning.regr.compactregressionsvm
           predictornames: {1x8 cell}
             responsename: 'var9'
    categoricalpredictors: 1
        responsetransform: 'none'
                    alpha: [3635x1 double]
                     bias: 10.8144
         kernelparameters: [1x1 struct]
                       mu: [1x10 double]
                    sigma: [1x10 double]
           supportvectors: [3635x10 double]
  properties, methods

the compacted model discards the training data and some information related to the training process.

compare the size of the full model mdl and the compact model compactmdl.

vars = whos('compactmdl','mdl');
[vars(1).bytes,vars(2).bytes]
ans =
      323793      775968

the compacted model consumes about half the memory of the full model.

references

[1] nash, w.j., t. l. sellers, s. r. talbot, a. j. cawthorn, and w. b. ford. "the population biology of abalone (haliotis species) in tasmania. i. blacklip abalone (h. rubra) from the north coast and islands of bass strait." sea fisheries division, technical report no. 48, 1994.

[2] waugh, s. "extending and benchmarking cascade-correlation: extensions to the cascade-correlation architecture and benchmarking of feed-forward supervised artificial neural networks." university of tasmania department of computer science thesis, 1995.

[3] clark, d., z. schreter, a. adams. "a quantitative comparison of dystal and backpropagation." submitted to the australian conference on neural networks, 1996.

[4] lichman, m. uci machine learning repository, [http://archive.ics.uci.edu/ml]. irvine, ca: university of california, school of information and computer science.

extended capabilities

version history

introduced in r2015b
网站地图