Professional Documents
Culture Documents
Exp6 Decision Tree
Exp6 Decision Tree
AIM:
To study and implement classification using Decision Tree algorithm in MATLAB software
Description:
Decision tree theory revolves around creating a tree-like model for making classifications or
predictions based on a set of features and outcomes. It's a fundamental concept in machine
learning and data analysis.
Components:
Features (Attributes): These are the independent variables that describe the data points
(e.g., Sepal Length, Sepal Width in the Iris example).
Target Variable (Outcome): This is the dependent variable you want to predict or classify
(e.g., Iris species).
Nodes: These are the decision points in the tree structure. They represent a question asked
about a specific feature.
Internal Nodes (Decision Nodes): These nodes contain questions or tests based on a feature
value (e.g., "Is Sepal Length greater than 5 cm?").
Leaf Nodes (Terminal Nodes): These nodes represent the final predictions or classifications
(e.g., "Species: Iris Setosa").
Branches: These represent the possible answers or outcomes of the questions at each node.
They connect nodes and guide the flow from the root to a leaf node.
Procedure:
1. Open MATLAB
2. Load fisheriris dataset
3. Write the following code
% Create a decision tree model using the first two features (Sepal Length and
Sepal Width)
f = fitctree(meas(:, 1:2), species, 'PredictorNames', {'sepal_length',
'sepal_width'});
Results:
Decision tree:
Classification:
Cluster:-