decision tree classifier decision tree is basically binary tree flowchart where each node splits group of observations according to some feature variable herewe are building decision tree classifier for predicting male or female we will take very small data set having samples these samples would consist of two features 'heightand 'length of hairprerequisite for building the following classifierwe need to install pydotplus and graphviz basicallygraphviz is tool for drawing graphics using dot files and pydotplus is module to graphviz' dot language it can be installed with the package manager or pip nowwe can build the decision tree classifier with the help of the following python codeto begin withlet us import some important libraries as followsimport pydotplus from sklearn import tree from sklearn datasets import load_iris from sklearn metrics import classification_report from sklearn import cross_validation import collections nowwe need to provide the dataset as followsx=[[ , ],[ , ],[ , ],[ , ],[ , ],[ , ],[ , ],[ , ],[ ],[ , ],[ , ],[ , ],[ , ],[ , ],[ , ],[ , ],[ , ],[ ],[ , ] ['man','woman','woman','man','woman','man','woman','man','woman','man','woman''man','woman','woman','woman','man','woman','woman','man'data_feature_names ['height','length of hair'x_trainx_testy_trainy_test cross_validation train_test_split(xytest_size= random_state= after providing the datasetwe need to fit the model which can be done as followsclf tree decisiontreeclassifier(clf clf fit( ,yprediction can be made with the help of the following python codeprediction clf predict([[ , ]]print(prediction