Machine Learning Tutorial Python - 8 Logistic Regression (Multiclass Classification)

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 มิ.ย. 2024
  • Logistic regression is used for classification problems in machine learning. This tutorial will show you how to use sklearn logisticregression class to solve multiclass classification problem to predict hand written digit. We will use sklearn load_digits to load readily available dataset from sklearn library and train our classifier using that information.
    #MachineLearning #PythonMachineLearning #MachineLearningTutorial #Python #PythonTutorial #PythonTraining #MachineLearningCource #LogisticRegression #sklearntutorials #scikitlearntutorials
    Code: github.com/codebasics/py/blob...
    Exercise: Open above notebook from github and go to the end.
    Topics that are covered in this Video:
    0:00 - Theory (Binary classification vs multiclass classification)
    0:26 - How to identify hand written digits?
    1:02 - Coding (Solve a problem of hand written digit recognition)
    11:24 - Confusion Matrix (sklearn confusion_matrix)
    12:42 - Plot confusion matrix using seaborn library
    14:00 - Exercise (Use sklearn iris dataset to predict flower type based on different features using logistic regression)
    Do you want to learn technology from me? Check codebasics.io/?... for my affordable video courses.
    Next Video:
    Machine Learning Tutorial Python - 9 Decision Tree: • Machine Learning Tutor...
    Populor Playlist:
    Data Science Full Course: • Data Science Full Cour...
    Data Science Project: • Machine Learning & Dat...
    Machine learning tutorials: • Machine Learning Tutor...
    Pandas: • Python Pandas Tutorial...
    matplotlib: • Matplotlib Tutorial 1 ...
    Python: • Why Should You Learn P...
    Jupyter Notebook: • What is Jupyter Notebo...
    Tools and Libraries:
    Scikit learn tutorials
    Sklearn tutorials
    Machine learning with scikit learn tutorials
    Machine learning with sklearn tutorials
    To download csv and code for all tutorials: go to github.com/codebasics/py, click on a green button to clone or download the entire repository and then go to relevant folder to get access to that specific file.
    🌎 My Website For Video Courses: codebasics.io/?...
    Need help building software or data analytics and AI solutions? My company www.atliq.com/ can help. Click on the Contact button on that website.
    #️⃣ Social Media #️⃣
    🔗 Discord: / discord
    📸 Dhaval's Personal Instagram: / dhavalsays
    📸 Instagram: / codebasicshub
    🔊 Facebook: / codebasicshub
    📝 Linkedin (Personal): / dhavalsays
    📝 Linkedin (Codebasics): / codebasics
    📱 Twitter: / codebasicshub
    🔗 Patreon: www.patreon.com/codebasics?fa...

