def __init__(self, isTrain, isOutlierRemoval=0):
"""
The linear models ``LinearSVC()`` and ``SVC(kernel='linear')`` yield slightly
different decision boundaries. This can be a consequence of the following
differences:
- ``LinearSVC`` minimizes the squared hinge loss while ``SVC`` minimizes the
regular hinge loss.
- ``LinearSVC`` uses the One-vs-All (also known as One-vs-Rest) multiclass
reduction while ``SVC`` uses the One-vs-One multiclass reduction.
:return:
"""
super(ClassificationSVM, self).__init__(isTrain, isOutlierRemoval)
# data preprocessing
self.dataPreprocessing()
self.clf = svm.SVC() # define the SVM classifier
C = 1.0 # SVM regularization parameter
self.svc = svm.SVC(kernel='linear', C=C, max_iter=100000)
self.rbf_svc = svm.SVC(kernel='rbf', gamma=0.7, C=C)
self.poly_svc = svm.SVC(kernel='poly', coef0=1, degree=3, C=C)
self.lin_svc = svm.LinearSVC(C=C)
ClassificationSVM.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录