@@ -11,7 +11,7 @@ def fit_logistic_regression(X, y, data_random_seed=1, repeat=1):
1111 # transform targets to one-hot vector
1212 one_hot_encoder = OneHotEncoder (categories = "auto" , sparse = False )
1313
14- y = one_hot_encoder .fit_transform (y .reshape (- 1 , 1 )).astype (np .bool )
14+ y = one_hot_encoder .fit_transform (y .reshape (- 1 , 1 )).astype (np .bool_ )
1515
1616 # normalize x
1717 X = normalize (X , norm = "l2" )
@@ -42,7 +42,7 @@ def fit_logistic_regression(X, y, data_random_seed=1, repeat=1):
4242 y_pred = clf .predict_proba (X_test )
4343 y_pred = np .argmax (y_pred , axis = 1 )
4444 y_pred = one_hot_encoder .transform (y_pred .reshape (- 1 , 1 )).astype (
45- np .bool
45+ np .bool_
4646 )
4747
4848 test_acc = metrics .accuracy_score (y_test , y_pred )
@@ -55,7 +55,7 @@ def fit_logistic_regression_preset_splits(
5555):
5656 # transform targets to one-hot vector
5757 one_hot_encoder = OneHotEncoder (categories = "auto" , sparse = False )
58- y = one_hot_encoder .fit_transform (y .reshape (- 1 , 1 )).astype (np .bool )
58+ y = one_hot_encoder .fit_transform (y .reshape (- 1 , 1 )).astype (np .bool_ )
5959
6060 # normalize x
6161 X = normalize (X , norm = "l2" )
@@ -84,7 +84,7 @@ def fit_logistic_regression_preset_splits(
8484 y_pred = clf .predict_proba (X_val )
8585 y_pred = np .argmax (y_pred , axis = 1 )
8686 y_pred = one_hot_encoder .transform (y_pred .reshape (- 1 , 1 )).astype (
87- np .bool
87+ np .bool_
8888 )
8989 val_acc = metrics .accuracy_score (y_val , y_pred )
9090 if val_acc > best_acc :
@@ -93,7 +93,7 @@ def fit_logistic_regression_preset_splits(
9393 y_pred = np .argmax (y_pred , axis = 1 )
9494 y_pred = one_hot_encoder .transform (
9595 y_pred .reshape (- 1 , 1 )
96- ).astype (np .bool )
96+ ).astype (np .bool_ )
9797 best_test_acc = metrics .accuracy_score (y_test , y_pred )
9898
9999 accuracies .append (best_test_acc )
0 commit comments