Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lazy-programmer-courses
/
linear-regression
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
053078c0
authored
Jul 31, 2018
by
Paktalin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
class 18 is done
parent
816094c5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
267 additions
and
0 deletions
6_systolic_blood_pressure.ipynb
6_systolic_blood_pressure.ipynb
0 → 100644
View file @
053078c0
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"def get_r2(X, Y):\n",
" A = X.T.dot(X)\n",
" b = X.T.dot(Y)\n",
" w = np.linalg.solve(A, b)\n",
" Yhat = X.dot(w)\n",
" d1 = Y - Yhat\n",
" d2 = Y - Y.mean()\n",
" ssr = d1.dot(d1)\n",
" sst = d2.dot(d2)\n",
" r2 = 1 - ssr / sst\n",
" return r2"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"*** No CODEPAGE record, no encoding_override: will use 'ascii'\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>X1</th>\n",
" <th>X2</th>\n",
" <th>X3</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>132</td>\n",
" <td>52</td>\n",
" <td>173</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>143</td>\n",
" <td>59</td>\n",
" <td>184</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>153</td>\n",
" <td>67</td>\n",
" <td>194</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>162</td>\n",
" <td>73</td>\n",
" <td>211</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>154</td>\n",
" <td>64</td>\n",
" <td>196</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" X1 X2 X3\n",
"0 132 52 173\n",
"1 143 59 184\n",
"2 153 67 194\n",
"3 162 73 211\n",
"4 154 64 196"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df = pd.read_excel('../files/systolic.xls')\n",
"df.head()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"df['ones'] = 1"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"X = np.array(df[['ones','X2','X3']].values)\n",
"Y = df['X1'].values"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEKCAYAAAAIO8L1AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAHXVJREFUeJzt3X90XWWd7/H3p6kWyvgDb4MiDWniDWRVrRUiI1dxCigo4wX8MQ6lLnvVO5UOda5lUUcEIbfCXVyZy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FPpDWIl4NLEi/8yhQK+n5LidJr5+geNaRdEEREQ+nbd8HlqZdW0g6KZ3t9hUka578UdKZQH3WD0qaBUyLiNuBz5FMNW42br6DsKluIXD9kLbbgYtJ/rV9NsnUx78Cfk5SC/hD2t3zpbRWMJ2ki+phxiki9kj6JXBHQfPNJF1SD6Q1hl6Sukkb8G1J7SQzEz8yzM+eQLLq28A/+K4Yb5xm4GGuVuUk/UlEPJd2Rd1PsuLdUzkebybwEMnCO8/mdRyzieA7CKt2d0l6Jcl6B5/POTm8k2RE1BedHKwS+A7CzMwyuUhtZmaZnCDMzCyTE4SZmWVygjAzs0xOEGZmlun/A16jjif/1kHfAAAAAElFTkSuQmCC\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.scatter(X[:,1], Y, edgecolors='k')\n",
"plt.xlabel('Age in years')\n",
"plt.ylabel('Blood pressure')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEKCAYAAAAIO8L1AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAHoZJREFUeJzt3X10XXWd7/H3pwFb8GGAaVCkIU2dQKZoLRC56IgWUUB0AMEHEK+94r0dKvWhXOrogBArrHFkau91OqJVuiiaFlE6WBEV7ah1lIdJoYQSwNSWTCOVFroEvW2jTb/3j71DT9OdnJM0+5yc5PNa66zu891P359nmS97//b+/RQRmJmZ9Teh0gmYmdno5AJhZmaZXCDMzCyTC4SZmWVygTAzs0wuEGZmlim3AiFpmaRtkjYUxL4laX36eVLS+oJ1n5a0UdITks7OKy8zMyuN8noPQtKbgD8Ct0bEqzPWLwKei4iFkqYDK4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cdJIXnPOAzkk6MfRPRmAG+grDq80uS2zY7IqI3InYAR5DcIro33eZHwGXpWPpIOrZv5NYC/wFclPZFvJykA7qYP5DMGzFSjpPUd2vrkjSnx4Gpkv4qjf934Ofp8pPsG2K+b/a7wawF3iXpMEkvBf4WXujgr4uInwKfJPnf7yUH2RYbg1wgrNo8QvL00n39Ys+lt1eIiHuAFcC9kh4BvsOBf9jvIBn5cwPwVZK+jOeKnPt7JH9wD+ikHqbHgNmS2oGjgJsiYjfwIeDbae572TcM+WeB/yvpFyRXCYOKZMrKb5GM+nkH0NdvUgN8Mz3+QyT9Kr8fgfbYGOPRXG3ckvSSiPijpL8kGTv/b9L+iHKceypwV0S8uhznMxsO90HYeHaXpCOAFwGfK1dxMKsWvoIwM7NM7oMwM7NMLhBmZpbJBcLMzDK5QJiZWSYXCDMzy/T/AZPa4VN1MwMtAAAAAElFTkSuQmCC\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.scatter(X[:,2], Y, edgecolors='k')\n",
"plt.xlabel('Weight in pounds')\n",
"plt.ylabel('Blood pressure')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"r-squared for both X2 and X3 is equal 0.976847104150209\n"
]
}
],
"source": [
"print('r-squared for both X2 and X3 is equal', get_r2(X, Y))"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"r-squared for X2 is equal 0.9578407208147354\n"
]
}
],
"source": [
"X2only = df[['ones', 'X2']]\n",
"print('r-squared for X2 is equal', get_r2(X2only, Y))"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"r-squared for X3 is equal 0.9419952085293064\n"
]
}
],
"source": [
"X3only = df[['ones', 'X3']]\n",
"print('r-squared for X3 is equal', get_r2(X3only, Y))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment