Skip to content

Commit

Permalink
Corrected criteria in the problem with transformers
Browse files Browse the repository at this point in the history
  • Loading branch information
LebedevIlyaG committed Dec 3, 2024
1 parent 602c7a2 commit 537bf05
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(self, x_dataset: np.ndarray, y_dataset: np.ndarray,
self.upper_bound_of_float_variables = np.array([regularization_bound['up'], kernel_coefficient_bound['up']],
dtype=np.double)

self.cv = StratifiedKFold(shuffle=True, random_state=42)
#self.cv = StratifiedKFold(shuffle=True, random_state=42)



Expand All @@ -59,15 +59,15 @@ def calculateAllFunction(self, point: Point, function_values: np.ndarray(shape=(


cs, gammas = point.float_variables[0], point.float_variables[1]
clf = SVC(C=10 ** cs, gamma=10 ** gammas)
clf = SVC(C=10 ** cs, gamma=10 ** gammas, probability=True)
clf.fit(self.x, self.y)

# OBJECTIV 1
function_values[0].value = - cross_val_score(clf, self.x, self.y, cv=self.cv,
scoring='f1_macro').mean()
function_values[0].value = - cross_val_score(clf, self.x, self.y, n_jobs=4,
scoring='neg_log_loss').mean()
# OBJECTIV 2
function_values[1].value = - cross_val_score(clf, self.x, self.y, cv=self.cv,
scoring='f1_weighted').mean()
function_values[1].value = - cross_val_score(clf, self.x, self.y, n_jobs=4,
scoring='f1_macro').mean()


return function_values

0 comments on commit 537bf05

Please sign in to comment.