A program to recognize and reward our most engaged community members
Generating complete case logic for decision trees using altair personal slc
github https://github.com/rogerjdeangelis/utl-generating-complete-case-when-logic-for-decision-trees-using-altair-personal-slc
hi res tree graphic https://github.com/rogerjdeangelis/utl-generating-complete-case-when-logic-for-decision-trees-using-altair-personal-slc
Generating complete case logic for decision trees using Altair Personal slc
Note: this is a very simple decision tree example with no holdout sample, no confusion matrix, no lift charts, no roc curves, no pruning. no logistic analysis and no discriminant analysis.
TWO SOLUTIONS
1 r case when code (generate dynamically - works with most sql dialects)) case when ( score <= 38.31 and age <= 6 and score > 30.77 ) then 'Y' when ( score > 38.31 and age <= 8 ) then 'Y' when ( score > 38.31 and age > 8 and score > 50.28 ) then 'Y' else 'N' end as response 2 python only code (only works in python, Also very different from other languages. forced indent) if score <= 38.61000: if age <= 6.50000: if score <= 31.23500: return 0 else: return 1 else: return 0 else: if age <= 8.50000: return 1 else: if score <= 50.54500: return 0 else: return 1
NOTES:
4, Generally you build a model on a random sample, say 100,000 obs then you apply the model to a much larger population, 100,000,000. Develop on a power workstation.
5 many decision tree applications allow you to run the code within the application on larger populations, but having the sql code allows, excel, spss, matlab any language with an ODBC to apply the model.