def svc_model(self, X, y, x_test, y_test, x_val, y_val, i, j):
X, y = shuffle(X, y, random_state=self.SEED)
clf = SVC(C=self.C, kernel='rbf', gamma=self.gamma, cache_size=self.cache_size,
verbose=0, random_state=self.SEED)
model = clf.fit(X, y)
yhat_train = model.predict(X)
yhat_val = model.predict(x_val)
yhat_test = model.predict(x_test)
train_error = (1 - accuracy_score(y, yhat_train)) * 100
val_error = (1 - accuracy_score(y_val, yhat_val)) * 100
test_error = (1 - accuracy_score(y_test, yhat_test)) * 100
self.warn_log.append([i, train_error, val_error, test_error])
return model
评论列表
文章目录