2016-03-30 24 views
1

私は "sklearn.svm"を使って基本的なSVMトレーニングを行っています。サポートベクターマシン(SVM)トレーニング後に完全なモデル情報を抽出する方法は?

enter image description here

from sklearn.svm import SVC 
clf = SVC(C=10.0,kernel='linear',probability=True,verbose=True) 
clf.fit(X, y_) 

注:私は「get_params」または「set_params」に到達することができるパラメータの話ではないのですSVCの場合は、マニュアルに記載されたモデルの詳細情報をプリントアウトする方法があります。私はアルゴリズムの結果として決定された実際の係数を参照しています。 SVCのドキュメントから

答えて

0

Attributes: 

support_ : array-like, shape = [n_SV] 
    Indices of support vectors. 
    support_vectors_ : array-like, shape = [n_SV, n_features] 
    Support vectors. 

n_support_ : array-like, dtype=int32, shape = [n_class] 
    Number of support vectors for each class. 

dual_coef_ : array, shape = [n_class-1, n_SV] 
    Coefficients of the support vector in the decision function. For  
    multiclass, coefficient for all 1-vs-1 classifiers. The layout of 
    the coefficients in the multiclass case is somewhat non-trivial. 
    See the section about multi-class classification in the SVM 
    section of the User Guide for details. 

coef_ : array, shape = [n_class-1, n_features] 

     Weights assigned to the features (coefficients in the primal 
     problem). This is only available in the case of a linear 
     kernel. 

     coef_ is a readonly property derived from dual_coef_ and 
     support_vectors_. 

intercept_ : array, shape = [n_class * (n_class-1)/2] 
     Constants in decision function. 

これは、モデルに関するすべての情報を属性からあなたが得ることができます。

たとえば、clf.n_support_は、ご使用のモデルのn_support_を返します。

関連する問題