Skip to content

priyagole/CRITERIONS_PClub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CRITERIONS_PClub

The code implements optimization (through gradient descent) of different cost functions in a Linear and Polynomial Regression model. The cost functions are further compared on how well the linear/polynomial function fits the data and how close the parameters get to the "desired parameters."

(The code for how I generated the data is "GeneratingData.ipynb")
(The theta values I am using here correspond to the dataset present in CSV files.)

Linear Regression Model

The desired value of theta is [[15] [4]]

For cubed error function |x - x̂|³:

We got, theta = [[14.99448849] [3.90734145]]

aa

For absolute error function |x - x̂|:

Theta turned out to be [[14.6476] [4.06246221]]

bb

Both the cost functions fit the data well.
Comparing the parameters, we see that the absolute error function gives a slightly better parameter values.

Polynomial Regression Model

The desired value of theta is [[1] [1] [2]]

For "fourth-degree" error loss function |x - x̂|⁴:

Theta turned out to be [[1.01463795] [0.99882387] [1.98143011]]

cc

For "seventh-degree" error loss function |x - x̂|⁷:

We got, theta = [[1.00994373] [1.02028566] [1.83644596]]

dd

Both the cost functions fit the data well.
Looking at the graphs, the "fourth-degree" error loss function fits the data slightly better.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published