2.3 Decision Trees and the Loan Approval Problem
[video] /api/lesson-media/videos/9b417aa2-5e9f-4ae3-a9db-2a3b7f03f372-1794614940539-001466962803c395.mp4
[markdown] content available only on the platform
[markdown] content available only on the platform
Flashcards · 2.3 Decision Trees and the Loan Approval Problem
Decision tree — A model that predicts by asking a learned sequence of yes/no questions, like a flowchart, until it reaches a final answer.
Bachelor degree? -> Excellent degree? -> Accept.
Root node — The first question at the top of the tree, where every prediction starts.
"Does the applicant have a bachelor degree?"
Decision node — A node that asks a condition and splits the data further; the root is a special decision node.
"Excellent degree?" in the middle of the tree.
Leaf node — An endpoint of the tree that asks no more questions and outputs the final decision.
Accept or Reject.
Pure branch — A branch whose samples all share one label, so no further splitting is needed.
age = middle: 4 Yes, 0 No.
Split — Dividing the samples at a node into groups according to the values of one feature.
Splitting 14 applicants by age into young, middle, senior.
loan_approved — The binary target column of the loan dataset that the tree learns to predict.
Values: yes or no.
Ordinal feature — A categorical feature whose values have a natural order.
income: low < medium < high.
DecisionTreeClassifier — The scikit-learn class that learns a decision tree for classification problems.
DecisionTreeClassifier(random_state=100).fit(x_train, y_train)
