0% found this document useful (0 votes)
5 views10 pages

Unit 5 II Decision Tree, Regression

Uploaded by

Harsh Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views10 pages

Unit 5 II Decision Tree, Regression

Uploaded by

Harsh Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Unit 5-II

Decision Tree,
Regression
Decision Tree
• It is a supervised learning algorithm.
• Decision tree is a graph to represent choices and their results in
form of a tree.
• The nodes in the graph represent an event or choice and the
edges of the graph represent the decision rules or conditions.
• It can perform both regression and classification tasks.
• It uses a tree-like model based on various decisions that are
used to compute their outcomes.
• Examples of use of decision trees is − predicting an email as
spam or not spam, predicting a loan as a good or bad credit risk
based on the factors in each of these.
Decision Tree
Load package

Create dataframe and tree


Decision Tree
Output:
Regression
• Regression analysis is a very widely used statistical tool to
establish a relationship model between two variables.
• One of these variable is called predictor variable whose value is
gathered through experiments.
• The other variable is called response variable whose value is
derived from the predictor variable.
• Mathematical equation for linear regression: y = ax + b
• Linear regression finds the linear relationship between the
dependent variable and one or more independent variables
using a best-fit straight line.
Regression
• Predicting weight of a person when his height is known. The
steps to create the relationship is −
1. Carry out the experiment of gathering a sample of observed
values of height and corresponding weight.
2. Create a relationship model using the lm() functions in R.
3. Find the coefficients from the model created and create the
mathematical equation using these.
4. Get a summary of the relationship model to know the average
error in prediction. Also called residuals.
5. To predict the weight of new persons, use the predict() function
in R.
Regression
Code:
Regression
Visualization:
Regression
Output:
Thank you

You might also like