Python code for Decision Tree
Cleaned data
Python Code to Decision Tree

Method about Decision Tree

Decision tree is a flowchart that shows a clear pathway to make decision. In data analytics field, it helps to classify data. There are several important parts: root nodes, leaf nodes, internal nodes, splitting and pruning.

A decision tree starts at a node then splits in two or more directions. The start nodes are called root nodes and each split one called internal nodes. The final decisions are called leaf nodes show the end of a decision path. The process from root nodes to internal nodes to leaf nodes are called splitting. Each branch offers different possible outcomes, incorporating a variety of decisions and chance events until an outcome is achieved. Pruning is when tree grows branches, we don't need, we cut them off.

There are some drawbacks for decision trees that this method is not suitable for all types of data, for example when the main goal is to predict the outcome of a continuous variable. Because decision trees tend to lose information when categorizing variables into multiple categories. Second, decision tree might overfit the training data which will cause high variability.

Result

I test three drugs using decision tree method which are AMITRIPTYLINE, BUPROPION, and CITALOPRAM. For the AMITRIPTYLINE the accuracy is about 82.4% and, in the group old women and young men have the highest and same f1 score which is 0.84. For the BUPROPION the accuracy is about 64.7% and, in the group young women have the highest f1 score 0.67. For the CITALOPRAM the accuracy is about 71.5% and, in the group young women have the highest f1 score 0.78.

Conclusion

The decision tree model is best fit for drug AMITRIPTYLINE compared to the other 2 drugs. Since AMITRIPTYLINE have the highest accuracy score which is 82.4%. So, AMITRIPTYLINE is the most affective drug among those 3 drugs.

And AMITRIPTYLINE has the most significant effect on old women and young men. The drug BUPROPION and CITALOPRAM both have the most significant effect on young women. However, the BUPROPION accuracy is only about 64.7%. I would say this method may not be very effective for depression treatment.