analyticalmindsltd / smote_variants

A collection of 85 minority oversampling techniques (SMOTE) for imbalanced learning with multi-class oversampling and model selection features
http://smote-variants.readthedocs.io
MIT License
632 stars 137 forks source link

evaluation metrics #15

Closed arjunpuri7 closed 4 years ago

arjunpuri7 commented 4 years ago

I want to calculate true positive and true negative in my model and trying to use sklearn.metrics using some techniques mentioned in smote_variants. how can I uses these metrics with smote_variants? if not can you provide true positive, true negative rate in your module?

from, Arjun Puri

arjunpuri7 commented 4 years ago

I use code 'Integration with sklearn' but error appear:

module 'smote_variants' has no attribute 'OversamplingClassifier'

I update library but still not working. please help me out

gykovacs commented 4 years ago

Could you please provide the details of your system and also a minimal sample code which is not working?

arjunpuri7 commented 4 years ago

windows 8.1 version of python: 3.6.4

code import smote_variants as sv import imblearn.datasets as imb_datasets

from sklearn.model_selection import train_test_split, GridSearchCV from sklearn.pipeline import Pipeline from sklearn.preprocessing import StandardScaler from sklearn.neighbors import KNeighborsClassifier

libras= imb_datasets.fetch_datasets()['libras_move'] X, y= libras['data'], libras['target']

oversampler= sv.MulticlassOversampling(sv.distance_SMOTE()) classifier= KNeighborsClassifier(n_neighbors= 5)

model= Pipeline([('scale', StandardScaler()), ('clf', sv.OversamplingClassifier(oversampler, classifier))])

model.fit(X, y)

gykovacs commented 4 years ago

This is definitely a working sample code. What does

sv.version

give?

gykovacs commented 4 years ago

Sorry, github formatted the text, as a code:

sv.__version__
arjunpuri7 commented 4 years ago

sorry, for delay in response. The version of smote_variants : 0.3.4

arjunpuri7 commented 4 years ago

now its working thanks...