调整参数
Gitea Actions Test / Challenge-Actions (push) Successful in 27s

This commit is contained in:
2024-11-19 21:39:40 +08:00
parent 254b87c8ea
commit b6b312bdb2
+2 -2
View File
@@ -47,7 +47,7 @@ def train_svm(X, y):
# 训练第一个 SVM,用于分类类别 1 和 (2, 3)
y1 = np.where(y == 1, 1, -1) # 标签转换
model1 = svm.SVC(C=1, max_iter=1000, kernel="rbf")
model1 = svm.SVC(C=0.1, kernel='linear', gamma='scale', max_iter=200)
model1.fit(X, y1)
models.append(model1)
@@ -57,7 +57,7 @@ def train_svm(X, y):
y23 = np.where(y23 == 2, 1, -1) # 标签转换
# 训练第二个 SVM,用于分类类别 2 和 3
model2 = svm.SVC(C=0.1, max_iter=1000, kernel="linear")
model2 = svm.SVC(C=0.1, kernel='linear', gamma='scale', max_iter=150)
model2.fit(X23, y23)
models.append(model2)