04 Regression

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 22

AI in Healthcare: Lecture 4

Regression
Linear Regression
• A house with area , have bed rooms, and stay away from the city
center km have price?
Real outcome (groundtruth) Prediction

Where
• : constant, : bias
• The relationship is a linear relationship
• This problem is a regression problem when we want to find the
optimized parameters LINEAR REGRESSION
Linear Regression
• Loss function

We have the derivative wrt. b of loss function is


=

(1)
Linear Regression
• If is invertible (non singular), then (1) has only one solution

• If A is non invertible, we use the pseudoinverse


Simple Linear Regression

Line of regression

Datapoints
Simple Linear Regression
• We have a table of height and weight of 15 persons as below
Height (cm) Weight (kg) Height (cm) Weight (kg)

Predict weight of one person based on one’s height?


Prediction
Multiple Linear Regression
• A multiple linear regression model is a model with many predictor
variables .

• More complex models may include higher powers of one or more


predictor variables
Multiple Linear Regression

• Consider the following data


concerning the Housing Price Index
(HPI). Age and Loan are two
numerical variables (predictors) and
HPI is the numerical target.
• We can use the training set to
calculate an unknown case using
Euclide distance. If K=1 then the
Nearest Neighbor is the last case in
the training set with HPI = 264
Assignment:
• Predict the HPI using the two predictors Age and Loan using:
sklearn.neighbors.KNeighborsRegressor
Logistic Regression
• Problem: Time to study affects probability of the students pass the
exam?
Logistic Regression
• Graph of exam results based on the hours studying not linear regression
Logistic Regression
• Output of logistic regression:

• In which, is logistic function


• Sigmoid function

with
Logistic Regression
• is the probability that , given :

• We have:

So, in general:

if
if
Logistic Regression
• Log likelihood function:

• Cost function should be minimized:

• Take the derivative:

• We have:

• , where

You might also like