Last active
September 9, 2019 13:27
-
-
Save Tandon-A/334efacbd79e927fbf420ab5e43e7239 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
def modify_db(db,noise=0.5): | |
first_coin_flip = (torch.rand(len(db)) < noise).float() | |
second_coin_flip = (torch.rand(len(db)) < 0.5).float() | |
augmented_database = db.float()*first_coin_flip + (1-first_coin_flip)*second_coin_flip | |
#augmented database can also be created using this other way | |
''' | |
augmented_database = db.copy() | |
augmented_database[first_coin_flip == 0] = second_coin_flip[first_coin_flip == 0] | |
''' | |
return augmented_database |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment