Skip to content

Commit 4ca3878

Browse files
committed
float division
1 parent 2ddb503 commit 4ca3878

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sklearn/utils/estimator_checks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ def check_class_weight_balanced_linear_classifier(name, Classifier):
11031103

11041104
# Count each label occurrence to reweight manually
11051105
n_samples = len(y)
1106-
n_classes = len(np.unique(y))
1106+
n_classes = float(len(np.unique(y)))
11071107

11081108
class_weight = {1: n_samples / (np.sum(y == 1) * n_classes),
11091109
-1: n_samples / (np.sum(y == -1) * n_classes)}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy