Handling Imbalanced Datasets SMOTE Technique

Sdílet
Vložit
  • čas přidán 9. 02. 2020
  • CODE: github.com/ashokveda/youtube_...
    DATA : github.com/ashokveda/youtube_...
    / ashokveda

Komentáře • 232

  • @donaloleary5514
    @donaloleary5514 Před 3 lety +1

    Thank you, Ashok! This is an outstanding explanation of a complex subject. You make it all feel very intuitive. Awesome stuff - I will look for more DataMites videos in the future!

    • @DataMites
      @DataMites  Před 3 lety

      "Hi, Donal O'Leary,
      Thanks for your comment and keep on visiting our channel for more and updated content."

  • @pandharpurkar_
    @pandharpurkar_ Před 3 lety +4

    best teacher i have ever seen! Explaining in very proper way! in short time explaining exact things!!!

  • @akshiwakoti7851
    @akshiwakoti7851 Před 4 lety +1

    A real pro! Subbed this channel after watching first 3 minutes. Glad to have found it.

  • @bhagwatchate7511
    @bhagwatchate7511 Před 4 lety +2

    Amazing in depth explanation! I was exactly searching for this type of explanation.. Thanks for sharing

  • @alisalariyan6676
    @alisalariyan6676 Před 3 lety

    The best smote tutorial I've seen. Thanks

  • @JainmiahSk
    @JainmiahSk Před 4 lety +7

    Data Mites is a hidden gem now but soon they will be a Brand for Data Science. Keep my note for Future.

  • @SurajSingh-wn4wu
    @SurajSingh-wn4wu Před 4 lety +1

    Great Ashok.!! Genuinely liked your way of explanation in depth and the solution... Glad i landed on your page...
    Thank You..!

  • @8sharkey8
    @8sharkey8 Před 3 lety

    Excellent content, brilliantly presented. Thank you. Subscribed.

  • @siddhantagarwal274
    @siddhantagarwal274 Před 4 lety +1

    Nicely explained. Thanks!

  • @user-dn8uc5sc8l
    @user-dn8uc5sc8l Před 6 měsíci

    Wow sir liked u r session .please continue posting such videos

  • @bhanukiran4317
    @bhanukiran4317 Před 3 lety

    Great content sir !! Keep on spreading knowledge

  • @mohamedoutghratine8538

    Amazing in depth explanation

  • @user-km4hl8lx8x
    @user-km4hl8lx8x Před rokem +1

    This is really helpful and thank you again!

    • @DataMites
      @DataMites  Před rokem

      Glad it was helpful! Keep Watching!

  • @inspiritlashi9994
    @inspiritlashi9994 Před 2 lety

    Thank you so much for the great tutorial.. As someone who does not have even the basic knowledge of python, I could learn many things from you, sir.

  • @riorizki4211
    @riorizki4211 Před 3 lety

    Great video and explanation! Thanks.

  • @osamaamir9311
    @osamaamir9311 Před rokem +1

    Such an amazing topic

  • @MLA263
    @MLA263 Před rokem

    Thanks Ashok, very clear and simple explanation.

  • @binoypaul9772
    @binoypaul9772 Před 3 lety

    Nice and informative. Please keep up the good work.

  • @tanvipataskar4597
    @tanvipataskar4597 Před 4 lety

    Amazing Explanation!!! Thankyou.

  • @ChrisHalden007
    @ChrisHalden007 Před rokem +1

    Great video. Thanks

    • @DataMites
      @DataMites  Před rokem

      Glad you like it! Keep Supporting

  • @defres15
    @defres15 Před 2 lety

    Great video. Great explanation. Thank you

  • @Cobra-bo1fy
    @Cobra-bo1fy Před 2 lety

    excellent explanation!

  • @babukoshy
    @babukoshy Před 3 lety

    This was a great lesson. Thanks a lot

  • @manishbolbanda9872
    @manishbolbanda9872 Před 3 lety

    wonderfully explained.thank you.

  • @alishahsaber3795
    @alishahsaber3795 Před 2 lety

    Thank you so much!!! Really helpful. thanks

  • @milliekim5072
    @milliekim5072 Před 2 lety +1

    Thank you so much, sir! I hope I see more videos

  • @jagannadhareddykalagotla624

    DataMites is like hidden pattern in unsupervised learning thank you so much ashok❤️❤️

  • @AsiaMSaeed
    @AsiaMSaeed Před 2 lety

    Amazing. Thanks a lot.

  • @lalithapriya9484
    @lalithapriya9484 Před 3 lety

    extreme clarification really superb teaching skills along with good communications

    • @DataMites
      @DataMites  Před 3 lety

      Hi lalitha priya, thank you for you comment.

  • @canancetin7897
    @canancetin7897 Před 3 lety

    Great video! Thanks a lot!!!

  • @samhugh9891
    @samhugh9891 Před 3 lety

    great video, thank you!

  • @dikshitlenka
    @dikshitlenka Před 3 lety

    Very clear explanation. Thanks

  • @sabbirahmmed7161
    @sabbirahmmed7161 Před 2 lety

    Thanks, nice explanation

  • @ffckode
    @ffckode Před 4 lety

    Thanks for sharing. Very helpful

  • @adeyinkasotunde6870
    @adeyinkasotunde6870 Před 4 lety +1

    wow...... i am very well impressed. well explained. thanks

  • @nehaurade4917
    @nehaurade4917 Před 3 lety

    Perfect video..thank you

  • @parsayadpa5446
    @parsayadpa5446 Před 2 lety

    thanks alot for this good tutorial.

  • @MrMehshankhan
    @MrMehshankhan Před 3 lety

    thank you so much man. great thumbs up...

  • @b1k1m1
    @b1k1m1 Před 4 lety +2

    Hello Sir, Thanks for explaining this very clearly.. keep it up....

  • @aftabnaseem
    @aftabnaseem Před 3 lety

    Great job ....made it look very easy

  • @michaelpanashemudimbu7405

    Awesome video

  • @wenshanpan8726
    @wenshanpan8726 Před 3 lety

    Excellent!

  • @nasreenbanu2245
    @nasreenbanu2245 Před 2 lety

    Hai sir! thanks a lot for very simple and clear explanation.keep going we expect more videos from you...

  • @dewipurnamasari5814
    @dewipurnamasari5814 Před rokem +2

    Thank you very much

  • @mozaffarhussain5496
    @mozaffarhussain5496 Před 4 lety

    Best Explanation sir ..............!

  • @ombb3576
    @ombb3576 Před 2 lety

    Thank you for your sincere lecture sir

  • @heenagirdher6443
    @heenagirdher6443 Před 3 lety

    Great tutorial. Very good explanation sir.

  • @jongcheulkim7284
    @jongcheulkim7284 Před 2 lety

    Thank you so much. ^^

  • @patrickbormann8103
    @patrickbormann8103 Před 3 lety

    Amazing!

  • @AMITSHARMA-fy4wv
    @AMITSHARMA-fy4wv Před 3 lety

    Really appreciate sir..Lot off.🙏🏼🙏🏼🙏🏼🙏🏼🤗🤗🤗👌👌👌👌😊😊😊😊

  • @zakariaabderrahmanesadelao3048

    what a crystal clear explanation. thank you.

  • @akshayjadhav2213
    @akshayjadhav2213 Před 3 lety

    very nicely explained sir ..thank you

  • @svitirur1665
    @svitirur1665 Před 3 lety

    very good explanation

  • @sasidharansathiyamoorthy6918

    Thank you for the informative video! In this video, you have used SMOTE to rectify imbalance in target label. What methods can we use to deal with class imbalance in categorical features( input) in order to make the model more robust?

    • @DataMites
      @DataMites  Před 3 lety +1

      Hi Sasidharan Sathiyamoorthy, Its property of input so if u balance the input it might affect the target variable. Make 2 models with and without balancing n check the performance

    • @RoyalRealReview
      @RoyalRealReview Před 2 lety

      @@DataMites sir if we have 54% persons cancer patients and 46% non-cancer patients then do we need balancing? If yes then which balancing technique should be selected?

  • @sandeshbapu1567
    @sandeshbapu1567 Před 4 lety

    Nicely explained

  • @abhijitkamune3976
    @abhijitkamune3976 Před 4 lety

    Nice explanation .. Looking for more NLP related video

  • @athilakshmir8589
    @athilakshmir8589 Před 3 lety

    nice explanation

  • @shivki23
    @shivki23 Před 4 lety

    subscribed for ur content

  • @lavanyanayak8707
    @lavanyanayak8707 Před 3 lety

    Thank you very much for this video. I have a precipitation dataset containing 4 columns and 8000 rows, each of them has a lot of zeros and only a few continuous values. I would like to know if I can use smote in this case?

    • @DataMites
      @DataMites  Před 3 lety +1

      Hi Lavanya Nayak
      , Github link is provided in the description. please check it out.

  • @mohan250s
    @mohan250s Před rokem

    ur awesome

  • @perusona_desu5534
    @perusona_desu5534 Před rokem

    in oversampling do you have to make the minority class instances equals the majority class instances ?
    for example:
    can it be 900 nc
    and 800 c

    • @DataMites
      @DataMites  Před rokem

      Oversampling is increasing the samples for minority class to match with the majority class. Undersampling is reducing the samples for majority class to match with minority class.

  • @anaghadamame196
    @anaghadamame196 Před 3 lety

    Thank you sir...👍

    • @anaghadamame196
      @anaghadamame196 Před 3 lety

      Can you explain which algorithm should be selected for regression problem....it will help me alot

    • @DataMites
      @DataMites  Před 3 lety

      All the best

  • @insidiousmaximus
    @insidiousmaximus Před 3 lety

    great video thank you. I am trying to figure out how to use this with a generator flowing from directory?

    • @DataMites
      @DataMites  Před 3 lety

      "Hi
      insidiousmaximus, thanks for reaching us with your query.
      Can you please put your query more precisely so that we can help you?"

  • @cliffordtarimo1511
    @cliffordtarimo1511 Před 3 lety

    Great video on SMOTE. Do you have a video on undersampling? Can someone perform both undersampling and oversampling in one line of code??? THANKS.

    • @DataMites
      @DataMites  Před 3 lety

      The other flavor of SMOTE is SMOTETOMEK which uses undersampling of majority class and upsamping of minority class.

  • @chinedumjoseph9875
    @chinedumjoseph9875 Před 3 lety

    Oh! I got it. Don't worry. Thanks

  • @muhammedalisahan9661
    @muhammedalisahan9661 Před rokem

    Firstly, Thank you for sharing. I wanna ask something about time series. I have lots of data. But datas are different frequency. I wonder how deal with all datas. And assume that datas edited to same frequency. By the way datas are not fitted normal distribution so imbalanced that's why i am asking. If datas be same frequency, Smote can be appliable for time series? If not how to resample my time series?

  • @seeutube8860
    @seeutube8860 Před rokem

    Nice video.
    After applying smote, balanced data was obtained. But balanced data (X_smote,y_smote) was not split (80:20) in to train n test data sets before reapplying classification model?
    Is it necessary or not to split the data again? Or orginal dataset itself was considered as test dataset.

    • @DataMites
      @DataMites  Před rokem

      We have already split and then we balanced the data. So not required to split again.

  • @niswandi6122
    @niswandi6122 Před rokem +1

    Thank you ashok, clear explanation, but howto handle the imbalanced datasets if we have 4 classes?

    • @DataMites
      @DataMites  Před rokem

      For multiclass also same technique is applied as that of 2 classes

  • @OriginalBernieBro
    @OriginalBernieBro Před 4 lety

    Running into a problem with sklearn 'support' column still looking unbalanced after smoting on print(classification_report(y_test, y_pred)) what gives?

    • @DataMites
      @DataMites  Před 3 lety

      The support is the number of samples of the true response that lie in that class.

  • @kurniawandk5078
    @kurniawandk5078 Před 2 lety

    Very informative, i have a question sir, it is possible to set how many synthetic data created by smote ? in example i want to set n_sample increase to 200% so, how to put this parameters in pyhton code ?

    • @DataMites
      @DataMites  Před 2 lety

      Your question is not clear. Can you elaborate plz?

  • @swastiknayak5173
    @swastiknayak5173 Před 3 lety

    At 8.15 you have said it is taking the average of centroids which is completely wrong. SMOTE is calculated over the feature space...it goes like this
    1. we take the feature vector of the minority class point.
    2. we calculate the distance between the neighbours (neighbours=5).
    3. we multiply the distance between the neighbours with a random number that is created between 0 &1.
    4. Then we create the synthesized point.
    hope you got it 😀

    • @DataMites
      @DataMites  Před 3 lety

      SMOTE works by selecting examples that are close in the feature space, drawing a line between the examples in the feature space and drawing a new sample at a point along that line.
      Specifically, a random example from the minority class is first chosen. Then k of the nearest neighbours for that example are found (typically k=5). A randomly selected neighbour is chosen and a synthetic example is created at a randomly selected point between the two examples in feature space.

  • @dkandasamypandian719
    @dkandasamypandian719 Před 3 lety

    Good

  • @ShubhamKumar-id6pf
    @ShubhamKumar-id6pf Před 3 lety

    SIr, I went on as per the recommended procedures but my jupyter environment giving an AttributeError that SMOTE object has no attribute '_validate_data'.
    Can you please help me with the.

    • @DataMites
      @DataMites  Před 3 lety +1

      You need to upgrade scikit-learn to version 0.23.1.

  • @kunalgoyal8529
    @kunalgoyal8529 Před 4 lety

    While dividing training and test data shouldn't you be doing "stratify=y" ? To ensure test data and training data set have equal proportion of outcome variable?

    • @mr.techwhiz4407
      @mr.techwhiz4407 Před 3 lety

      that would be undersampling

    • @DataMites
      @DataMites  Před 3 lety

      The aim of machine learning model is to generalization on training set so that performance on unseen
      Data is good.We don't care what the test data consist instead we try to given more generalized pattern to the algorithms.

  • @younesgasmi8518
    @younesgasmi8518 Před 4 měsíci

    Thanks so much bro..i have shown some data scientists used undersampling and oversampling before Splitting the dataset into training and testing..in my research paper we heve used NEARMISS technique to balance the dataset..i have got a good results with using cross validation Splitting and Extra tree classifier as model and also the same model to select the best importance features where my results are : (ACC 0.97 , F1 0.97 and AUC 0.99) are there results may be accepted for publishing?

    • @DataMites
      @DataMites  Před 4 měsíci +1

      You achieved good results. However, whether your results are acceptable for publishing depends on several other factors too.

  • @tahanics901
    @tahanics901 Před 2 lety

    Very good explanation Thanks. but this code, is applicable with text data (tweets) or not?

    • @DataMites
      @DataMites  Před 2 lety

      yes after converting text to numerical vectors. use fit_resample()

  • @rengarajramanujam6499
    @rengarajramanujam6499 Před 3 lety

    Good....

  • @hendripriyambowo1427
    @hendripriyambowo1427 Před 3 lety

    hi sir i have question how did we implement those resampling technique in neural network, let say if we implement embedding layer and work with multiple kind of data
    is that resampling technique make our data losing such information?

    • @DataMites
      @DataMites  Před 3 lety

      You can use mini-batch SGD optimizer to handle imbalance dataset.

  • @ringgaershaikhwani3478
    @ringgaershaikhwani3478 Před rokem +1

    hello sir, the material that you explain is very easy to understand. I want to ask about my project. I have imbalanced data, then I do smote and I model it with KNN, but why after smote does the accuracy go down? 79% to 78%, is there something wrong with my data? Can you help explain this? I am very grateful if you respond to my comment.

    • @DataMites
      @DataMites  Před rokem +1

      Using SMOTE, your model will start detecting more cases of the minority class, which will result in an increased recall, but a decreased precision. Accuracy is not a good measure of performance on unbalanced classes. That's because SMOTE technique puts more weight to the small class, makes the model bias to it. The model will now predict the small class with higher accuracy but the overall accuracy may decrease.

  • @amruthakommu4695
    @amruthakommu4695 Před 2 lety +1

    Great Ashok. That was a well explained video. I tried the same thing on my data set but my accuracy came down from 94 to 86. What could be the cause?

    • @DataMites
      @DataMites  Před 2 lety

      Hi, we cannot comment until we look in your data and all the approaches that you have taken. One of the possibility might be your prediction was previously overfitted.

  • @petersq5532
    @petersq5532 Před 2 lety

    how split stratify solves the problem?

  • @chinedumjoseph9875
    @chinedumjoseph9875 Před 3 lety

    Thank you for this nice explanation. I was making progress with the codes but when I tried to fit using the command X_train_smote, y_train_smote = smote.fit_sample(X_train.astype('float'),y_train), I got error saying AttributeError: 'SMOTE' object has no attribute 'fit_sample'. I need urgent help please. Thank you

    • @DataMites
      @DataMites  Před 3 lety

      Hi Chinedum Joseph, can you please list the version of python and scikit learn in your system?

    • @ObaidoGeorge
      @ObaidoGeorge Před rokem

      Use smote.fit_resample instead of smote.fit_sample.

    • @AbdulLatif-fu9jz
      @AbdulLatif-fu9jz Před rokem

      @@ObaidoGeorge Tqvm for your help

  • @ishan7491
    @ishan7491 Před 2 lety

    Can you please explain this part of the code in the label encoder section:

    • @DataMites
      @DataMites  Před 2 lety

      Hi Ishan, please reframe your query.

  • @faisalshehzad9504
    @faisalshehzad9504 Před 4 lety

    thanks.

  • @rukaiyaa191
    @rukaiyaa191 Před 2 lety

    which module is used for alternative module of imblearn in python sir(for handling imbalance dataset)

    • @DataMites
      @DataMites  Před 2 lety

      For balancing the dataset we have only imblearn module. But there are other ways to deal with the imbalanced dataset.

  • @abhimynampati2929
    @abhimynampati2929 Před 2 lety

    Hey Ashok, can u make a video on dsste algorithm for removing class imbalance?

  • @inspiritlashi9994
    @inspiritlashi9994 Před 2 lety

    Sir,
    Can I know how to run a logistic regression on the oversampled dataset?

    • @DataMites
      @DataMites  Před 2 lety

      Hi Inspirit Lashi, you can use SMOGN for preprocessing of your dataset. More more information: proceedings.mlr.press/v74/branco17a/branco17a.pdf

  • @terryterry3733
    @terryterry3733 Před 3 lety

    Hi sir what is the data type for outcome ? i think it is in object . Did u convert that into float or int?

    • @DataMites
      @DataMites  Před 3 lety

      "Hi Terry, thanks for reaching to us regarding your queries.
      Outcome datatype is in the string and we label encoded it to an integer."

  • @JainmiahSk
    @JainmiahSk Před 4 lety +1

    you haven't encoded the target variable?

    • @DataMites
      @DataMites  Před 4 lety

      Target variable needn't require encoding

  • @patelajay1010
    @patelajay1010 Před 3 lety

    I have one doubt. What if data contains Nan values and you want to do under_sampling? If you impute Nan values with Mean() then there will be information leakage because we impute data before splitting it into train and test dataset. Could you please tell me what should be the possible solution in this case?

    • @DataMites
      @DataMites  Před 3 lety +1

      Hi
      Ajay Patel, if you have a large dataset, you can certainly drop the Nan Values

    • @patelajay1010
      @patelajay1010 Před 3 lety

      @@DataMites Sir I have continuous data coming from sensors. Dropping few rows will lead to break a pattern.

    • @DataMites
      @DataMites  Před 3 lety

      @@patelajay1010 In that case without knowing the source and significance of your nan value, we cannot comment on anything.

    • @patelajay1010
      @patelajay1010 Před 3 lety

      @@DataMites ok sir. Thank you for your response.

  • @sushmithajanapati7785
    @sushmithajanapati7785 Před 2 lety

    Does Smote algorithm support Multi output classification?

  • @snehasamadder3790
    @snehasamadder3790 Před rokem

    after I resample an imbalance dataset how can I download the resampled dataset from colab?

    • @DataMites
      @DataMites  Před rokem

      Combine the resampled x and y and create a new dataframe, then convert that dataframe to a csv file using to_csv()

  • @HarishKumar-qj9pp
    @HarishKumar-qj9pp Před 3 lety

    getting attribute error: 'SMOTE' object has no attribute 'fit_sample' but I have all the packages requirement satisfied still showing the error

    • @DataMites
      @DataMites  Před 3 lety

      Hi please check imbalanced-learn.org/stable/over_sampling.html for any update in imbalance learn package

  • @sunnyarora4916
    @sunnyarora4916 Před 3 lety

    Any video where we use SMOTE for regression??

    • @DataMites
      @DataMites  Před 3 lety +1

      Hi Sunny Arora, you can use SMOGN for it. More more information: proceedings.mlr.press/v74/branco17a/branco17a.pdf

    • @sunnyarora4916
      @sunnyarora4916 Před 3 lety

      @@DataMites Thank you, is it less likely to use SMOGN?

  • @sanyajain2127
    @sanyajain2127 Před 3 lety

    Getting an error: ValueError: Unknown label type: 'continuous-multioutput'

    • @DataMites
      @DataMites  Před 3 lety

      It can due to multiple reasons like in logistic-regression doing classification more than 2 classes.
      Or due to the use of classifier if the target variable is continuous.

  • @wajeehanaz9115
    @wajeehanaz9115 Před 2 lety

    Hello Sir!
    can you please tell me how to generate images using smote technique ???
    Thanks in advance...

    • @DataMites
      @DataMites  Před 2 lety

      For image generation we have a different method called Data Augmentation it will newly create synthetic data from existing data.

  • @vivekuk4329
    @vivekuk4329 Před 3 lety

    hi sir need to join in ur classes how to approach you

    • @DataMites
      @DataMites  Před 3 lety

      Hi Vivek uk , please share your email id and contact number. Our educational counselor will share the details. You can contact our counselor directly at 18003133434. For more info datamites.com/

  • @wajeehanaz9115
    @wajeehanaz9115 Před 2 lety

    Thank you for informative video! I used your coding but got error "
    ValueError: could not convert string to float: '5more'"...plz tell me how can I resolve this error...Thanks in advance:)

    • @DataMites
      @DataMites  Před 2 lety

      We have to look into your code. But please check if you have converted all the categorical values to numerical values in your dataset.

    • @RoyalRealReview
      @RoyalRealReview Před 2 lety

      @@DataMites sir I am predicting heart disease and out of my sample 54% people have heart disease and rest 46% don't have so which method I should use for balancing?

  • @oumaimasouid5229
    @oumaimasouid5229 Před 3 lety

    i find this error >> plz help !

  • @datascientist2958
    @datascientist2958 Před 3 lety

    Sir how can we adjust ratio and what's behind it

    • @DataMites
      @DataMites  Před 3 lety

      If you are asking for class ratios of target variable to be called as imbalance then it can 90:10,80:20,70:30.