Say I have a DataFrame full of positive samples and context features for a given user:
target user cashtag sector industry
0 1 170 4979 3 70
1 1 170 5539 3 70
2 1 170 7271 3 70
3 1 170 7428 3 70
4 1 170 686 7 139
where a positive sample is a user having interacted with a cashtag and is denoted by target = 1.
What is a quick way for me to generate negative samples in the ratio 1:2 (+ve:-ve) for each interaction, denoted by target = -1?
EDIT: Sample for clarity below (for the first two positive samples)
target user cashtag sector industry
0 1 170 4979 3 70
1 -1 170 3224 7 181
2 -1 170 4331 7 180
3 1 170 5539 3 70
4 -1 170 9304 4 59
5 -1 170 3833 6 185
For instance, for each cashtag a user has interacted with, I'd like to pick at random 2 other cashtags that they haven't interacted with and add them as negative samples to the dataframe; effectively increasing the size of the dataframe to 3 times its original size.
It would also be helpful to check if the negative sample hasn't already been entered for that user, cashtag combination.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)