Decision Tree Classification in Python (from scratch!)

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 ธ.ค. 2024

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

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

    Hey! I can easily say that your channel will be worldwide sooner or later! Never compromise from the quality. Great job.

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

      Thanks a lot mate :D :D

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

      I'm a few months late, but I realized that this specific video is just a slight modification of google's "Let’s Write a Decision Tree Classifier from Scratch".

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

    There is just a WOW factor. I had been looking for explanation and implementation from the scratch in this way. Thumbs up to you. Thanks!

  • @isaigm
    @isaigm 5 หลายเดือนก่อน +2

    For anyone wondering. this is not ID3 because ID3 only works for data sets with categorical attributes, its neither C4.5 because that one generates possibly a general tree and handles both numeric and categorical attributes, and here the algorithm presented generates a binary tree, most close to CART, but CART its for regression and classification, so the guy developed his own algorithm

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

    Normalized Nerd please come back we love ur videos !

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

    Can't believe I'm just finding this channel!
    I've been working as a DS for a few years now, but my company is finally delving into ML workflows, and I need a refresher from my undergrad. Turns out, these videos are even more useful than said undergrad!
    Thanks, nerd. I'll be tying this into other courses as explainers, great videos

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

    Wow, your videos are extremely high quality

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

    This is really awesome!!! Stay blessed and keep producing these great learning videos!

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

    Great work! Thanks for sharing. As you said it "So satisfying to see a model coded from the scratch perform so well" :)

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

    This was such a thorough yet approachable explanation. Thanks!

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

    You put a lot of work in this video, thank you! Subscribed :)

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

    Thanks! In your previous video it wasn't explained how you use information gain to subsequently calculate the best conditions in each node. This explains it very well: recursion!

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

    It's a great tutorial. I have always been struggling to understand these topics. And, now I feel I discovered the right path to get into it. Please keep it up. In addition, it would be much meaningful if the codes you wrote are available for download. Many thanks!

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

    you are amazing! hope your channel goes along and more and more popular!

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

    This is so great...! Just the right video to get me started with Decision Tree Classifier..!!! Keep going, would like to see more videos on other ML algorithms...!!!

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

    Great explanation. I needed the Decision Tree for my research.

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

    I enjoyed the code walk through. Nice job. Thank you!

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

    Fantastic video, just like the previous one. Great teacher. Thanks.

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

    Hello from the future, Normalized Nerd! These videos are excellent and incredibly straightforward. Thank you for your contribution and sharing of your knowledge

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

    This is a great playlist! Keep up the good work

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

    TypeError Traceback (most recent call last)
    in ()
    1 classifier = DecisionTreeClassifier(min_samples_split=3, max_depth=3)
    ----> 2 classifier.fit(X_train,Y_train)
    3 classifier.print_tree()

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

      even i am getting the same error.Have you found the solution for this ?

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

    I ask Chat GPT about something and it broad me here. Man, thanks for this guy and chat GPT, now I got a purpose to do.

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

    final part seems a little rush but it's fine.
    would appreciate if you explain how the model corelates with the flower dataset

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

    Excellent explanation. The coding is made so simple with your perfect explanation. Thank you :)

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

    Wow!! I had been looking for this!

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

      That's great! Keep supporting :D

  • @DoctorWei-mu8ne
    @DoctorWei-mu8ne 7 หลายเดือนก่อน

    Thanks for sharing! I can't wait to start coding!❤

  • @박재성-k7h
    @박재성-k7h 2 ปีที่แล้ว

    Thank you teacher! I swear you are the best teacher in the world!

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

    Thanks bro for clear explanation and well written code

  • @Astra-g1h
    @Astra-g1h 11 หลายเดือนก่อน

    You're the best! Thank you for the great tutorial!

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

    Very clear and intuitive! Thanks

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

    Beautiful explanation. Thank you!

  • @sher.5027
    @sher.5027 2 ปีที่แล้ว

    Thanks for the video, this would help me with my btech project.

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

    Perfect explanation!

  • @SHIVAMGUPTA-kl5gk
    @SHIVAMGUPTA-kl5gk 2 ปีที่แล้ว

    thank you, man!! , You saved it, Nice and easy Explanation.

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

    Great work, really appreciate these videos!

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

    ❤love the content keep it up brother… proud of u

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

    Can you show us on how you can calculate the entropy and the gini within your code?

  • @ИсмоилОдинаев-й2я
    @ИсмоилОдинаев-й2я 4 หลายเดือนก่อน

    That is great, sr! Thanks a lot!
    In 8:02 minute the "get_best_split()" function takes unnecessary "num_samples" parameter.

  • @abdulwajid.s222
    @abdulwajid.s222 2 ปีที่แล้ว

    Please continue uploading more information videos like this. 👍👍

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

    Great videos, keep up the good work

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

    It is really a great piece of work.

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

    it is real a well explained video, thanks a lot!!!

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

    I would have loved if you could have gone through the code in more details e.g. explain more thoroughly what each line does and also include an arrow to show in which line of code you are when explaining it. It owuld make it a lot easier for beginners like me to understand your video.

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

    Can you tell me what is the motive of coding decision tree from scratch.
    Well, we can use the sklearn algo. for it. But, did you do it for just upskilling in python Or,
    The coded decision tree is better than the sklearn library decision tree.
    Because, I think the basic algo. of sklearn is also based on the recursive pattern for creating nodes.
    So, please tell me, what are the benefits of making our own decision tree

    • @santipereira5807
      @santipereira5807 25 วันที่ผ่านมา

      it is useful for learning how the current algorithm works

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

    did you use id3 algorithm for the classification ?

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

    Gracias Mil !!! Este video se complementa muy bien con el anterior. De otro lado, tienes algún tutorial sobre Regression Tree?

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

    Imagine paying every month over 100 euros to learn a course based on AI and 30 mins on your vids I've already learned significantly more then I have 2 and a half months with those teachers... Sad world where the teachers hired (A person pretty much directly responsible for future generations) are absolute garbage and 100% don't deserve their pay check with the effort and enthusiasm they put in class.
    Regarthless, your vids are trully amazing and easy to follow! Good job man and hope these positive comments made your work worth it :) I know it did to me

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

    Very informative.. thanks for sharing

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

    your videos are awesome bro!!!

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

    Hi Great Video!
    Just wanted to quickly ask if this was based on the zero rule algorithm or CART algorithm. This scratch implementation of decision tree differs from the sklearn's decision tree on my dataset. This implementation trained on my dataset gives me 78% accuracy whereas sklearn's decision tree gives me 95% accuracy. Any ideas what the difference between the 2 implementations could be?

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

    Brilliant video!!

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

    Absolutely amazed

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

    This is good stuff, thanks!

  • @AhamedKabeer-wn1jb
    @AhamedKabeer-wn1jb 2 ปีที่แล้ว

    Thank you..Well explained..

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

    Thanks, Nice tutorial

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

    Great Job sir. Very usefull video

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

    u r doing ground breaking work!!! code refer kru kya??

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

    AMAZING, thanks.

  • @Arthur-ux9ez
    @Arthur-ux9ez ปีที่แล้ว

    Thank you for this video

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

    The best tutorial👍

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

    Hi, thank you very much for this video. Is there a way to turn the tree we obtain into a more readable graphic representation?

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

    well explained! Thank you!

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

    How do you do those visualizations? They are cool

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

    This guy is 3blue1brown but for ML. Thank you!

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

    Hey there.. just wanted to ask you if there are more than two attributes, will Machine Learning check information gain from each attribute for every value of attribute..

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

    Awesome, man!

  • @santipereira5807
    @santipereira5807 25 วันที่ผ่านมา

    I am currently studying an AI engineering career and I am certainly worried, because I don´t know how I would solve this if it wasn´t for this video or ChatGPT. What would you recommend me to do to get confidence in programming things like these?

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

    Can I choose 'entropy' for information gain in this model.

  • @kunals.968
    @kunals.968 3 ปีที่แล้ว

    Indians at their Best!!! Thanks for such a great content bro!

  • @tevinwright5109
    @tevinwright5109 7 หลายเดือนก่อน

    LOVE THIS

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

    hey, is this for C4.5, ID3, or Hunt's algoritm? thx

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

    thank you !

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

    I really like it

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

    thank you so much

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

    Very helpful video

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

    so what does X_2

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

    Can I use this code for different values of max_depth ?? Actually I don't want to do any pruning here

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

    Very nice!

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

    thank you buddy

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

    Greate explaination!!

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

    Is it C4.5 decision tree sir?

  • @Ali-1A295
    @Ali-1A295 2 ปีที่แล้ว

    Thank you for this tutorial
    I have a question
    Why the program give me
    Invalid DecisionTreeClassifier

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

    how to vizualise the above code using graphviz

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

    where do i run these commands

  • @shaz-z506
    @shaz-z506 3 ปีที่แล้ว +1

    Good video and the animation is similar to 3blues 1brown, how did you make this video animation I wonder.

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

      I used Manim (an opensource python library) created by 3blue1brown himself!

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

      @@NormalizedNerd yes it is possible but have to write a lot of code

  • @017_saimanaim5
    @017_saimanaim5 3 ปีที่แล้ว

    @Normalized Nerd how even after using the same code my accuracy is coming 100%?

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

    in the build tree function there is the line:
    X, Y = dataset[: , :-1], dataset[:, - 1]
    what do they mean ?

    • @santipereira5807
      @santipereira5807 25 วันที่ผ่านมา

      dataset[rows, columns], ":" means all of them so dataset[:,:-1] takes al the rows and all the columns except the last one (index -1).

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

    Next time please use something besides the iris dataset, if you can. Thanks for the video though.

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

      Well, this was the first time I touched iris in this channel haha...will use more diverse datasets

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

    Can anyone help me out ,I'm getting error like couldn't able to convert int value into float from datasheet

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

    awesome

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

    Can some explain what is feature_index?

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

      for Node, it seems to simply identify the depth of the current node.
      in 'get_best_split' it's an index for the loop as it iterates through the range(num_features).

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

      @@alfraelich Okay the the min depth value is given to to the feature index?

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

      ​@@secondarypemail7181 It's the index of 'range(num_features)' from the 'get_best_split'​. This is passed as a return to the calling function, 'build_tree', just before it's used as an argument in the call to 'Node()' in the __init__
      if you look at the 'print_tree' function, it's used there in the print statements to show 'X_' value, as well as in the 'split' function to ensure the value is below the threshold. the range is 4, which gives us the 0-3 we see in the printout of the tree.
      try plugging it print statements throughout to see where the value changes and to what.
      I hope that helped.

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

    Thank you but my accuracy_score is 0.36.. :(

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

    13:48

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

    We need you to trace the code line by line by hand with real data using a very small data set to truly understand what is happening

    • @AbogadoAstuto
      @AbogadoAstuto 7 หลายเดือนก่อน

      Pandas is just for the data set. He is doing it from scratch.

  • @g.p.g.9084
    @g.p.g.9084 3 ปีที่แล้ว

    Good explanation of the Decision Tree but '__init__' is not a constructor.

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

      Yes, it's not. Mentioned it for the beginners.

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

    Value is pronounced with a /y/ sound, /v ae l y uw/, not as you pronounce it /v ae l uw/.

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

    bhai code to dedo yar

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

    Bhai tumi Bangali?

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

    Good video but a bit hard to follow sometimes on phone when the code is not pointed out with a cursor, cant see exactly what line you are referring to sometimes

  • @Ecueden
    @Ecueden 7 หลายเดือนก่อน

    Hello people from the future 😎

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

      What do you mean

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

    esrnbarenfarnfbilnrnrr spamming kr rha hu