ความคิดเห็น • 435

  • @codebasics
    @codebasics  2 ปีที่แล้ว +3

    Do you want to learn technology from me? Check codebasics.io/ for my affordable video courses

  • @Charmingenby
    @Charmingenby 3 ปีที่แล้ว +30

    There are very few teachers who actually make us fall in love with learning. You have an incredibly fascinating way of teaching Sir!!

  • @ritikpratapsingh9128
    @ritikpratapsingh9128 4 ปีที่แล้ว +2

    I do not usually comment but you wrote the code so simple and explained so beautifully that i had to praise you. Thank you so much !!

  • @codebasics
    @codebasics  4 ปีที่แล้ว +3

    Complete machine learning tutorial playlist: th-cam.com/video/gmvvaobm7eQ/w-d-xo.html

    • @anujvyas9493
      @anujvyas9493 4 ปีที่แล้ว +1

      I solved the exercise and my model got an accuracy of 96.67%
      Thanks for making such great videos.

    • @sonalgarg5628
      @sonalgarg5628 4 ปีที่แล้ว +1

      @@anujvyas9493 can you please send the solution..i also got same accuracy but unable to do prediction

    • @anujvyas9493
      @anujvyas9493 4 ปีที่แล้ว

      @@sonalgarg5628 Sure! Email ID ?

    • @sonalgarg5628
      @sonalgarg5628 4 ปีที่แล้ว +1

      @@anujvyas9493 sonal.garg@gla.ac.in

    • @anujvyas9493
      @anujvyas9493 4 ปีที่แล้ว

      @@sonalgarg5628 Sent it to you! Sorry for the late reply.

  • @peiyuankao1213
    @peiyuankao1213 5 ปีที่แล้ว +11

    Thanks for your teaching! I like your tutorials and exercises, that make me quickly understand.

  • @Ankurkumar14680
    @Ankurkumar14680 5 ปีที่แล้ว +14

    Great tutorial, thanks a ton for shaing this amazing stuff. Request you to start a series on NLP, Deep Learning or Text Analytics

  • @wsgsantos
    @wsgsantos 5 ปีที่แล้ว +5

    As always great video. Greetings from Brazil!

  • @maruthiprasad8184
    @maruthiprasad8184 2 ปีที่แล้ว +4

    I got accuracy 93% for iris data set. Thank you very much to make ML simple.

  • @PoojaPatel-bi4wr
    @PoojaPatel-bi4wr ปีที่แล้ว +4

    Sir , Whatever you teach it's very very interesting and I think I am luckiest person which I am reading from your videos
    It's very helpful for us and you are great.
    I have seen many videos but no one teaches like you.

  • @rayithki
    @rayithki 2 ปีที่แล้ว

    Thank you. I wish I had discovered your channel 6 months ago. I could have saved so much time.

  • @jagjeetagarwal1856
    @jagjeetagarwal1856 2 ปีที่แล้ว

    Within 2 Days I have addicted to this channel......I am on this Channel for around 5-6 hours Continuously....... Please Continue the Series......Thanks

  • @SohamPaul-xy9jw
    @SohamPaul-xy9jw ปีที่แล้ว +10

    Thank You. After watching previous 8 videos, I tried this Iris exercise on my own and my model actually predicted so well, with a score of 1.0

    • @satyazigyansu6873
      @satyazigyansu6873 8 หลายเดือนก่อน

      it is overfitting bro

    • @parththakor7362
      @parththakor7362 4 หลายเดือนก่อน

      @@satyazigyansu6873 accuracy is varies with random state and test size
      random state = 42 and test size = 0.2 then accuracy = 100%
      random state = None and test size = 0.3 then accuracy is around 97% and it varies every time

    • @yashchaudhari5289
      @yashchaudhari5289 2 หลายเดือนก่อน

      @@satyazigyansu6873 no brother it depends on dataset whether it is testing or training. If it is on testing dataset then it is not overfitting, if it is is on training dataset then it is overfitting.

  • @jayshreedonga2833
    @jayshreedonga2833 ปีที่แล้ว

    Thanks sir. Simply you are great for such type of free courses.Nice service to society

  • @stanlukash33
    @stanlukash33 3 ปีที่แล้ว +4

    I CAN'T SAY THIS ENOUGH - THANK YOU!

  • @pallawkumar9846
    @pallawkumar9846 5 ปีที่แล้ว +2

    Thank you for these awesome tutorials. Please upload next tutorials.

  • @liangyumin9405
    @liangyumin9405 5 ปีที่แล้ว +2

    Nice tutorial, I have forked your project PY .THX

  • @-theworldofscience4153
    @-theworldofscience4153 2 ปีที่แล้ว +1

    The contents are actually very engaging and helps u tolearn complex topics very easily

  • @masterofnone754
    @masterofnone754 3 ปีที่แล้ว

    probably the best tutorial series for beginner thank you!!!!!

    • @codebasics
      @codebasics  3 ปีที่แล้ว +1

      Glad it was helpful!

  • @yoniziv
    @yoniziv 3 ปีที่แล้ว +1

    Very clear, thank you!

  • @nishkarshaggarwal2692
    @nishkarshaggarwal2692 2 ปีที่แล้ว

    you are a great teacher....
    thank u for this series

  • @tcsanimesh
    @tcsanimesh 5 ปีที่แล้ว +3

    Your explanation is at a different level. Just one request please add the different machine learning algorithms a bit fast as once someone starts leading from your channel gets hooked up to it ...

  • @kashifahmad93
    @kashifahmad93 3 ปีที่แล้ว +3

    Got 96.66% accuracy.....while practicing on your given iris.csv dataset...I am new on your channel, but got addicted to your videos, especially to the playlist of machine learning... please keep teaching us in same way. Thanks a lot..

    • @codebasics
      @codebasics  3 ปีที่แล้ว

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

    • @RahulRaj-cy1xb
      @RahulRaj-cy1xb 2 ปีที่แล้ว

      Bro we need to download exercise from kaggle? As sir only uploaded image on github

    • @parththakor7362
      @parththakor7362 4 หลายเดือนก่อน +1

      @@codebasics accuracy is varies with random state and test size
      random state = 42 and test size = 0.2 then accuracy = 100%
      random state = None and test size = 0.3 then accuracy is around 97% and it varies every time

  • @Kikeina
    @Kikeina 5 ปีที่แล้ว +26

    A little detail... after updating sklearn to version 0.20.2 or higher it will be needed to specify a solver and multi_class specification as parameters to avoid warning errors. For instance "model = LogisticRegression(solver = "newton-cg", multi_class="auto")"

    • @russnagel1
      @russnagel1 3 ปีที่แล้ว +3

      Thank you very much. You just saved me a big headache. I had the warning and came looking to the comments for help. Great job.

    • @Kikeina
      @Kikeina 3 ปีที่แล้ว +1

      @@russnagel1 Happy to see that the comment is helping somebody. You made my day.

    • @dhruvpathak1850
      @dhruvpathak1850 ปีที่แล้ว +1

      Very helpful, I tried using max_iter / n_iter to 200, in the model.fit() part, but that didn't work either.. eventually, it's your suggestion that did work!

    • @drpebba2679
      @drpebba2679 ปีที่แล้ว +1

      my savior

    • @dixxanta
      @dixxanta 8 หลายเดือนก่อน

      u can also use standard scaler

  • @pakpoomtivarkornkit8525
    @pakpoomtivarkornkit8525 5 ปีที่แล้ว +2

    Thank you so much....liked and subscribed.

  • @nitinsrivastava2136
    @nitinsrivastava2136 5 ปีที่แล้ว

    Awesome. Thanks for sharing. I love the way you teach topics. So easy to understand. Thanks again.

    • @codebasics
      @codebasics  5 ปีที่แล้ว

      Yup nitin, things don't have to be taught in a hard way.. there is always an easy way to explain the concepts :)

  • @muskan_salampuria
    @muskan_salampuria 4 ปีที่แล้ว +2

    One of the best tutorial... Thankyou so much...It is very helpful and informative.... I wish to see more videos on other topics...

    • @codebasics
      @codebasics  4 ปีที่แล้ว

      Glad, you liked it.

  • @rehanabbas4661
    @rehanabbas4661 11 หลายเดือนก่อน +1

    Respect and appreciation from 🇵🇰 . Interesting teaching skill. 👍

  • @vinodkinoni4863
    @vinodkinoni4863 5 ปีที่แล้ว +2

    thanks for good tutorials

  • @yourlifeonpower
    @yourlifeonpower 3 หลายเดือนก่อน

    Another awesome video! Thank you

  • @jyotimalik8960
    @jyotimalik8960 2 ปีที่แล้ว

    finalllllly I understood how to interpret confusion matrix for multiclass classification thankyou!!!!

  • @radhedhabas
    @radhedhabas 6 หลายเดือนก่อน +1

    I got accuracy of 96.66%.
    Thank you so much for your initiative. Best part of your playlist is exercises that give confidence and a clarity how to apply logics in form of code. And best part you talk about practical use cases.

    • @parththakor7362
      @parththakor7362 4 หลายเดือนก่อน

      accuracy is varies with random state and test size
      random state = 42 and test size = 0.2 then accuracy = 100%
      random state = None and test size = 0.3 then accuracy is around 97% and it varies every time
      for best way choose random state = 42 or 10

  • @dennisasamoah2213
    @dennisasamoah2213 4 ปีที่แล้ว +1

    simply amazing

  • @rakeshg2926
    @rakeshg2926 5 ปีที่แล้ว

    Thanks your tutorials are very clear and intutive and easy to understand.

    • @codebasics
      @codebasics  5 ปีที่แล้ว

      Rakesh, thanks for your kind words of appreciation

  • @achelias8477
    @achelias8477 3 ปีที่แล้ว +1

    On my way to watch your whole playlist. You are a great techer! I got accuracy 95.6%

    • @codebasics
      @codebasics  3 ปีที่แล้ว +2

      👍😊 wish you all the best

    • @olutokijohn
      @olutokijohn 2 ปีที่แล้ว

      Can you share your solution ?

    • @aaditstudent
      @aaditstudent ปีที่แล้ว +1

      What parameters did you use for the LogisticRegression model?

  • @rishipatel2221
    @rishipatel2221 3 ปีที่แล้ว +1

    Thank you so much for this invaluable series

    • @codebasics
      @codebasics  3 ปีที่แล้ว +2

      Glad you enjoy it!

    • @strongsyedaa7378
      @strongsyedaa7378 2 ปีที่แล้ว

      @@codebasics
      Kindly make a video on confusion matrix multiclass classification please 🙏

  • @nastaran1010
    @nastaran1010 6 หลายเดือนก่อน

    Thanks a lot, very clear

  • @jawadasif8130
    @jawadasif8130 2 ปีที่แล้ว

    really appreciate your hard work. from your videos it was super easy to learn the concept . thank you

    • @codebasics
      @codebasics  2 ปีที่แล้ว

      You are most welcome

  • @rambaldotra2221
    @rambaldotra2221 3 ปีที่แล้ว +2

    Iris dataset -> 97.777777777777 accuracy with test_size =0.3
    I have fallen in love with this amazing knowledge 🤩.Thanks a lot Sir ❤️.

    • @oilidzaghloul3266
      @oilidzaghloul3266 2 ปีที่แล้ว

      I got an accuracy of 1 with test_size=0.2.

    • @RahulRaj-cy1xb
      @RahulRaj-cy1xb 2 ปีที่แล้ว

      Bro we need to download exercise from kaggle? As sir only uploaded image on github

  • @nayyershahzad8051
    @nayyershahzad8051 3 ปีที่แล้ว +2

    I got 96.66% accuracy for Iris dataset exercise. Great work! Thoroughly enjoying and learning a lot from your courses.

    • @digvijaymahamuni7722
      @digvijaymahamuni7722 3 ปีที่แล้ว +1

      i got 94.73%
      does it vary? or have I done any mistakes?

    • @fazalahmad1546
      @fazalahmad1546 3 ปีที่แล้ว +1

      I got 100.0%

    • @fazalahmad1546
      @fazalahmad1546 3 ปีที่แล้ว +1

      @@digvijaymahamuni7722 this is due to a very small dataset

    • @mohammedsohilshaikh6831
      @mohammedsohilshaikh6831 2 ปีที่แล้ว

      @@fazalahmad1546 check for overfitting

    • @mdlwlmdd2dwd30
      @mdlwlmdd2dwd30 2 ปีที่แล้ว +2

      Hey guys chill it isnt like you guys working in backend developing library. also it is relatively clean dataset already.

  • @vdud007
    @vdud007 4 ปีที่แล้ว

    Thank you and practice exercises are useful as well

    • @codebasics
      @codebasics  4 ปีที่แล้ว

      Glad you liked the exercises Vishnu

  • @mohammedashfaqueaslam2566
    @mohammedashfaqueaslam2566 4 ปีที่แล้ว

    Amazing content you make it all seem easy

    • @codebasics
      @codebasics  4 ปีที่แล้ว

      Glad you liked it Mohammed.

  • @raghuvamsiyaram7248
    @raghuvamsiyaram7248 ปีที่แล้ว +1

    I got 96.66 accuracy. Thanks.

  • @rajatpati8808
    @rajatpati8808 5 ปีที่แล้ว +1

    Waiting for your next videos. Hope you will upload soon.

  • @golammuktadir4355
    @golammuktadir4355 4 ปีที่แล้ว

    Good approach for coding the basic machine learning . Carry on

  • @nicojapasmusic
    @nicojapasmusic 3 ปีที่แล้ว

    Very helpful, thanks!

    • @codebasics
      @codebasics  3 ปีที่แล้ว

      Glad it was helpful!

  • @abhishekkhare6175
    @abhishekkhare6175 3 ปีที่แล้ว

    got accuracy of 93.34%. Thanku very much really addicted to your videos.

  • @javi19841000
    @javi19841000 4 ปีที่แล้ว

    Great job, Thank you ver much

    • @codebasics
      @codebasics  4 ปีที่แล้ว

      Glad you liked it!

  • @hamzanaeem4838
    @hamzanaeem4838 3 ปีที่แล้ว

    Excellent explanation

  • @mabelkarani
    @mabelkarani 3 ปีที่แล้ว +39

    at 7:50 , use this >> model = LogisticRegression(solver='lbfgs',class_weight='balanced', max_iter=10000) to avoid this warning >>> 'ConvergenceWarning: lbfgs failed to converge (status=1): STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.'

  • @nareshjanjirala472
    @nareshjanjirala472 5 ปีที่แล้ว

    nice tutorila.... by watching your tutorials lot of people are opeining institutes in Hyderabad

    • @codebasics
      @codebasics  5 ปีที่แล้ว

      Ha ha.. are you serious? 😊

  • @tanoychowdhury6375
    @tanoychowdhury6375 5 ปีที่แล้ว +3

    Sir,
    Please make videos on other topics of machine learning like k nearest neighbour , support vector machines. Your videos are very very helpful. please continue this series.🙏🙏

    • @orangewares
      @orangewares 5 ปีที่แล้ว

      You can refer to videos of sentdex. The videos are much better including k nearest neighbor. th-cam.com/video/OGxgnH8y2NM/w-d-xo.html

  • @ehsanakbari3519
    @ehsanakbari3519 10 หลายเดือนก่อน

    that was awesome🤩🤩

  • @franky0226
    @franky0226 4 ปีที่แล้ว +1

    Thank you so much sir :)
    I loved the tutorial! , got an accuracy of 97.72 %

  • @tewatiakuldeep86
    @tewatiakuldeep86 4 ปีที่แล้ว

    Sir your way of describing things is very easy to grab and understand. Thank you for the tutorial. I request you to please also make a few videos of analyzing data (statistics) before using it into a model. Like variable correlation, and what variable should be used and which one should be dropped, etc.

    • @codebasics
      @codebasics  4 ปีที่แล้ว +1

      point noted kuldeep and thanks for your appreciation. I want to add lot more content but unfortunately facing health troubles. once i recover I will be back with full force :)

  • @harshthummar6360
    @harshthummar6360 2 ปีที่แล้ว +1

    I loved this tutorial..! Absolutely awesome...!! i get up to efficiency= 96.6%

    • @codebasics
      @codebasics  2 ปีที่แล้ว

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

  • @coxixx
    @coxixx 4 ปีที่แล้ว

    awesome!

  • @safwansalehjee7961
    @safwansalehjee7961 5 ปีที่แล้ว +15

    Is there no Exercise solution?

  • @dhruvkantsharma2955
    @dhruvkantsharma2955 4 ปีที่แล้ว

    Amazing lecture! I got an accuracy of 93.3%

  • @ss57hd
    @ss57hd 5 ปีที่แล้ว +2

    Wow, Your videos are amazing!
    And i got an accuracy of 96%

    • @codebasics
      @codebasics  5 ปีที่แล้ว +2

      great. thanks for working on exercise and congrats on getting such a high accuracy score. Good job :)

    • @vinays.m6831
      @vinays.m6831 4 ปีที่แล้ว

      Sir can u send me that code please... I am not getting that so...

    • @sujithramanathan3275
      @sujithramanathan3275 4 ปีที่แล้ว +2

      @@vinays.m6831 PFB code. Please let me know if anything is incorrect.
      import pandas as pd
      import matplotlib.pyplot as plt
      from sklearn.datasets import load_iris
      from sklearn.model_selection import train_test_split
      from sklearn.linear_model import LogisticRegression
      iris = load_iris()
      x_train, x_test, y_train, y_test = train_test_split(iris.data, iris.target, test_size=0.2)
      irisModel = LogisticRegression()
      irisModel.fit(x_train, y_train)
      targetIndex = irisModel.predict(x_test)
      for i in range(len(targetIndex)):
      print(iris.target_names[targetIndex[i]])
      irisModel.score(x_test,y_test)

  • @asedaaddai-deseh8152
    @asedaaddai-deseh8152 5 ปีที่แล้ว +3

    Thanks so much for these great tutorials! I wish you would upload the continuation of this playlist faster so we can learn fast.

    • @asedaaddai-deseh8152
      @asedaaddai-deseh8152 5 ปีที่แล้ว

      @@codebasics Wow, I admire the fact that you're able to make these videos despite your busy schedule. Keep it up!

    • @anand.prasad502
      @anand.prasad502 4 ปีที่แล้ว

      @@asedaaddai-deseh8152 medium.com/trainyourbrain/would-you-read-this-article-or-not-b757d0e26cf8

  • @AnanyaRay-ct8nx
    @AnanyaRay-ct8nx ปีที่แล้ว

    got 93.33% accuracy. Thank u so much for this playlist..

    • @ayushshankarpurkar1417
      @ayushshankarpurkar1417 ปีที่แล้ว

      i also got 93.33% accuracy can you please tell me how you did it I want to cross check my procedure.

  • @bandhammanikanta1664
    @bandhammanikanta1664 4 ปีที่แล้ว +1

    Loving your Lectures sir.
    Could you please use any best deep learning model for this dataset.
    Or Suggest me one. :)

  • @pamp3657
    @pamp3657 ปีที่แล้ว

    Good video.

  • @vishnuvardhan-wq5qi
    @vishnuvardhan-wq5qi 5 ปีที่แล้ว +2

    my model is 100 percent accurate for iris dataset. thanks for teaching all the topics which are really important in a clean and clear way.

  • @mojojojo1854
    @mojojojo1854 5 ปีที่แล้ว +15

    please do tutorials on Computer vision using Tensorflow

  • @shivadumnawar7741
    @shivadumnawar7741 4 ปีที่แล้ว +1

    I got 100% accuracy for the iris exercise. Sir give more exercise. These are very helpful, thanks a lot sir

    • @sejalmittal1326
      @sejalmittal1326 4 ปีที่แล้ว

      didn't you get total no. of iterations reached ??

    • @sejalmittal1326
      @sejalmittal1326 4 ปีที่แล้ว

      Can you help me out ??

    • @shreyjoshi18
      @shreyjoshi18 4 ปีที่แล้ว

      increase the size of your test data and then check

    • @sejalmittal1326
      @sejalmittal1326 4 ปีที่แล้ว +1

      @@shreyjoshi18 okay .. thanks

  • @RohitSingh-hc8yi
    @RohitSingh-hc8yi 4 หลายเดือนก่อน

    awesome

  • @sanooosai
    @sanooosai 5 หลายเดือนก่อน

    thank you

  • @yoshidasan4780
    @yoshidasan4780 ปีที่แล้ว +2

    Thank you so much sir !I am so so grateful to you for these wonderful tutorials ,hope i can learn even more and faster.Btw i got my accuracy as 97.77 !

    • @pranav9339
      @pranav9339 11 หลายเดือนก่อน

      Bro I got the same but is it correct? How can accuracy be so high? Please can you explain

    • @yoshidasan4780
      @yoshidasan4780 11 หลายเดือนก่อน

      @@pranav9339 because the trends are very similar in the test set data too ig and the variance is also low ...that's the reason i think

  • @cindinishimoto9528
    @cindinishimoto9528 4 ปีที่แล้ว +4

    Awesome exercise! I got an accuracy of 97, 77%

    • @aditinagar6688
      @aditinagar6688 3 ปีที่แล้ว +2

      Can you please provide the solution link as it is not there on github? It would be helpful.

    • @cindinishimoto9528
      @cindinishimoto9528 3 ปีที่แล้ว +15

      Hi, @@aditinagar6688​. Please see below:
      iris = load_iris()
      print(dir(iris))
      df = pd.DataFrame(iris.data, columns=iris.feature_names)
      print(df.head())
      df["target"] = iris.target
      print(df.head())
      df["target"].replace({0: "setosa", 1: "versicolor", 2: "virginica"}, inplace=True)
      print(df.head(-10))
      x = df.drop(["target"], axis=1)
      y = df["target"]
      from sklearn.model_selection import train_test_split
      x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.3)
      print(len(x_train))
      print(len(x_test))
      from sklearn.linear_model import LogisticRegression
      model = LogisticRegression()
      model.fit(x_train, y_train)
      print(model.score(x_test, y_test))
      print(model.predict(x_test))
      #print(y_test)
      print(model.predict([[4.9, 3.0, 1.4, 0.2]])) #setosa
      y_predicted = model.predict(x_test)
      from sklearn.metrics import confusion_matrix
      cm = confusion_matrix(y_test, y_predicted)
      print(cm)
      import seaborn as sn
      plt.figure(figsize=(10, 7))
      sn.heatmap(cm, annot=True)
      plt.xlabel("Predicted")
      plt.ylabel("Truth")
      plt.show()

    • @tejobhiru1092
      @tejobhiru1092 3 ปีที่แล้ว +1

      @@cindinishimoto9528 thank you so much..!
      this helps a lot.. i was not able to figure out how to handle that dataset!

    • @cindinishimoto9528
      @cindinishimoto9528 3 ปีที่แล้ว

      @@tejobhiru1092 ^_^

    • @haiderkhwaja2514
      @haiderkhwaja2514 9 หลายเดือนก่อน

      @@cindinishimoto9528 i also need this exercise code very badly

  • @hameedali2963
    @hameedali2963 4 ปีที่แล้ว +1

    great

  • @mansoorahmed4150
    @mansoorahmed4150 3 ปีที่แล้ว +1

    nice explanation. I have one question. What about if we have mix of dependent variables data, like binary as well multiclass v variables, is it fine we apply multiclass regression?

  • @wasit-shafi
    @wasit-shafi 3 ปีที่แล้ว +1

    At 15:33 I thought you are going to say 'plz plz subscribe the channel, like, comment, share... :) Thank you sir for making such a great videos...

  • @leooel4650
    @leooel4650 5 ปีที่แล้ว +2

    Can't express how grateful i am to you Sir.
    I am very willing to even pay for your stuff and help you somehow.
    Thanks once again, my accuracy was about 92%

    • @zerostudy7508
      @zerostudy7508 5 ปีที่แล้ว +1

      how much ratio test/train u use? i got 91...%

    • @leooel4650
      @leooel4650 5 ปีที่แล้ว +3

      @@zerostudy7508 20% of the data to be tested. But the accuracy depends as we are getting random data to be trained or tested. My opinion is that your model is correct, we just have different trained data.

    • @zerostudy7508
      @zerostudy7508 5 ปีที่แล้ว +1

      @@leooel4650 Thank you so much buddy, i just checked that if i use 90% data for train and 10% data test i get 88-90% acuracy, but when i use 80% the data for training i got everage more than 90-100% accuracy. i'll tell you when i figured something out....

    • @leooel4650
      @leooel4650 5 ปีที่แล้ว

      @@zerostudy7508 happy to help as I am still figuring things out.

    • @zerostudy7508
      @zerostudy7508 5 ปีที่แล้ว +1

      @@leooel4650 i got it
      it something to do with sample and population'
      if test A=20 and test A=10
      then they both got just 1 wrong answer
      A and B Standard Deviation Sample are
      A=0.217944947
      B=0.316227766
      about 10% difference
      in a nutshell its sound like this:
      your teacher give 10 questions for exam and your friend got 100, if both of you had 1 wrong answered in the exam, which of you have the highest test score ?
      have a nice day

  • @mlTS7626
    @mlTS7626 8 หลายเดือนก่อน

    Superb content, liked this very much
    12:50, maybe there's a simple mistake that xlabel should be Truth while ylabel should be Predicted, as we have defined cm in that way

  • @KushVarma
    @KushVarma 4 ปีที่แล้ว +1

    getting a score of 1.0, by using newton-cg solver. Default LogisticRegression() shows warning. You can use model = LogisticRegression(solver = 'newton-cg', multi_class='auto') for better training and accuracy.

  • @cbbakshi2020
    @cbbakshi2020 4 ปีที่แล้ว

    Amazing tutorial:) How to make roc_curve for this multiclass problem?

  • @arjunpukale3310
    @arjunpukale3310 5 ปีที่แล้ว +1

    How to recognize whether the classification dataset is linear or non linear if there are multiple variables and cannot be plotted?

  • @muhammedrajab2301
    @muhammedrajab2301 3 ปีที่แล้ว +2

    sir I have done the Iris flower exercise according to what I have learnt from you. I got an accuracy of 1.0 (I thing it is 100%) !
    I just done everything according to what I have learnt from you!

    • @codebasics
      @codebasics  3 ปีที่แล้ว +1

      Perfect and keep it up. The dataset is small hence getting accuracy of 1 is not unusual

    • @vedanthbaliga7686
      @vedanthbaliga7686 3 ปีที่แล้ว +1

      if you have given random_state or shuffle=True then the accuracy will be 1

    • @oilidzaghloul3266
      @oilidzaghloul3266 2 ปีที่แล้ว

      @@vedanthbaliga7686 even without a random_state or shuffle it s still possible to get 1, it s all due to the fact that our dataset here is small

  • @syed1742
    @syed1742 4 ปีที่แล้ว +1

    How to visualize decision boundry through plot and how to optimize using log loss function, and whatever you are teaching that teaching everyone.

  • @tanmaythaker2905
    @tanmaythaker2905 2 ปีที่แล้ว

    Sir done with the assignment. Got 100% train accuracy for iris dataset and also plotted the confusion matrix.

  • @parasf09
    @parasf09 4 ปีที่แล้ว

    accuracy=93.3%
    thankyou sir

  • @AlonAvramson
    @AlonAvramson 2 ปีที่แล้ว +1

    Thank you for explaining this in such a nice and easy way. BTW, I downloaded the whole GIT files but could not find the exercise solution for this session, so If some one has a clue please let me know.

    • @aravinthm8328
      @aravinthm8328 2 ปีที่แล้ว

      Yaa the answer for this exercise is not in the file. I solved the exercise, you can also try in the same way as in the model problem. but in the Handwritten digit problem, i got an error when fitting the model :( , i cant correct the error. It showing 'str' object has no attribute 'decode'. Can you help me to come out from this.

    • @RahulRaj-cy1xb
      @RahulRaj-cy1xb 2 ปีที่แล้ว +2

      Bro we need to download exercise from kaggle? As sir only uploaded image on github

  • @kalaipradeep2753
    @kalaipradeep2753 9 หลายเดือนก่อน

    I got 100% accuracy🎉🤩

  • @thannasip8001
    @thannasip8001 3 ปีที่แล้ว

    Hi ,as you said sigmoid function will convert values to 0 or 1 ,how is it possible to predict digits with this concept ?,for binary output I got it but for digits it confused me

  • @looploop6612
    @looploop6612 5 ปีที่แล้ว

    do you need preprocessing for scaling data?

  • @perikalasunny5698
    @perikalasunny5698 2 วันที่ผ่านมา

    sir in this video i think you took x and y axis reverse in labelling the cause in confusion matrix arguments its x and y respectively right?

  • @foreveryour11
    @foreveryour11 ปีที่แล้ว +1

    At 12.17 what we predicted was for X_test. Why did we compare the Y_test and X_predictions? Am i understanding it wrong?
    😀

  • @anandsingh1011
    @anandsingh1011 5 ปีที่แล้ว +1

    Your all video on any topic have deep theoretical explained with notebook , Can you suggest good resource or book for Machine Learning ?

    • @orangewares
      @orangewares 5 ปีที่แล้ว

      th-cam.com/video/OGxgnH8y2NM/w-d-xo.html

  • @swL1941
    @swL1941 4 ปีที่แล้ว

    100% accuracy.
    Thank You Sir.

  • @sushilchauhan2586
    @sushilchauhan2586 4 ปีที่แล้ว

    can you cover multicolinearity check in logistic regression

  • @rajareivan2417
    @rajareivan2417 ปีที่แล้ว +1

    so it can only take inputs and predict images from the dataset?, how if i want to predict other images that are not from the digit dataset?

  • @naveenkalhan95
    @naveenkalhan95 4 ปีที่แล้ว +3

    @12:47 maybe not that important.. but just for my clarification, I would like to confirm... should plt.xlabel not be 'Truth' and plt.ylabel be 'Predicted' ? Thank you for your hard work.

  • @asitkmr487
    @asitkmr487 5 ปีที่แล้ว

    Very informative. As per my understanding LR model predicts the binary classification problem. It would be great if you can share how this predicts this multi class problem?

    • @codebasics
      @codebasics  5 ปีที่แล้ว

      Check machine learning tutorial playlist on my channel. I have example for binary classification as well and in fact this particular tutorial is for multiclass classification

  • @mistazed1170
    @mistazed1170 11 หลายเดือนก่อน

    I have a question please. Once you have built the model then how do you then use it to show your company how to turn target certain customers for better results

  • @jaiprathapgv2273
    @jaiprathapgv2273 3 ปีที่แล้ว

    How can use this model used to recognize a new target image out of digits library?how to view the classification graph?

  • @tusharsrivastava4328
    @tusharsrivastava4328 4 ปีที่แล้ว

    Sir plz make videos on feature selection and engineering

  • @Priiyannshu
    @Priiyannshu 6 หลายเดือนก่อน

    Love ur videos! , but how is this example muticlass we are just using target and data. Thanks

  • @nilupulperera
    @nilupulperera 4 ปีที่แล้ว +2

    Dear Sir
    Very interesting exercise.
    Model accuracy varies from 0.8 to 1.0, each and every time after a fresh run of the full code (as you explained). The average accuracy is around 9.66667.
    Thank you very much

    • @pranavkushare5109
      @pranavkushare5109 4 ปีที่แล้ว +1

      use (shuffle=False) in train_test_split()

  • @pranaymitra7565
    @pranaymitra7565 3 ปีที่แล้ว +1

    Hi, I had a query. In the part where you plotted the confusion matrix, shouldn't the xlabel be Truth and the ylabel be Predicted since in the confusion matrix we used y_test as x and y_predicted as y ?
    Great videos btw, really helpful xD

    • @Nader95
      @Nader95 2 ปีที่แล้ว

      good point

    • @aditya03dhee
      @aditya03dhee 9 หลายเดือนก่อน

      Yes I am also thinking the same.