{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Lineare Regression\n", "\n", "This notebook implements linear regression using gradient descent as taught in Week 1 of [Coursera's Machine Learning course](https://www.coursera.org/learn/machine-learning/#syllabus).\n", "\n", "The course doesn't explicitly go into the implementation yet, so I'm not sure how to pick a good alpha (learning rate) nor do I know a good way to determine the number of iterations the algorithm should run.\n", "\n", "I decided to attempt a quick implementation in Python anyway in order to improve my understanding." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | x | \n", "y | \n", "
---|---|---|
0 | \n", "0 | \n", "1 | \n", "
1 | \n", "1 | \n", "3 | \n", "
2 | \n", "2 | \n", "5 | \n", "
3 | \n", "3 | \n", "7 | \n", "
4 | \n", "4 | \n", "9 | \n", "
5 | \n", "5 | \n", "11 | \n", "