I try the code from Scikit-Learn Decision Tree: Probability of prediction being a or b?
but, it gave syntax error, this is the code:
from scikit-learn import tree
# https://stackoverflow.com/questions/47251594/scikit-learn-decision-tree-probability-of-prediction-being-a-or-b
#load data
X = [[65,9],[67,7],[70,11],[62,6],[60,7],[72,13],[66,10],[67,7.5]]
Y=["male","female","male","female","female","male","male","female"]
#build model
clf = tree.DecisionTreeClassifier()
#fit
clf.fit(X, Y)
#predict
prediction = clf.predict([[68,9],[66,9]])
#probabilities
probs = clf.predict_proba([[68,9],[66,9]])
#print the predicted gender
print(prediction)
print(probs)
what is wrong with the code?