https://github.com/amilworks/gradientdescent
Learning about gradient descent.
https://github.com/amilworks/gradientdescent
Last synced: 3 months ago
JSON representation
Learning about gradient descent.
- Host: GitHub
- URL: https://github.com/amilworks/gradientdescent
- Owner: amilworks
- Created: 2017-05-23T08:30:38.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-05-23T10:22:08.000Z (about 8 years ago)
- Last Synced: 2025-01-22T08:47:36.677Z (4 months ago)
- Language: Python
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Linear Regression using Gradient Descent
For all of you PSTAT 126 students out there, and, well, people who have taken a course on _Linear Regression_, here is an example of how to start expanding your theoretical knowledge horizon. This example requires you know some basic `Python`. If you don't know the basics, seriously ask yourself why you are here, why you still exist, and why you think you will learn from someone who sucks at `Java`.

## Plotting Points

Let's say we have some points on a graph and we want to fit a line through them. This is linear regression--modeling some points on a graph with a line. I know I sound redundant, but it is necessary. Forget about the data, I graphed whatever I could in R. We see that we could probably fit a line through these points, but let's make it hard on ourselves and use gradient descent to prove this phenomenon with some random data.
## Our Data
The data we will be using is from a dataset with 2 columns and 150 rows. The first column is hours studied, and the second column is grades on that test. The question of significance is, __Do students who study more hours receive better test scores?__## The Error Function
We will begin by defining an error function that measures how “good” a given line is. Remember, we are trying to fit a line of _best_ fit. Computing this function will return an error value based on how well the line fits our data.

## Finding the Minimum
Next, these two equations will give us a helping hand when attempting to find the minimum.
## How to Run and Results
The easiest way to show you how to run the code is by showing.
## Inspiration and Documentation
__Gradient Descent Example__
* Huge thanks to Matt Nedrich for providing a detailed example of gradient descent for noobs. Check his Github out. I learned a ton with this example alone.