Machine Learning Tutorial Python - 15: Naive Bayes Classifier Algorithm Part 2

Поделиться
HTML-код
  • Опубликовано: 4 окт 2024

Комментарии • 345

  • @codebasics
    @codebasics  2 года назад +1

    Check out our premium machine learning course with 2 Industry projects: codebasics.io/courses/machine-learning-for-data-science-beginners-to-advanced

  • @vishalgupta3175
    @vishalgupta3175 4 года назад +18

    Sir You are amazing, an experience of 25 years is really brilliant, Thanks for Guiding us

  • @moeintorabi2205
    @moeintorabi2205 4 года назад +20

    The Guassian model is more accurate. As mentioned in the video, the Gussian model is more accurate for cases where the features have continuous values, which is the case for the Wine dataset.

    • @muhammedrajab2301
      @muhammedrajab2301 4 года назад +1

      yep , you are right, GaussianNB gave me 100% score.

  • @r21061991
    @r21061991 4 года назад +14

    Excellent channel to start learning the ML concepts...Way better than almost all the paid courses out their

  • @anujvyas9493
    @anujvyas9493 4 года назад +20

    Solved the exercise, got these answers:
    Using Gaussian : 1.0
    Using Multinominal : 0.889

    • @vikaskulshreshtha
      @vikaskulshreshtha 3 года назад

      Can you please send me the code and dataset vikas.kulshreshtha@gmail.com

    • @abhijeetvighne4452
      @abhijeetvighne4452 3 года назад

      what is .values in X_train.values in fit_transform

  • @Yash8147
    @Yash8147 2 года назад +1

    I got
    100% accuracy with Gaussian NB
    96% accuracy with Multinomial NB
    Thanks for explaining in a very easy and convenient way :)

  • @kamalsingh1345
    @kamalsingh1345 2 года назад +5

    Thanks a lot for this playlist of such amazing tutorials.
    at test_size=0.2, GaussianNB: 97.2% and MultinonialNB: 77.3%

  • @moeintorabi2205
    @moeintorabi2205 4 года назад +9

    For comparing the models I used Cross Validation (CV = 4) as you explained in the previous videos.
    Average Gaussian Score = 0.9722222222222222
    Average Multinomial score = 0.8333333333333333

    • @study_with_thor
      @study_with_thor 3 года назад

      better approach! thanks for your suggestion

  • @codebasics
    @codebasics  4 года назад +2

    Exercise solution: github.com/codebasics/py/blob/master/ML/14_naive_bayes/Exercise/14_naive_bayes_exercise.ipynb
    Complete machine learning tutorial playlist: ruclips.net/video/gmvvaobm7eQ/видео.html

    • @amitapatra7414
      @amitapatra7414 4 года назад

      X_train_count = v.fit_transform(X_train.values) getting error here

    • @amitapatra7414
      @amitapatra7414 4 года назад

      AttributeError: 'NoneType' object has no attribute 'lower'
      this is the error

  • @bechirmariam8684
    @bechirmariam8684 Год назад +1

    i can just say that you are a perfect teacher, Thank you very much. This is a best channel to learn all about datascience!!!

  • @tsai301103
    @tsai301103 Год назад +2

    GaussianNaiveBayes 0.972/ MultinomialNaiveBayes 0.94. MinMaxScaler train dataset. This series of tutorials are strongly recommended. Help me a lot

  • @navneetkaurpopli2766
    @navneetkaurpopli2766 4 года назад +2

    All your ML videos are wonderful. Good job. Difficult things explained easily. Thanks

  • @gajanantayde
    @gajanantayde 3 года назад +1

    Thank you for this wonderful tutorial
    Exercise scores
    GaussianNB score - 94.5%
    MultinomialNB score - 84.5%

    • @codebasics
      @codebasics  3 года назад

      Good job gajanan, that’s a pretty good score. Thanks for working on the exercise

    • @nisarali1954
      @nisarali1954 2 года назад

      Kindly Sir, Help me to find a malicious email through AI. any link etc...

  • @mehmetyigitakn8208
    @mehmetyigitakn8208 2 года назад +1

    outstanding video series! greetings from Turkey, I learn too much from this channel. It's now my primary go-to resource to learn machine learning from scratch

  • @premnathmagi
    @premnathmagi 2 года назад +1

    I don't know why some people have disliked this video. How beautifully he is explaining the M.L algorithms.

  • @TheNobody04
    @TheNobody04 3 года назад +2

    My scores are : Multinomial NB = 0.84, Gaussian NB = 0.97. Thank you so much for these videos :)

    • @codebasics
      @codebasics  3 года назад +1

      Great job and great score. ☺️👍

  • @kisiki_kt_na_lage
    @kisiki_kt_na_lage 4 года назад +3

    You, Sir, are our hero!!!

  • @austinwhite1316
    @austinwhite1316 2 года назад

    I think you might be the most valuable resource online for ML beginners.
    Gaussian: 100%
    Multinomial: 86.1%

  • @karthikc8992
    @karthikc8992 4 года назад +2

    U r one of the best teacher I have ever seen
    keep rocking
    By the way I don't know from what you r suffering
    get well soon buddy
    take care of yourself.👍

    • @codebasics
      @codebasics  4 года назад +2

      I was suffering from Ulcerative colitis. I am doing well now.

    • @karthikc8992
      @karthikc8992 4 года назад +1

      @@codebasics thanks for ur reply sir
      May I no from where u r?

    • @muhammedrajab2301
      @muhammedrajab2301 4 года назад +1

      @@karthikc8992 He is in US

    • @karthikc8992
      @karthikc8992 4 года назад

      @@muhammedrajab2301 I learned it before , by the way thank u for your reply

  • @sidduhedaginal
    @sidduhedaginal 4 года назад +4

    Wonderfull explanation sir, thanks for that and here is my result after execution
    GaussianNB : 96.2%
    MultinomialNB: 88.8%

    • @codebasics
      @codebasics  4 года назад +1

      Siddu, good job indeed.thats a pretty good score

    • @nisarali1954
      @nisarali1954 2 года назад

      Kindly Sir, Help me to find a malicious email through AI. any link etc...

  • @larrybuluma2458
    @larrybuluma2458 4 года назад +1

    Gaussian: 1.0
    Multinomial: 0.833
    Keep up the good work you're doing

  • @reemnasser9105
    @reemnasser9105 2 года назад +2

    I always recommend your playlist to others, it's really helpful and thanks for this effort.

  • @charmindesai3730
    @charmindesai3730 2 года назад

    Amazing tutorial, you teach far better than university professors. Following many of your playlist thoroughly !!! Thank you very much

  • @mapa5000
    @mapa5000 Год назад

    Thank you for sharing your knowledge. These ML classes are gold ! 👏🏼👏🏼👏🏼

  • @alikhannurkamal4691
    @alikhannurkamal4691 3 года назад +1

    Thank you very much for that tutorial!
    My results were:
    GaussianNB score - 97.2%
    MultinomialNB score - 86.1%

    • @codebasics
      @codebasics  3 года назад +1

      Good job Alikhan, that’s a pretty good score. Thanks for working on the exercise

    • @nisarali1954
      @nisarali1954 2 года назад

      Kindly Sir, Help me to find a malicious email through AI. any link etc...

  • @bhavishyvidya
    @bhavishyvidya 2 года назад +1

    Thank you Sir, for these well informed videos on ML.

  • @piyushjha8888
    @piyushjha8888 4 года назад

    Exercise answer:
    Gaussian : 1.0
    MultinomialNB : 0.889
    Sir u use random state in your solution.Thank you sir i learned something new

  • @userhandle-u7b
    @userhandle-u7b 3 месяца назад

    Thanks a lot for the tuto. Your series is best because it contains the exercises.
    My exercise result: GaussianNB = 0.96, MultinomialNB = 0.84. I also applied cross validation =5

  • @akshatsingh6036
    @akshatsingh6036 4 года назад

    i must say premium lectures i am getting from you sir

  • @bhavyanaik74
    @bhavyanaik74 3 года назад

    you are one of the best teacher in my life.

  • @akashbairagi6840
    @akashbairagi6840 3 года назад

    Amazing !!! Just Amazing ‎️‍🔥 The best ML tutorial on RUclips....

  • @AnimeshSinghIITM
    @AnimeshSinghIITM 2 года назад +1

    Thanks for making such great content, free of cost. I'm enjoying .

  • @ebtehalturki6329
    @ebtehalturki6329 2 года назад

    I have never found such informative course like this.. Really great job !!!

  • @stephenngumbikiilu3988
    @stephenngumbikiilu3988 2 года назад +1

    Thank you for your amazing explanation. I have learned a lot.
    Gaussian NB: 100%
    Multinomial: 91.11%

    • @himakshipahuja3015
      @himakshipahuja3015 2 года назад

      From where did you get the dataset?

    • @stephenngumbikiilu3988
      @stephenngumbikiilu3988 2 года назад +1

      @@himakshipahuja3015 Check the exercise file and you will see the data set. Please tell me if you can't find it and I will send it to you

    • @himakshipahuja3015
      @himakshipahuja3015 2 года назад

      Thank you very much, @Stephen Ngumbi Kiilu. I found the dataset.

  • @Taher-p7i
    @Taher-p7i 3 месяца назад

    Very nice explanation, Thank you so much sir for keeping this much effort in making videos and the exercises

  • @subhajitadhikary155
    @subhajitadhikary155 4 года назад

    Really great videos sir, explained very well.
    About the exercise:-
    for GaussianNB :- 1.0
    for MultinomialNB:- 0.944
    with random_state= 7 and test_size=0.2

    • @codebasics
      @codebasics  4 года назад +1

      Great score. Good job 👍👏

  • @muhammedrajab2301
    @muhammedrajab2301 4 года назад +1

    I solved the exercise and I got the following score:
    used train_test_split with test_size=0.2 and random_state=123
    This parameters gave me following results:
    GaussianNB score: 1.0(100%)
    MultinomialNB score: 0.888888888888888(88%)
    dataset shape : (178,13)[Dataset is pretty small!]

    • @codebasics
      @codebasics  4 года назад +1

      Great job muhammed. Good score indeed

  • @samundraps5730
    @samundraps5730 4 года назад

    I don't have any words for your work. Thanks a lot.

  • @samadhemmaty1796
    @samadhemmaty1796 4 года назад

    Thanks a lot for videos!!!!, 81% for MultinomialNB and 96% for GaussianNB

    • @codebasics
      @codebasics  4 года назад +1

      Perfect samad. You are really a good student as you are working on all my exercises 😊👌 keep it up 👍

  • @prakharmishra2977
    @prakharmishra2977 4 года назад +2

    very well demonstration sir,keep inspiring us with your great videos.

  • @santoshnarwad3528
    @santoshnarwad3528 5 месяцев назад

    Sir very nice teaching and really it's very easy to understand

  • @ameysonawane
    @ameysonawane 2 года назад

    GaussianNB : 97.22
    MultinomialNB: 86.11
    thank you for this video

  • @ashutoshtiwary7448
    @ashutoshtiwary7448 3 года назад

    solved the excercise with the help of cross_val_score method
    where i have found Gaussian performed better than Multinomial
    as i got the list of their score in which
    max value of Gaussian=0.97222222
    max value of Multinomial=0.91428571
    SIR, your tutorial helping me a lot because your teaching teachnique is quite familair and easy for me
    thanks a lot SIR

    • @codebasics
      @codebasics  3 года назад

      Good job ashutosh, that’s a pretty good score. Thanks for working on the exercise

  • @MotoRider23605
    @MotoRider23605 4 года назад +1

    Wonderful sir,really cleared the concepts of pipeline and vectorisation method

  • @study_with_thor
    @study_with_thor 3 года назад

    Well, I've just finished the exercise - that's well-prepared, thanks for your committment.

  • @meetulagrawal6498
    @meetulagrawal6498 2 года назад

    Wonderfull explanation sir, thanks for that and here is my result after execution
    GaussianNB : 97.77%
    MultinomialNB: 73.33%
    BernoulliNB: 44.44%
    with test size = 25%

  • @rajadurai7336
    @rajadurai7336 11 месяцев назад

    Sir, Your videos are great continue doing your job. I got an accuracy of GNB of 97.22 and MNB as 86.122 for the exercise question.

  • @jenil16
    @jenil16 2 месяца назад +1

    GaussianNB score is 1 whereas that for the MultinomialNB is 0.866... for the WINE dataset. Hence, GNB is performing better that MNB.

  • @johnspivack
    @johnspivack 10 месяцев назад

    Your course is great for serving the practical needs of getting started doing ML in Python. For this video, some more explanation of pipelines would help. I understand what they are accomplishing, but not entirely how. Are the .fit methods referred to the underlying functions in the pipeline or is .fit its own method of the pipeline? How does the pipeline know to sue the right transformation method, that didn't seem to be explicitly specified?
    Again thank so much for this and the other videos.
    John

  • @Otaku-Chan01
    @Otaku-Chan01 Год назад

    Just love the tutorial sir...........
    Hats off to you!!

  • @sreenivas351
    @sreenivas351 2 года назад

    Your teaching is great sir

  • @usmanrafiq7080
    @usmanrafiq7080 11 месяцев назад

    thank u so much sir from somewhere on earth from pakistan

  • @amandaahringer7466
    @amandaahringer7466 2 года назад

    Very helpful, appreciate all your content!

  • @dbreddy6201
    @dbreddy6201 3 года назад

    clean and clear explaination...thank you sir

  • @harshalbhoir8986
    @harshalbhoir8986 Год назад

    Awesone tutorial

  • @msuryapavan9517
    @msuryapavan9517 2 года назад

    Thanks for the garble free explanation sir, my scores are:
    GaussianNB:97.7%
    MultinomialNB:80%
    BernoulliNB:48.8%
    hope, the above mentioned scores are good. Please comment, if any better score can be achieved in any another way.

  • @maruthiprasad8184
    @maruthiprasad8184 2 года назад

    Thank you very much for great explanation , my results are
    GaussianNB =96.3%
    MultinomialNB=83.33%

  • @anshulagarwal6682
    @anshulagarwal6682 2 года назад +1

    Sir, you did not give fit_transform method in pipeline. You only gave CoutVectorizer() but it automatically did fit_transform step. How did it do that?

  • @gauravlotey4263
    @gauravlotey4263 4 года назад +1

    i also did Regression analysis, which has r2 value as 0.89.

  • @SandyCoco1
    @SandyCoco1 2 года назад

    Great video, very well explained.. I'm gonna try doing the exercise soon

  • @rambaldotra2221
    @rambaldotra2221 3 года назад

    Awesome and so clean..

  • @rajkalashtiwari
    @rajkalashtiwari 2 года назад

    GausianNB is one for this dataset, it scores approx 97%
    MultinomialNB had a score approx 92%
    RandomForgetClassifier had a score approx 97%

    • @codebasics
      @codebasics  2 года назад

      That’s the way to go raj, good job working on that exercise

  • @darkvolaf
    @darkvolaf 4 года назад +2

    sir, is it possible to list out the vocabularies that the Naive Bayes algorithm found out to contain the high possibility of spam?

  • @frankfunk9188
    @frankfunk9188 4 года назад +2

    GaussianNB: 1
    MultinomialNB: 0.85

  • @kirankumarb2190
    @kirankumarb2190 4 года назад

    Thankyou very much guru ji...

  • @ISandrucho
    @ISandrucho 3 года назад

    Thanks a lot for this course! As a beautiful and clever student I always do your exercises ^) I don't know what would make your course better. Maybe more exercises.

  • @poojadixit5608
    @poojadixit5608 4 года назад

    wonderful explanation sir.

  • @harshamejari
    @harshamejari 9 месяцев назад

    fantastic

  • @srishtikumari6664
    @srishtikumari6664 3 года назад

    Thank you so much!
    You explained this complex concept so easily..

  • @subhnand
    @subhnand 4 года назад

    Excellent tutorial

  • @suryavarunkanthpanchanapu5179
    @suryavarunkanthpanchanapu5179 2 года назад

    Thanks for the video sir
    My results are below
    Gaussian score : 97.777%
    Multinomial score: 88.888%

    • @codebasics
      @codebasics  2 года назад

      Good job surya, that’s a pretty good score. Thanks for working on the exercise

  • @very_nice_777
    @very_nice_777 Год назад

    Gaussian model was most accurate for me resulting 97% accuracy, while Bernoulli being the least resulting only 19% accuracy which is to be expected since the training dataset was for continuous variables and Bernoulli model works better for Binary variables.

  • @antshant1
    @antshant1 Год назад

    Very helpful videos buddy !!!

  • @kajalkhirodkar6521
    @kajalkhirodkar6521 3 года назад

    Thankyou for your efforts. These videos are really helpful

  • @anupsigedar8396
    @anupsigedar8396 4 года назад +1

    85% for Multinomial and 96% for Gaussian using mean of 10 fold cross validation

    • @codebasics
      @codebasics  4 года назад +2

      Awesome Anup. you are so fast. Good job :)

    • @anupsigedar8396
      @anupsigedar8396 4 года назад +1

      @@codebasics All thanks to you for such a nice explanation:)

  • @Piyush-yp2po
    @Piyush-yp2po 2 месяца назад

    In exercise, no need of pipeline or count vector, directly apply train test split and fit method, gaussian gives 97% while multinational gave 80%

  • @kulbiks
    @kulbiks 4 года назад +1

    Thank you for such videos. I got Multinomial as 83% and Gaussian as 100%. But my question is, why have different participants got different results?

    • @gouravsapra8668
      @gouravsapra8668 2 года назад

      This varies because of Train, Test dataset split. It's random split. Even if you execute train_test_split multiple times, you will get different results. :)

  • @rashid101b
    @rashid101b 4 года назад

    Really good one to start

    • @codebasics
      @codebasics  4 года назад

      Rashid, I am glad you liked it

  • @melikabaghi5555
    @melikabaghi5555 3 года назад

    your videos are great! good luck.

  • @AlexTechProjects
    @AlexTechProjects 7 месяцев назад +1

    I have a question. How it is finding the probability of continuous variables. Can you give me a link to explore

  • @shreyjoshi18
    @shreyjoshi18 4 года назад

    I used minMax scaler while preprocessing data as the features had different range like proline ,alcohol,malic_acid etc....
    Got 0.97 in Gaussian and 0.81 in Multinomial

  • @ksantoshkumar4579
    @ksantoshkumar4579 10 месяцев назад

    good content

    • @codebasics
      @codebasics  10 месяцев назад

      Glad you liked it!

  • @saineshnakra6045
    @saineshnakra6045 4 года назад +3

    Great video!One doubt though, Why did we use X_train_count .toarray()[:3] , I did not understand the 3 , Thank you in advance

    • @swapnshah3234
      @swapnshah3234 4 года назад +2

      it is just for visualization purpose, printing only X_train_count .toarray() would have printed all the data points which are in thousands i guess, so sir just used slicing method "[:3]" which states that only 3 data poins will be shown. so we can look at the code properly. get yourself familiarized with pandas slicing and methods like df.iloc[] and df.loc[]. It will be useful

    • @saineshnakra6045
      @saineshnakra6045 4 года назад +1

      @@swapnshah3234 Yes , I have used iloc quite often but I felt we were just converting here to and array and not printing it and the 3 somehow had significance in this specific dataset for data cleaning thank you for your reply !

    • @abhijeetvighne4452
      @abhijeetvighne4452 3 года назад

      @@swapnshah3234 what is .values in X_train.values in fit_transform

  • @prepptspsc4476
    @prepptspsc4476 4 года назад

    i got accuracy 100 %. my train test split is as below.
    from sklearn.model_selection import train_test_split
    X_train, X_test, y_train, y_test = train_test_split(df,target,random_state=20,test_size=0.05)

  • @mojish1711
    @mojish1711 Год назад

    Thank you for tutorial. I like the way that you teach and GaussianNB work better but I do not know why! Also score of MultinomialNB for me caculate as 0.8444444444444444

  • @sulemankhan7775
    @sulemankhan7775 3 года назад

    Thank you so much sir. Your videos are really useful

  • @balasubramani2126
    @balasubramani2126 4 года назад +1

    worked that wine.csv got the following result
    with Gaussian:0.97
    with Multinomial:0.83

    • @codebasics
      @codebasics  4 года назад

      Great score. Good job 👌👏

  • @Manansodagar
    @Manansodagar 3 года назад

    With min-max scaling and X_train, X_test, y_train, y_test = train_test_split(X, y,test_size=.2, random_state=43) i got with Multinominal : 1
    Using Gaussian : 1.0

  • @varsha_rainer
    @varsha_rainer 4 года назад +1

    U r awesome.. can you make videos on Deep learning an NLP.

    • @codebasics
      @codebasics  4 года назад +2

      I already have 3 videos on deep learning, just check the ML playlist. Also you read my mind in a sense that my next target is NLP series. Stay tuned :)

  • @AlonAvramson
    @AlonAvramson 3 года назад

    Thank you!

  • @shub840
    @shub840 6 месяцев назад +1

    at 1:45 can we use mapping instead of lambda function??

  • @Happyy_venky
    @Happyy_venky Год назад

    awsm

  • @snehasneha9290
    @snehasneha9290 4 года назад +1

    how to apply the count vectorizer on more than one text column

  • @asadali4153
    @asadali4153 4 года назад +1

    Hi. i am getting lower case error when evaluating test data by CountVectorizer
    .There is no integer value present as well.
    How can i resolve it?
    AttributeError: 'int' object has no attribute 'lower'

  • @abdurrahimsheikh8241
    @abdurrahimsheikh8241 2 года назад

    Sir, GaussianNaiveBayes works better gives 97.8% accuracy where MultinomialNB gives 86.7%

  • @dhananjaykansal8097
    @dhananjaykansal8097 4 года назад

    Nice one sir. Thank you so much...

    • @codebasics
      @codebasics  4 года назад

      Dhananjay, I am glad you liked it

  • @srimannarayanakodem5191
    @srimannarayanakodem5191 4 года назад

    Thank you sir, Results : GaussianNB is 1.0, and MultinomialNB is 0.88

  • @Jim202030
    @Jim202030 2 года назад

    Nice vid bro.

  • @prakharmishra2977
    @prakharmishra2977 4 года назад

    well demonstration sir!!

    • @codebasics
      @codebasics  4 года назад

      Prakhar, I am glad you liked it

  • @NitinKumar-wm2dg
    @NitinKumar-wm2dg Год назад +1

    Thank you sir for your tutorial. I was confused in the countvectorizer at 4:06 , it would have been much better if you would have explained in more in detail. Like what datatype is xtrain and xtraincount, what kind of data is stored in x_train_count and so on. I learned from the shape and type of numpy. But it would have saved time. Also, why first you fit_transform and later just transform for emails. can anybody please
    help me

    • @rajadurai7336
      @rajadurai7336 11 месяцев назад

      Not sure about the first problem But I can help you solve the second problem. To solve your second problem , lets first understand what is fit(),transform(),and fit_transform() methods
      fit() - The fit methods calculates the learning model parameter from training data . We use model.fit(x_train,y_train) so on , it calculates the internal parameters and adjusts the value for our prediction.
      transform() - The transform methods applies the calculated parameter onto our dataset.
      fit_transform() - The fit_transform() methods applies both fit () for calculating the parameters and transform() function to transform our dataset in one step.
      In the first case, we use fit_transform(x_train) for calculating and transforming our entire dataset and for test data we are applying those parameters that we learned from fit_transform(x_train) so we use transform(x_test). I hope I cleared your doubt.