Skip to content

Instantly share code, notes, and snippets.

@MemphisMeng
Created August 3, 2020 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MemphisMeng/9f76d21228a2b997a6c35d175ad2b7b2 to your computer and use it in GitHub Desktop.
Save MemphisMeng/9f76d21228a2b997a6c35d175ad2b7b2 to your computer and use it in GitHub Desktop.
from sklearn import preprocessing
from imblearn.over_sampling import RandomOverSampler
le = preprocessing.LabelEncoder()
fixtures['Score'] = le.fit_transform(fixtures['Score'].astype(str))
ros = RandomOverSampler(random_state=42)
fixtures, Score_ = ros.fit_resample(fixtures.drop(columns=['Score']), fixtures['Score'])
fixtures['Score'] = le.inverse_transform(Score_)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment