|
@@ -16,12 +16,12 @@ from sklearn.model_selection import KFold, cross_val_score
|
|
# variables and parameters
|
|
# variables and parameters
|
|
n_predict = 0
|
|
n_predict = 0
|
|
|
|
|
|
-def my_accuracy_scorer(*args):
|
|
|
|
- global n_predict
|
|
|
|
- score = accuracy_score(*args)
|
|
|
|
- print('{0} - Score is {1}'.format(n_predict, score))
|
|
|
|
- n_predict += 1
|
|
|
|
- return score
|
|
|
|
|
|
+# def my_accuracy_scorer(*args):
|
|
|
|
+# global n_predict
|
|
|
|
+# score = accuracy_score(*args)
|
|
|
|
+# print('{0} - Score is {1}'.format(n_predict, score))
|
|
|
|
+# n_predict += 1
|
|
|
|
+# return score
|
|
|
|
|
|
def _get_best_model(X_train, y_train):
|
|
def _get_best_model(X_train, y_train):
|
|
|
|
|
|
@@ -30,7 +30,8 @@ def _get_best_model(X_train, y_train):
|
|
param_grid = {'kernel':['rbf'], 'C': Cs, 'gamma' : gammas}
|
|
param_grid = {'kernel':['rbf'], 'C': Cs, 'gamma' : gammas}
|
|
|
|
|
|
svc = svm.SVC(probability=True, class_weight='balanced')
|
|
svc = svm.SVC(probability=True, class_weight='balanced')
|
|
- clf = GridSearchCV(svc, param_grid, cv=5, verbose=1, scoring=my_accuracy_scorer, n_jobs=-1)
|
|
|
|
|
|
+ #clf = GridSearchCV(svc, param_grid, cv=5, verbose=1, scoring=my_accuracy_scorer, n_jobs=-1)
|
|
|
|
+ clf = GridSearchCV(svc, param_grid, cv=5, verbose=1, n_jobs=-1)
|
|
|
|
|
|
clf.fit(X_train, y_train)
|
|
clf.fit(X_train, y_train)
|
|
|
|
|