sklearnでLinearSVCを使っているとAttributeError:’LinearSVC’ object has no attribute ‘predict_proba’ ってエラーが出た

sklearn でLinearSVCを使ってたら、

AttributeError:’LinearSVC’ object has no attribute ‘predict_proba

どうやら、LinearSVCには上記のpredict_probaの特徴を持ち合わせていないらしい.

このエラーの対応するには、以下のように変更する.SVMの方にはある模様.

SVC(kernel=’linear’,probability=True)

SVCでkernelをlinearと設定したものと挙動が同一になります.

About the author

コメントを残す