Created
February 3, 2019 21:18
-
-
Save terrah27/9b57c2ff82d58f23874254101fc1e1bb 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
# still using our separated classes fraud and not_fraud from above | |
# downsample majority | |
not_fraud_downsampled = resample(not_fraud, | |
replace = False, # sample without replacement | |
n_samples = len(fraud), # match minority n | |
random_state = 27) # reproducible results | |
# combine minority and downsampled majority | |
downsampled = pd.concat([not_fraud_downsampled, fraud]) | |
# checking counts | |
downsampled.Class.value_counts() | |
1 360 | |
0 360 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment