# Case Based Reasoning Lecture 4: CBR Tutorial on Decision Trees.

## Presentation on theme: "Case Based Reasoning Lecture 4: CBR Tutorial on Decision Trees."— Presentation transcript:

Case Based Reasoning Lecture 4: CBR Tutorial on Decision Trees

Exercise 1 – Predicting the Risk for Loan Applications IncomeCredit RatingDebtCollateralRisk 1\$0 to \$15kbadhighnonehigh 2\$15 to \$35kunknownhighnonehigh 3\$15 to \$35kunknownlownonemoderate 4\$0 to \$15kunknownlownonehigh 5over \$35kunknownlownonelow 6over \$35kunknownlowadequatelow 7\$0 to \$15kbadlownonehigh 8over \$35kbadlowadequatemoderate 9over \$35kgoodlownonelow 10over \$35kgoodhighadequatelow 11\$0 to \$15kgoodhighnonehigh 12\$15 to \$35kgoodhighnonemoderate 13over \$35kgoodhighnonelow 14\$15 to \$35kbadhighnonehigh Create the decision tree index

Exercise 1 – Solution first part 6/14 cases are high risk, 3/14 cases are moderate risk, and 5/14 cases are low risk Entropy(S)= -6/14*log 2 6/14 - 3/14*log 2 3/14 - 5/14*log 2 5/14 = 1.531 If income is the root of the decision tree, then: Entropy(0-15k) = - 4/4 * log 2 4/4 = 0 Entropy(15-35k)= - 2/4 * log 2 2/4 - 2/4 * log 2 2/4 = 1 Entropy(over 35k) = - 5/6 * log 2 5/6 - 1/6 * log 2 1/6 = 0.65 Expectation(income)= 4/14*Entropy(0-15) + 4/14*Entropy(15-35) + 6/14*Entropy(over 35k) = 0.56 Gain(income)=Entropy(S)–Expectation(income)= 1.531 – 0.56 = 0.971

Exercise 2 – Predicting the Desirability of a Property PriceLocationStateDesirability 1AverageCentralOKYes 2HighCountrysideOKNo 3LowCentralGoodYes 4HighCentralGoodYes 5AverageCountrysideOKYes 6AverageCentralBadNo 7LowCountrysideBadYes Create the decision tree index

Exercise 3 – Predicting whether to Play Tennis or Not Create the decision tree index OutlookTemperatureHumidityWindyPlay SunnyHotHighFalseNo SunnyHotHighTrueNo CloudyHotHighFalseYes RainyMildHighFalseYes RainyCoolNormalFalseYes RainyCoolNormalTrueNo CloudyCoolNormalTrueYes SunnyMildHighFalseNo SunnyCoolNormalFalseYes RainyMildNormalFalseYes SunnyMildNormalTrueYes CloudyMildHighTrueYes CloudyHotNormalFalseYes RainyMildHighTrueNo

Similar presentations