|
@@ -171,8 +171,6 @@ def cross_validate_with_optimal_threshold(
|
|
|
|
|
|
for train_inds, val_inds in cv_threshold:
|
|
for train_inds, val_inds in cv_threshold:
|
|
|
|
|
|
- print("----- In cv threshold fold")
|
|
|
|
-
|
|
|
|
X_train_fold, X_val_fold, y_train_fold, y_val_fold =\
|
|
X_train_fold, X_val_fold, y_train_fold, y_val_fold =\
|
|
CVComposer().cv_slice_dataset(
|
|
CVComposer().cv_slice_dataset(
|
|
X=X_train,
|
|
X=X_train,
|
|
@@ -190,8 +188,6 @@ def cross_validate_with_optimal_threshold(
|
|
|
|
|
|
thresholds.append(threshold)
|
|
thresholds.append(threshold)
|
|
|
|
|
|
- print("----- Threshold:", threshold)
|
|
|
|
-
|
|
|
|
scores["test_threshold"].append(np.mean(thresholds))
|
|
scores["test_threshold"].append(np.mean(thresholds))
|
|
|
|
|
|
if refit:
|
|
if refit:
|
|
@@ -226,8 +222,6 @@ def cross_validate_with_optimal_threshold(
|
|
|
|
|
|
for (train_inds, val_inds), cv_fold in zip_longest(cv, cv_threshold):
|
|
for (train_inds, val_inds), cv_fold in zip_longest(cv, cv_threshold):
|
|
|
|
|
|
- print("=== In cv fold")
|
|
|
|
-
|
|
|
|
X_train_fold, X_val_fold, y_train_fold, y_val_fold =\
|
|
X_train_fold, X_val_fold, y_train_fold, y_val_fold =\
|
|
CVComposer().cv_slice_dataset(
|
|
CVComposer().cv_slice_dataset(
|
|
X=X_train,
|
|
X=X_train,
|
|
@@ -247,8 +241,6 @@ def cross_validate_with_optimal_threshold(
|
|
threshold_set=threshold_set,
|
|
threshold_set=threshold_set,
|
|
scores=scores)
|
|
scores=scores)
|
|
|
|
|
|
- print("=== scores:", scores)
|
|
|
|
-
|
|
|
|
return scores
|
|
return scores
|
|
|
|
|
|
|
|
|
|
@@ -266,7 +258,7 @@ if __name__ == "__main__":
|
|
|
|
|
|
X_train, X_val, y_train, y_val = train_test_split(X, y)
|
|
X_train, X_val, y_train, y_val = train_test_split(X, y)
|
|
|
|
|
|
- estimator = XGBRFClassifier()
|
|
|
|
|
|
+ estimator = XGBRFClassifier(use_label_encoder=False)
|
|
|
|
|
|
score_func = accuracy_score
|
|
score_func = accuracy_score
|
|
|
|
|
|
@@ -351,10 +343,10 @@ if __name__ == "__main__":
|
|
score_func=accuracy_score,
|
|
score_func=accuracy_score,
|
|
X_train=X_train,
|
|
X_train=X_train,
|
|
y_train=y_train,
|
|
y_train=y_train,
|
|
- X_val=X_val,
|
|
|
|
- y_val=y_val,
|
|
|
|
- X_val_threshold=X_val_threshold,
|
|
|
|
- y_val_threshold=y_val_threshold,
|
|
|
|
|
|
+ X_val=None,
|
|
|
|
+ y_val=None,
|
|
|
|
+ X_val_threshold=None,
|
|
|
|
+ y_val_threshold=None,
|
|
cv=3,
|
|
cv=3,
|
|
cv_threshold=None,
|
|
cv_threshold=None,
|
|
additional_metrics=additional_metrics)
|
|
additional_metrics=additional_metrics)
|