Introduction to Machine Learning with Python and Repl.it
I've written a tutorial to explain basic machine learning concepts and to show how to get started with the great Python scikit-learn library.
I hope it helps, especially if you're taking part or wanting to take part in the Repl.it AI competition!
The tutorial is published over here: https://www.codementor.io/garethdwyer/introduction-to-machine-learning-with-python-and-repl-it-rln7ywkhc
As always, keep the feedback coming!
@mananboi006 great question - you can use
classifier.predict_proba https://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeClassifier.html#sklearn.tree.DecisionTreeClassifier.predict_proba which will give you back a 'score' for each possible label. The predict function just returns the one with the highest score.
I will try to do a follow up on this tutorial to explain how it works with some examples, but for now feel free to shout here i f you don't understand anything
@GarethDwyer1 i tried that but it gives [[0. 0. 1.]] and basically gives which one of the categories it falls into rather than how sure it is of the category
i want to add a filter so if the program is not sure of the category it choose then it will request a more explained answer from the user
@mananboi006 It should work! If your data set is very simple (like in the tutorial), then often the leaves will be "pure" and the tree will think that it is certain about its answer.
Try a more complicated / larger dataset or a different classifier.
its been fixed, i had to limit the depth of the tree, i'll start testing both trees and see if there is a difference in the results with the tree with a limited depth and the one without any limit.
Thank you very much to your time and support.
edit: i guess i'll use the result from no depth limit and then use the probability for the category with the limited depth one