I have two lists. One with sample data and one with corresponding labels. I need to randomly pick data from the sample data , but I need their corresponding labels as well.
This is what I currently do:
amount = int(5000 * percent)
rawTrainingData = random.sample(rawTrainingData, amount)
Raw training data is my first list. My second list is trainingLabels, but I want it to correspond with the first list.
For example if you have lists as such:
['A','B','C','D'] ['1','2','3','4']
And I wanna pick two random elements from the first list, and have their corresponding indices picked from the second list.
Example:
['C','A'] ['3','1']
['B','D'] ['2','4']
Initially both lists are same length and they correspond with each other. I just want them to remain corresponding once I randomize the first array.
Aucun commentaire:
Enregistrer un commentaire