<jupyter_start><jupyter_text>Decision Tree Classifier A decision tree is a tree flow chart wheree each node splits a groupmof pbservations according to a feature variable  Data We are going to build a simple classifier to diffrentiate between men and women using 2 features 'height and length of hair'  Installation of dependant packages  We have to install the pydotplus and graphviz packages in order to be able to visualize the flow chart of our model<jupyter_code>#importation of packages
import pydotplus
from sklearn import tree
from sklearn.tree import DecisionTreeClassifier
from sklearn.metrics import classification_report
from sklearn.model_selection import train_test_split
import collections<jupyter_output><empty_output><jupyter_text>Dataset We will create our own personal dataset<jupyter_code>x = [[165, 19], [231,23], [143, 25], [456, 34], [256, 23], [150, 32], [443, 43], [123, 31], [543, 60], [543, 90], [170, 26]]

y = ['man', 'woman', 'man', 'man', 'woman', 'woman', 'man', 'woman', 'man', 'woman', 'man']

feature_names = ['height', 'length of hair']

x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.40, random_state=5)
#time to instantiate and fit the model witht the data

model = DecisionTreeClassifier()

model = model.fit(x, y)
#time to test our model on a new instance of the data
prediction = model.predict([[133, 37]])
print(prediction)<jupyter_output>['woman']
{'fraction_non_alphanumeric': 0.10474168435951875, 'fraction_numerical': 0.04600141542816702, 'mean_word_length': 6.105527638190955, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '187821', 'license': 'MIT', 'n_tokens_mistral': 491, 'n_tokens_neox': 435, 'n_words': 178, 'path': 'Supervised_Learning/Classification/Building Claasification models/.ipynb_checkpoints/Decision Tree Clasifier-checkpoint.ipynb', 'repo_name': 'Hardik357/Nutshell-Machine-Learning', 'size': '1413'}