Created
January 6, 2021 03:13
-
-
Save MattLowrieDS/421498d8b93d677fc93c97c09366e07c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lbl_vc = feature_label_df['labels'].value_counts() | |
total = lbl_vc.sum() | |
mu = 3.0 | |
class_weights = {} | |
for i, k in enumerate(lbl_vc.keys()): | |
w = np.log(mu * total / float(lbl_vc[k])) | |
class_weights[i] = w if w > 1 else 1 | |
print(class_weights) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment