How to force fitcsvm() to train a one-class svm?

17 ビュー (過去 30 日間)
Francesco Formaggio
Francesco Formaggio 2018 年 10 月 3 日
コメント済み: Don Mathis 2018 年 10 月 10 日
With fitcsvm you can train also a one-class svm, but how can I be sure that the trained svm is one-class and not two-class? I tried with
SVMModel = fitcsvm(valuesTraining,targetsTraining,'Standardize',true,... 'KernelFunction','gaussian','OptimizeHyperparameters','auto');
where targetsTraining is a vector of all 1s (since I have only samples coming from one class) amd valuesTraining is the matrix containing the 5-dimensional-features training points. Then I test the model with different data but whith instances of both classes. Performance are bad and I have the feeling that the training has been conducted with two-class svm, and not one-class.

採用された回答

Don Mathis
Don Mathis 2018 年 10 月 5 日
編集済み: Don Mathis 2018 年 10 月 5 日
Look at your model at the MATLAB command line. If 'ClassNames' has only one entry, then it was 1-class training. For example:
SVMModel =
ClassificationSVM
ResponseName: 'Y'
CategoricalPredictors: []
ClassNames: 1
ScoreTransform: 'none'
NumObservations: 150
Alpha: [77×1 double]
Bias: -15.977601047115476
KernelParameters: [1×1 struct]
Mu: [5.843333333333319 3.057333333333326]
Sigma: [0.828066127977862 0.435866284936697]
BoxConstraints: [150×1 double]
ConvergenceInfo: [1×1 struct]
IsSupportVector: [150×1 logical]
Solver: 'SMO'
  2 件のコメント
Francesco Formaggio
Francesco Formaggio 2018 年 10 月 10 日
Thank you for the answer. But then if I have outliers in the training, that is most points of class 1 with only some of class -1, how can I tell fitcsvm() to use still one-class SVM for training?
Don Mathis
Don Mathis 2018 年 10 月 10 日
If your Response variable has only 1 class, then 1-class training is used. If there are 2 classes, 2-class is used. If you have outliers that are already labelled -1, then you can use 2-class learning to find outliers.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSupport Vector Machine Classification についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by