Machine Learning Tutorial Python - 14: Naive Bayes Classifier Algorithm Part 1

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

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

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

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

  • @agvlogs5773
    @agvlogs5773 3 года назад +36

    Great things is that - you recommend other people's channel as well. It seems u r just trying to make people learn something no matter whose channel.
    Respect🙏🙏

  • @Marshall_Mohammed
    @Marshall_Mohammed 9 месяцев назад +2

    This is the first time I am exploring machine learning and Python, I have never tried to learn Python.
    But your tutorials are just awesome, it is much easier to learn and understand the concepts.
    Great Work!❤👏

  • @prakharmishra2977
    @prakharmishra2977 5 лет назад +12

    thanks a lot sir,for your great support,I started my data science path through your videos really great mentor,altruistic human being i am proud of you sir!!

    • @codebasics
      @codebasics  5 лет назад +4

      hey Prakhar, thanks for your kind words and I wish you all the best. I am sure you will become a successful data scientist one day. good luck :)

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

      @@codebasics sir we waant full play list of deep lerning and real world data science and machine learning projects

  • @ZEHRAİLKAYASLAN
    @ZEHRAİLKAYASLAN 2 месяца назад

    I think you are the best teacher. Thanks to you, I am learning data science. I hope I can find a job in this field. Greetings from Turkey.❤🤩

  • @flamboyantperson5936
    @flamboyantperson5936 5 лет назад +9

    Great to see you back with a new tutorial. Your idea of first explaining theory then going to practical is awesome. That's awesome.

    • @codebasics
      @codebasics  5 лет назад +3

      hey flaboyant person. I was expecting to see your comment. How are you ?

    • @flamboyantperson5936
      @flamboyantperson5936 5 лет назад +1

      @@codebasics It's impossible I won't like and reply to your video. I am great fantastic. How are you and how is your health now?

  • @aryanverma7506
    @aryanverma7506 4 месяца назад

    Your Playlists worked as Revision before my interview. Thank You for your support

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

    Simplicity is the ultimate sophistication. You are amazing!

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

    Great intro. For the last line of code in notebook, I think we shall use X, y instead bc now it's time for full model evaluation:
    np.mean(cross_val_score(GaussianNB(), X, y, cv = 5))

  • @midhunskani
    @midhunskani 4 года назад +16

    We need more tutorials on deep learning and start a new AI tutorials. Your machine learning tutorials are really good

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

    This is the best tutorial on you tube. I understand concepts easily.

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

      I am happy this was helpful to you.

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

    I found that RandomForest classifier performs slightly better than Naive bayes model. anw, love your tutorials, thank u for your hard works :)

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

    That was the best ever tutorial I watched about naive bayes.... Thank you so much ❤

  • @deepanshuaggarwal7042
    @deepanshuaggarwal7042 5 лет назад +1

    Your teaching skills are best. Please continue this series and covers all topics of ML. If not possible, then plz provide link so that we can study. There is no channel which teaches ML the way you are. Hope, you will come to INDIA and do your dream job "Organic farming "

    • @codebasics
      @codebasics  5 лет назад +2

      Oh deepanshu.. I want to do that and spread awareness of eating right. Anyways but yea I have plan to cover many more topics in ML, stay tuned.

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

    You are fantastic! If you were a lecturer you would be the one everyone likes!

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

    You really know how to explain jargons in simple language. Thanks a lot

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

    Super B SIr Cyrstal clear Explanation.There are some many videos on machine learning but no one cann't explain as you.

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

    Sir these are the best videos with best explanation,Thanks alot for these sources.
    Please try to upload more projects and please help and explain more detail about when to use which classifiers.
    Thankyou

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

    You are doing wonderful job ...really learnt a lot from your videos

  • @ravikumarrai7325
    @ravikumarrai7325 3 года назад +9

    Sir, I got one doubt here that, since you have created dummies in this project, you should drop the first dummy column, in order to avoid Multi-colinearity. Please revert back with your comments if I am wrong

    • @r0cketRacoon
      @r0cketRacoon 8 месяцев назад

      I agree, have u figured out the answer?

    • @dragnar4743
      @dragnar4743 2 месяца назад

      oh yeah, dummy variable trap

  • @AmanSingh-bk1um
    @AmanSingh-bk1um 4 года назад +1

    Good keep doing these AI videos, i liked it good to see the flow of functions in single video.

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

    what a gift of explanation!!!

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

    Great video, great teaching, great speed, great other misc stuff like fillna, drop, concat. Please make more of these types of videos! Subscribed!

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

      I am happy this was helpful to you.

  • @MDNAZMUNHASANNAFEES-yz7vq
    @MDNAZMUNHASANNAFEES-yz7vq 7 месяцев назад

    you are the best man. I am being not Naive.

  • @user-wr4yl7tx3w
    @user-wr4yl7tx3w 2 года назад

    this is a really good example explanation

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

    Great, thanks for this series...Pls can u do series on evaluation metrics,I will love to see explicit explanation on it.

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

    Thank you for this very well explained Tutorial.

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

      Glad it was helpful mario!

  • @channel-lz5og
    @channel-lz5og 3 года назад

    Always love the u teach.
    ..u are amazing

  • @mohammadkassir3545
    @mohammadkassir3545 5 лет назад +1

    Please complete tutorials for deep learning

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

    Very nice video sir can I used logistics regression also because I think it also give same result as naive bayes

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

    thank you bhai for the explanation

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

    Very well explained sir! Thanks :-)

  • @jepsmyt
    @jepsmyt 5 лет назад +6

    Hello,
    Thanks for the explanation.
    I was wondering dont we need to normalize the data? Let me know your thoughts on this.

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

      Naive can deal without any Feature Scaling

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

    Wonderful video, thank you. Simple but well-explained! It has helped me a lot. =)

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

    sir , how did you come to know that the data is a bell curve (gaussian distribution).

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

    Hi. Thanks so much.

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

    Hey @codebasic
    you are teaching way is awesome.
    i hv question here.
    why is there a target variable in unsupervised learning?

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

    Awsome!But I Have A doubt why we have not normalize out dataset certain columns?

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

    I have a small query here. Why did we not drop the either female/male column after one hot encoding to avoid dummy variable trap?

  • @sulimanallahgabo1080
    @sulimanallahgabo1080 5 лет назад

    just i was looking for , thanks sir oh u re great great .....

    • @codebasics
      @codebasics  5 лет назад

      Thanks man. I really appreciate love from all of you :)

    • @sulimanallahgabo1080
      @sulimanallahgabo1080 5 лет назад

      @@codebasicsas usual many thank to u pls if u have material for data science of don't mind send to me ,suliman_allahgabo@yahoo.com

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

    Sir, why there is a target variable????? like it's a clustering algorithm i.e unsupervised...and target variable is used in supervised

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

      "target" is a variable, you can take anything as a variable

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

    thanks a lot SIR

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

    Great job sir thank u

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

    super video

  • @flamboyantperson5936
    @flamboyantperson5936 5 лет назад

    I have a request if you could make one video on it that would be very helpful. I want to know when we make a UDF in python how can I check it at each and every step function is working or not before completing the whole UDF

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

    Just for the ones who might be as stupid as me and were missing the "survived" column: On kaggle there are two files. One test and one train file. Take the train file instead :)

  • @dragnar4743
    @dragnar4743 2 месяца назад

    Generally, people suggest for using GaussianNB if we are dealing with continuous feature like age & fare. And BernoulliNB for Binary type of data like female & male. categoricalNB for discrete features like Pclass. So, can GaussianNB can take all types of features??

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

    thanks a lot.. can i ask to you, what if i want to show xtest result after tf-idf sir? I have tried only with the xtest code but the results are not as desired

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

    sir make tutorials on Natural language processing(NLP)

  • @codebasics
    @codebasics  5 лет назад +5

    Part 2 of this naive bayes tutorial. Email spam detection: ruclips.net/video/nHIUYwN-5rM/видео.html

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

    thank you so much

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

    thank you

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

    super

  • @JatinSharma-tu2zg
    @JatinSharma-tu2zg 4 года назад

    Sir Hindi main bhi bana dijiye pls aap bohut acha samjha rahe hain

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

      sure jatin. RUclips me codebasics hindi search karo, maine already those ML ke video hindi me upload kiye hai.

  • @manavgora
    @manavgora 8 месяцев назад

    can we also do "One Hot Encoding" instead of dummy variables.

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

    hi,the titanic data we used earlier in DecisionTreeClassifier model. i campared the score is higher in DTC than Naive Bayes and we get probability in DTC also,so just wanted to ask how to know which model is the best to use in realtime?please suggest.

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

    thanks

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

    shouldn't we split the data first and then perform preprocessing or does it not matter?

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

      Afaik, the order dosen't really matter. If you split first, you'd need to preprocess all the parts individually.

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

    Sir plz explain when to take the mean median mode for null values .....

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

    Good explanation but the problem is, in the dataset I'm not able to find jack and rose :/

  • @Gauravkr0071
    @Gauravkr0071 5 лет назад

    Hii , the lectures are just amazing , cn u plz make a tutorial on how to write custom layers in keras like we make in variational autoencoder . Plz man therre is almost no resource in internet explaining it properly

    • @codebasics
      @codebasics  5 лет назад +1

      Thanks gaurav for appreciation. I have noted down the topic you suggested and will get to it in future 👍

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

    Hi, I am getting following error:
    ValueError: Input contains NaN, infinity or a value too large for dtype('float64').
    But I checked and there is no NA value in my dataframe.
    inputs.info()
    Gives me this output:
    RangeIndex: 891 entries, 0 to 890
    Data columns (total 5 columns):
    # Column Non-Null Count Dtype
    --- ------ -------------- -----
    0 Pclass 891 non-null int64
    1 Age 891 non-null float64
    2 Fare 891 non-null float64
    3 female 891 non-null uint8
    4 male 891 non-null uint8
    dtypes: float64(2), int64(1), uint8(2)
    memory usage: 22.7 KB

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

    I have question, why you did not drop either fenale or male column? In your previous tutorials, you said one column should be dropped if converting using dummy. Thanks...

    • @r0cketRacoon
      @r0cketRacoon 8 месяцев назад

      I agree, have u figured out the answer?

  • @MohamedAshraf-zs6nv
    @MohamedAshraf-zs6nv 4 года назад

    how you decide which feature to keep and use in the model and which to drop?
    I mean is there any strategy to handle this situation?

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

    thanks for this video! one thing i dont understand:
    at 2:33
    P(queen) should be 1/4 or?
    and P(diamond) 1/13.
    as there are 4 queens and 13 diamonds in the deck

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

      You are right, I think there is an error in the presentation.

  • @dhainik.suthar
    @dhainik.suthar 3 года назад +2

    why my predict_proba return >1 and

  • @HerlonCosta
    @HerlonCosta 5 лет назад +1

    Waw, i am a first! 😃😃 #LovePython

    • @codebasics
      @codebasics  5 лет назад +3

      oh yup. Hanzo.. you got the "first commenter" award :) ha ha...

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

    why we use train_test _split, we can use cross_validation fro better results, cant we?

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

    hey u know parameters prior_fit in naive bayes for what? i dont understand in documentation thx

  • @Star_z_07
    @Star_z_07 12 дней назад

    may i know the reason of using one hot encoding but not label encoding ??...can anyone clear my doubt

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

    Does we don't need to drop one dummy column?
    Dose the dummy variable trap only for linead_mode?

    • @r0cketRacoon
      @r0cketRacoon 8 месяцев назад

      I agree, have u figured out the answer?

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

    Do you not need to remove one of the dummies "male" or "female"? It does not make sense to have both of them, since in that dataset, who is not male is female. To my knowledge that is an essential step.

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

      Yes your right, these are negatively correlated. Including both of the features would make gender have higher influence on inference

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

    Should I use mean method or median method for Nan because in one video you told us to use median method in this video it is mean method. Which one is the best right to use?

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

      Median is more robust to outlier so generally a better idea.
      Features like age are normally distributed hence mean can also be safely used

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

    Hi, A couple of questions, hope someone could help please:
    1) I thought Gaussian NB only take continuous features value. But here, there are continouse (e.g. Age) and discrete (e.g. Gender) value. Can I use Gaussian NB if all features are discrete value?
    2) One hot encoding split the Gender data into two data: Male and Female. These features are related i.e. mutually exclusive. Does Gaussian NB algorithm jointly 'process' these two data as one feature or two separate feature?
    Hope someone could enlighten. Thanks.

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

      hey i have the same doubts regarding Gaussian NB. Did you figure it out? Would be really helpful for me:)

  • @JainmiahSk
    @JainmiahSk 5 лет назад

    Sir how is your health? I'm waiting for your videos.
    Sir, how to encode multiple variables at once?

    • @codebasics
      @codebasics  5 лет назад +1

      hey Jainmiah, my health is improving. The full recovery might still take one complete year but at least I am in a position to upload videos now.

    • @JainmiahSk
      @JainmiahSk 5 лет назад

      @@codebasics I Pray God to recover you fast to your GOOD Health. #LoveCodeBasics and #LoveYouSir.

  • @sougandhhm
    @sougandhhm 5 лет назад

    hello sir,
    Please do some videos on Natural Language processing, I am waiting for this badly

    • @codebasics
      @codebasics  5 лет назад +2

      wow....actually thats the topic I am going to cover next. You read my mind almost. I will start that series soon.

    • @245uday
      @245uday 4 года назад

      @@codebasics yes...i am also waiting...I started studying data science a few days back...your way of teaching are simply awesome...

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

    could not convert string to float: 'Birnbaum, Mr Jakob' how to eliminate this error

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

    by saying male as a feature are u sure u did not confuse it with sex. I thought sex would be the feature with values such as male, female. Unless you meant male as a feature taking on values yes or no?

  • @ayazahmed9611
    @ayazahmed9611 5 лет назад

    Sir can u upload more videos on ML ALgorithms like this??

    • @codebasics
      @codebasics  5 лет назад

      yes Ayaz. sure. I have the plan to upload more videos on this topic.

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

    In a categorical dataset , how can we decide whether the problem can be solved by using Naive Bayes algorithm or no?
    Or which algorithm will give high accuracy?

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

      Based on type of problem you might end up using one or the other algorithm. You can use gridsearchCV to evaluate performance of different alogs with different parameters. Please watch my video in this same series "it is called hypertunning parameters using gridsearchcv"

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

    @6:20 Why can't we use LabelEncoder instead of panda's dummy variables?

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

      both can be used, it is just that he is more used to one hot encoder.. that is the same pd.get_dummies(" " ).
      Otherwise, the results will be the same for both.

  • @YYZ-e1w
    @YYZ-e1w 4 года назад

    isn't it female and male column 'highly related'?

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

    can't the sex column be simplified by LabelEncoding??

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

    Input contains NaN, infinity or a value too large for dtype('float64'). - Can you help with the errror?

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

      use fillna() method to fill that "NAN" value as shown in video

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

    y should be a 1d array, got an array of shape (179, 5) instead.

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

    sir why you have used GaussianNB model instead of using Logistic model or any other

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

      Because this tutorial is on naive Bayes 😊

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

      @@codebasics so can be use any other model to perform this task of mail classification or this model is best suited for this task

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

    Sir Is it necessary to learn behind mathematics of machine learning algorithm or some overview of mathematics of machine learning algorithm
    Sir please tell me please Because I am very confused

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

      You need to know some math. Not very much in depth. So don't worry too much about it. If you want to become machine learning engineer or data scientist who solves complex problem than of course advanced math knowledge is always useful

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

      @@codebasics
      Sir if I want machine learning Engineer than if I have some knowledge of math
      Please reply I wait

  • @rudrarajput4764
    @rudrarajput4764 5 лет назад

    Boss, can you please make a lecture on reinforcement learning and also one lecture on Q learning??

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

    How P(diamond/queen) is 1/4
    Can somebody explain to me?

  • @aryanverma7506
    @aryanverma7506 4 месяца назад

    Better than Andrew NG

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

    SIR ,HOW TO IMPROVE ITS ACCURACY?

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

    Please help me, i got this error message "could not convert string to float : 'male' " someone can explain me why it's happen to me?

  • @RishabhSingh-bh7fu
    @RishabhSingh-bh7fu 4 года назад

    I am getting file not found error as I import data set using the same code

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

      if you're using IDE you should import the file to the workspace you're working in

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

    We can't able to download ur code... It's coming invalid

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

      I have checked all URL's working perfectly. Please check URL in description.

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

    where is code of this tutorial??

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

      check video description for github link

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

    pd.get_dummies(df,columns=['sex']) could have just done this.. no need to perform concati. @6:45

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

    Where to get the dataset?

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

      github.com/codebasics/py/tree/master/ML/14_naive_bayes

  • @LocNguyen-lb7ii
    @LocNguyen-lb7ii 3 года назад

    I think your math symbol is wrong & not /

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

    How the fuck can I get the dataset

  • @adamassrkfan
    @adamassrkfan 4 месяца назад

    7:04