i created a decision tree for buying a computer or not. my root attribute i used
ID: 3873923 • Letter: I
Question
i created a decision tree for buying a computer or not. my root attribute i used for split was age with 3 values (<= 30, 31-40, >40). for age <=30 there were 2 ppl who would buy computer and 3 who wouldnt. for 31-40 there were 4 people who would buy computer, so that leaf is pure. for >40 3 would buy computer and 2 wouldnt. for <=30 i further split it using "student" attribute with the values of "no student" or "yes student" 3 people who are <=30 and are not students did not buy a computer. 2 people who are <=30 and are students bought a computer. then for >40 i used "credit creating" attribute to split. people who are >40 and have a fair credit rating, 3 of them bought a computer. 2 people who are >40 and have a "excellent" credit rating did not buy a computer. now my question is how do I calculate the accuracy of this decision tree model?
Explanation / Answer
Use the generated decision tree to evaluate the dataset that you have for which final purchase decision is already known. Create a new field : predicted purchase decision (Y/N). If the decision tree evaluation indicates that for a given row in the dataset, the customerr will purcahse the computer set this field as Y other set it as F.
Now do an actual versus predicted comparison.
Total number of dataset rows for which predicted=actual purchase decision
---------------------------------------------------------------------------------------------------- * 100
Total number of dataset rows
This would represent the precentage accuracy for the decision tree.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.