3
3
Making Predictions
(Linear Regression)
Course Title: Artificial Intelligence
Instructor: Dr. Umara Zahid
Objective/ Learning Outcome
• The objective of this lecture is to enable students compare bivariate
data using different methods and make predictions for the future
• At the end students will be able to compare data using scatter plots,
line of best fit, and regression
• The students will be able to predict future outcomes
• Based on the kind of data students will be able to select a suitable
technique of data comparison
• Manual calculation of linear regression, python coding, in rapid miner,
in SPSS
• Enable students to solve real world problems using regression
Types of Data
Univariate and Bivariate Data
• Univariate: one variable (one type of data) • Bivariate: two variables (there
• Example: Travel Time (minutes): 15, 29, 8, 42, are two types of data)
35, 21, 18, 42, 26
• The variable is Travel Time • With bivariate data we
• Example: 2.5, 3.5, 3.3, 3.1, 2.6, 3.6, 2.4 have two sets of related data
• The variable is Puppy Weight we want to compare
• lots of things can be done with univariate
data:
• Example: Sales vs Temperature
1. Find a central value • The two variables are Ice Cream
using mean, median and mode Sales and Temperature
2. Find how spread out it is
using range, quartiles and standard
deviation
3. Make plots like Bar Graphs, Pie
Charts and Histograms
Bivariate Comparison Examples
• An ice cream shop keeps
track of how much ice
cream they sell versus the
temperature on that day
• Here are their figures for
the last 12 days
Scatter plot of Ice cream sales data
• Now we can easily see that warmer weather and more ice cream
sales are linked, but the relationship is not perfect
Ways to compare Data
• We can use:
1. Tables,
2. Scatter Plots,
3. Correlation,
4. Linear regression
What is Linear Regression?
• Linear Regression (LR) is a statistical model used to predict the
relationship between independent and dependent variables
• LR examines two factors:
Two Factors
Examined