{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "# Linear Regression Example\n", "\n", "This example uses the only the first feature of the `diabetes` dataset, in\n", "order to illustrate a two-dimensional plot of this regression technique. The\n", "straight line can be seen in the plot, showing how linear regression attempts\n", "to draw a straight line that will best minimize the residual sum of squares\n", "between the observed responses in the dataset, and the responses predicted by\n", "the linear approximation.\n", "\n", "The coefficients, the residual sum of squares and the variance score are also\n", "calculated.\n", "\n" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Automatically created module for IPython interactive environment\n", "Coefficients: \n", " [ 938.23786125]\n", "Mean squared error: 2548.07\n", "Variance score: 0.47\n" ] }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAeQAAAFKCAYAAADMuCxnAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAPYQAAD2EBqD+naQAAFwtJREFUeJzt3X+MbPVd8PHPMkAvpQ1MW1NL9Ql4d/Z6BUWwNmr7xNRO\nO8vaVNEY3bWoNVhr/1BjosY8mMbwKNZoIonG1mpsH8Ex1RSr9u6ODk1jIJpgb4rYS52ZRaiR2wS7\nW36Uy70wd54/ThfYcu/uObt7Zr5z5vVK+OfMOXu/gQ3v+/2ec74zNxqNAgCYrAsmPQAAQJABIAmC\nDAAJEGQASIAgA0ACBBkAEiDIAJAAQQaABFyY56S5ublXR0QrIh6OiGfKHBAAVMyhiLgyIjqj0ehL\n5zspV5Aji/GdBzAoAJhVPx4Rf3G+D/MG+eGIiDvuuCOOHj16AGMCgNnw4IMPxrve9a6Ir7b0fPIG\n+ZmIiKNHj8b111+/v5EBwGza8Zavh7oAIAGCDAAJEGQASIAgA0ACBBkAEiDIAJAAQQaABAgyACRA\nkAEgAYIMAAkQZABIgCADQAIEGQASIMgAkABBBoAECDIAJECQASABggwACR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iA\nDyiPIB+AdrsdzWZz27FmsxntdntCIzoY+41PFUPuAT6gLIJ8AOr1eqytrUWv14tjx45Fr9eLtbW1\nqNfrkx7avuw1PlWdRXqADyiTIB+gRqMRN9xwQ2WWqfcan6rOIj3AB5RJkDmnvcanyrNID/ABZRJk\nzmmv8anyLHIWHuADJkeQOae9xqfqs8iqPsAHTJ4gc157iU/VZ5FVfYAPmLyZ2hjEZg7FbMWn3+/H\nYDDI/e+t3W7H8vJydDqd549VbRbZaDT8DgEHaiaCvLGxESsrK9sC0Wq1ot1um9nkUDQ+ew05wCyb\niSDv9BrO2trahEZVfWaRAPlV/h5ylV/DAaA6Kh/kKr+GA0B1VD7IVX8NB4BqqHyQq/4aDgDVUPkg\nR0Tceuutce211247VrXXcDg4VfyWKiB9lQ7y1rcOvfGNb4zjx49HRMT1118f9913n80ceImqfksV\nMB0qHeRzve50//33xy233DKhEZGyqn5LFTAdKhtkrztRhN8XYNIqG2SvO1GE3xdg0iobZK87UYTf\nF2DSKhtkrztRhN8XYNIqG+QI311LMX5fgEmq9JdL+NYhivD7AkxSpYO8xbcOUYTfF2ASKr1kDQDT\nQpABIAGCDAAJEGQASIAgA0ACBBkAEiDIAJAAQQaABAgyACRAkAEgAYIMAAkQZABIgCADQAIEGQAS\nIMgAkABBBoAECDIAJECQASABggwACRBkAEiAIANAAgQZABIgyACQAEEGgAQIMgAkQJABIAGCDAAJ\nEGQASIAgA0ACBBkAEiDIAJAAQQaABAgyACRAkAEgAYIMAAkQZABIwIU5zzsUEfHggw+WOBQAqJ4X\ntfPQTufNjUajXX/Y3NzcSkTcuf9hAcDM+vHRaPQX5/swb5BfHRGtiHg4Ip45sKEBQPUdiogrI6Iz\nGo2+dL6TcgUZACiXh7oAIAGCDAAJEGQASIAgA0ACBBkAEiDIAJAAQQaABPx/48JjXhRwdagAAAAA\nSUVORK5CYII=\n", "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "print(__doc__)\n", "\n", "\n", "# Code source: Jaques Grobler\n", "# License: BSD 3 clause\n", "\n", "\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "from sklearn import datasets, linear_model\n", "\n", "# Load the diabetes dataset\n", "diabetes = datasets.load_diabetes()\n", "\n", "\n", "# Use only one feature\n", "diabetes_X = diabetes.data[:, np.newaxis, 2]\n", "\n", "# Split the data into training/testing sets\n", "diabetes_X_train = diabetes_X[:-20]\n", "diabetes_X_test = diabetes_X[-20:]\n", "\n", "# Split the targets into training/testing sets\n", "diabetes_y_train = diabetes.target[:-20]\n", "diabetes_y_test = diabetes.target[-20:]\n", "\n", "# Create linear regression object\n", "regr = linear_model.LinearRegression()\n", "\n", "# Train the model using the training sets\n", "regr.fit(diabetes_X_train, diabetes_y_train)\n", "\n", "# The coefficients\n", "print('Coefficients: \\n', regr.coef_)\n", "# The mean squared error\n", "print(\"Mean squared error: %.2f\"\n", " % np.mean((regr.predict(diabetes_X_test) - diabetes_y_test) ** 2))\n", "# Explained variance score: 1 is perfect prediction\n", "print('Variance score: %.2f' % regr.score(diabetes_X_test, diabetes_y_test))\n", "\n", "# Plot outputs\n", "plt.scatter(diabetes_X_test, diabetes_y_test, color='black')\n", "plt.plot(diabetes_X_test, regr.predict(diabetes_X_test), color='blue',\n", " linewidth=3)\n", "\n", "plt.xticks(())\n", "plt.yticks(())\n", "\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "array([[ 0.06169621],\n", " [-0.05147406],\n", " [ 0.04445121],\n", " [-0.01159501],\n", " [-0.03638469],\n", " [-0.04069594],\n", " [-0.04716281],\n", " [-0.00189471],\n", " [ 0.06169621],\n", " [ 0.03906215],\n", " [-0.08380842],\n", " [ 0.01750591],\n", " [-0.02884001],\n", " [-0.00189471],\n", " [-0.02560657],\n", " [-0.01806189],\n", " [ 0.04229559],\n", " [ 0.01211685],\n", " [-0.0105172 ],\n", " [-0.01806189],\n", " [-0.05686312],\n", " [-0.02237314],\n", " [-0.00405033],\n", " [ 0.06061839],\n", " [ 0.03582872],\n", " [-0.01267283],\n", " [-0.07734155],\n", " [ 0.05954058],\n", " [-0.02129532],\n", " [-0.00620595],\n", " [ 0.04445121],\n", " [-0.06548562],\n", " [ 0.12528712],\n", " [-0.05039625],\n", " [-0.06332999],\n", " [-0.03099563],\n", " [ 0.02289497],\n", " [ 0.01103904],\n", " [ 0.07139652],\n", " [ 0.01427248],\n", " [-0.00836158],\n", " [-0.06764124],\n", " [-0.0105172 ],\n", " [-0.02345095],\n", " [ 0.06816308],\n", " [-0.03530688],\n", " [-0.01159501],\n", " [-0.0730303 ],\n", " [-0.04177375],\n", " [ 0.01427248],\n", " [-0.00728377],\n", " [ 0.0164281 ],\n", " [-0.00943939],\n", " [-0.01590626],\n", " [ 0.0250506 ],\n", " [-0.04931844],\n", " [ 0.04121778],\n", " [-0.06332999],\n", " [-0.06440781],\n", " [-0.02560657],\n", " [-0.00405033],\n", " [ 0.00457217],\n", " [-0.00728377],\n", " [-0.0374625 ],\n", " [-0.02560657],\n", " [-0.02452876],\n", " [-0.01806189],\n", " [-0.01482845],\n", " [-0.02991782],\n", " [-0.046085 ],\n", " [-0.06979687],\n", " [ 0.03367309],\n", " [-0.00405033],\n", " [-0.02021751],\n", " [ 0.00241654],\n", " [-0.03099563],\n", " [ 0.02828403],\n", " [-0.03638469],\n", " [-0.05794093],\n", " [-0.0374625 ],\n", " [ 0.01211685],\n", " [-0.02237314],\n", " [-0.03530688],\n", " [ 0.00996123],\n", " [-0.03961813],\n", " [ 0.07139652],\n", " [-0.07518593],\n", " [-0.00620595],\n", " [-0.04069594],\n", " [-0.04824063],\n", " [-0.02560657],\n", " [ 0.0519959 ],\n", " [ 0.00457217],\n", " [-0.06440781],\n", " [-0.01698407],\n", " [-0.05794093],\n", " [ 0.00996123],\n", " [ 0.08864151],\n", " [-0.00512814],\n", " [-0.06440781],\n", " [ 0.01750591],\n", " [-0.04500719],\n", " [ 0.02828403],\n", " [ 0.04121778],\n", " [ 0.06492964],\n", " [-0.03207344],\n", " [-0.07626374],\n", " [ 0.04984027],\n", " [ 0.04552903],\n", " [-0.00943939],\n", " [-0.03207344],\n", " [ 0.00457217],\n", " [ 0.02073935],\n", " [ 0.01427248],\n", " [ 0.11019775],\n", " [ 0.00133873],\n", " [ 0.05846277],\n", " [-0.02129532],\n", " [-0.0105172 ],\n", " [-0.04716281],\n", " [ 0.00457217],\n", " [ 0.01750591],\n", " [ 0.08109682],\n", " [ 0.0347509 ],\n", " [ 0.02397278],\n", " [-0.00836158],\n", " [-0.06117437],\n", " [-0.00189471],\n", " [-0.06225218],\n", " [ 0.0164281 ],\n", " [ 0.09618619],\n", " [-0.06979687],\n", " [-0.02129532],\n", " [-0.05362969],\n", " [ 0.0433734 ],\n", " [ 0.05630715],\n", " [-0.0816528 ],\n", " [ 0.04984027],\n", " [ 0.11127556],\n", " [ 0.06169621],\n", " [ 0.01427248],\n", " [ 0.04768465],\n", " [ 0.01211685],\n", " [ 0.00564998],\n", " [ 0.04660684],\n", " [ 0.12852056],\n", " [ 0.05954058],\n", " [ 0.09295276],\n", " [ 0.01535029],\n", " [-0.00512814],\n", " [ 0.0703187 ],\n", " [-0.00405033],\n", " [-0.00081689],\n", " [-0.04392938],\n", " [ 0.02073935],\n", " [ 0.06061839],\n", " [-0.0105172 ],\n", " [-0.03315126],\n", " [-0.06548562],\n", " [ 0.0433734 ],\n", " [-0.06225218],\n", " [ 0.06385183],\n", " [ 0.03043966],\n", " [ 0.07247433],\n", " [-0.0191397 ],\n", " [-0.06656343],\n", " [-0.06009656],\n", " [ 0.06924089],\n", " [ 0.05954058],\n", " [-0.02668438],\n", " [-0.02021751],\n", " [-0.046085 ],\n", " [ 0.07139652],\n", " [-0.07949718],\n", " [ 0.00996123],\n", " [-0.03854032],\n", " [ 0.01966154],\n", " [ 0.02720622],\n", " [-0.00836158],\n", " [-0.01590626],\n", " [ 0.00457217],\n", " [-0.04285156],\n", " [ 0.00564998],\n", " [-0.03530688],\n", " [ 0.02397278],\n", " [-0.01806189],\n", " [ 0.04229559],\n", " [-0.0547075 ],\n", " [-0.00297252],\n", " [-0.06656343],\n", " [-0.01267283],\n", " [-0.04177375],\n", " [-0.03099563],\n", " [-0.00512814],\n", " [-0.05901875],\n", " [ 0.0250506 ],\n", " [-0.046085 ],\n", " [ 0.00349435],\n", " [ 0.05415152],\n", " [-0.04500719],\n", " [-0.05794093],\n", " [-0.05578531],\n", " [ 0.00133873],\n", " [ 0.03043966],\n", " [ 0.00672779],\n", " [ 0.04660684],\n", " [ 0.02612841],\n", " [ 0.04552903],\n", " [ 0.04013997],\n", " [-0.01806189],\n", " [ 0.01427248],\n", " [ 0.03690653],\n", " [ 0.00349435],\n", " [-0.07087468],\n", " [-0.03315126],\n", " [ 0.09403057],\n", " [ 0.03582872],\n", " [ 0.03151747],\n", " [-0.06548562],\n", " [-0.04177375],\n", " [-0.03961813],\n", " [-0.03854032],\n", " [-0.02560657],\n", " [-0.02345095],\n", " [-0.06656343],\n", " [ 0.03259528],\n", " [-0.046085 ],\n", " [-0.02991782],\n", " [-0.01267283],\n", " [-0.01590626],\n", " [ 0.07139652],\n", " [-0.03099563],\n", " [ 0.00026092],\n", " [ 0.03690653],\n", " [ 0.03906215],\n", " [-0.01482845],\n", " [ 0.00672779],\n", " [-0.06871905],\n", " [-0.00943939],\n", " [ 0.01966154],\n", " [ 0.07462995],\n", " [-0.00836158],\n", " [-0.02345095],\n", " [-0.046085 ],\n", " [ 0.05415152],\n", " [-0.03530688],\n", " [-0.03207344],\n", " [-0.0816528 ],\n", " [ 0.04768465],\n", " [ 0.06061839],\n", " [ 0.05630715],\n", " [ 0.09834182],\n", " [ 0.05954058],\n", " [ 0.03367309],\n", " [ 0.05630715],\n", " [-0.06548562],\n", " [ 0.16085492],\n", " [-0.05578531],\n", " [-0.02452876],\n", " [-0.03638469],\n", " [-0.00836158],\n", " [-0.04177375],\n", " [ 0.12744274],\n", " [-0.07734155],\n", " [ 0.02828403],\n", " [-0.02560657],\n", " [-0.06225218],\n", " [-0.00081689],\n", " [ 0.08864151],\n", " [-0.03207344],\n", " [ 0.03043966],\n", " [ 0.00888341],\n", " [ 0.00672779],\n", " [-0.02021751],\n", " [-0.02452876],\n", " [-0.01159501],\n", " [ 0.02612841],\n", " [-0.05901875],\n", " [-0.03638469],\n", " [-0.02452876],\n", " [ 0.01858372],\n", " [-0.0902753 ],\n", " [-0.00512814],\n", " [-0.05255187],\n", " [-0.02237314],\n", " [-0.02021751],\n", " [-0.0547075 ],\n", " [-0.00620595],\n", " [-0.01698407],\n", " [ 0.05522933],\n", " [ 0.07678558],\n", " [ 0.01858372],\n", " [-0.02237314],\n", " [ 0.09295276],\n", " [-0.03099563],\n", " [ 0.03906215],\n", " [-0.06117437],\n", " [-0.00836158],\n", " [-0.0374625 ],\n", " [-0.01375064],\n", " [ 0.07355214],\n", " [-0.02452876],\n", " [ 0.03367309],\n", " [ 0.0347509 ],\n", " [-0.03854032],\n", " [-0.03961813],\n", " [-0.00189471],\n", " [-0.03099563],\n", " [-0.046085 ],\n", " [ 0.00133873],\n", " [ 0.06492964],\n", " [ 0.04013997],\n", " [-0.02345095],\n", " [ 0.05307371],\n", " [ 0.04013997],\n", " [-0.02021751],\n", " [ 0.01427248],\n", " [-0.03422907],\n", " [ 0.00672779],\n", " [ 0.00457217],\n", " [ 0.03043966],\n", " [ 0.0519959 ],\n", " [ 0.06169621],\n", " [-0.00728377],\n", " [ 0.00564998],\n", " [ 0.05415152],\n", " [-0.00836158],\n", " [ 0.114509 ],\n", " [ 0.06708527],\n", " [-0.05578531],\n", " [ 0.03043966],\n", " [-0.02560657],\n", " [ 0.10480869],\n", " [-0.00620595],\n", " [-0.04716281],\n", " [-0.04824063],\n", " [ 0.08540807],\n", " [-0.01267283],\n", " [-0.03315126],\n", " [-0.00728377],\n", " [-0.01375064],\n", " [ 0.05954058],\n", " [ 0.02181716],\n", " [ 0.01858372],\n", " [-0.01159501],\n", " [-0.00297252],\n", " [ 0.01750591],\n", " [-0.02991782],\n", " [-0.02021751],\n", " [-0.05794093],\n", " [ 0.06061839],\n", " [-0.04069594],\n", " [-0.07195249],\n", " [-0.05578531],\n", " [ 0.04552903],\n", " [-0.00943939],\n", " [-0.03315126],\n", " [ 0.04984027],\n", " [-0.08488624],\n", " [ 0.00564998],\n", " [ 0.02073935],\n", " [-0.00728377],\n", " [ 0.10480869],\n", " [-0.02452876],\n", " [-0.00620595],\n", " [-0.03854032],\n", " [ 0.13714305],\n", " [ 0.17055523],\n", " [ 0.00241654],\n", " [ 0.03798434],\n", " [-0.05794093],\n", " [-0.00943939],\n", " [-0.02345095],\n", " [-0.0105172 ],\n", " [-0.03422907],\n", " [-0.00297252],\n", " [ 0.06816308],\n", " [ 0.00996123],\n", " [ 0.00241654],\n", " [-0.03854032],\n", " [ 0.02612841],\n", " [-0.08919748],\n", " [ 0.06061839],\n", " [-0.02884001],\n", " [-0.02991782],\n", " [-0.0191397 ],\n", " [-0.04069594],\n", " [ 0.01535029],\n", " [-0.02452876],\n", " [ 0.00133873],\n", " [ 0.06924089],\n", " [-0.06979687],\n", " [-0.02991782],\n", " [-0.046085 ],\n", " [ 0.01858372],\n", " [ 0.00133873],\n", " [-0.03099563],\n", " [-0.00405033],\n", " [ 0.01535029],\n", " [ 0.02289497],\n", " [ 0.04552903],\n", " [-0.04500719],\n", " [-0.03315126],\n", " [ 0.097264 ],\n", " [ 0.05415152],\n", " [ 0.12313149],\n", " [-0.08057499],\n", " [ 0.09295276],\n", " [-0.05039625],\n", " [-0.01159501],\n", " [-0.0277622 ],\n", " [ 0.05846277],\n", " [ 0.08540807],\n", " [-0.00081689],\n", " [ 0.00672779],\n", " [ 0.00888341],\n", " [ 0.08001901],\n", " [ 0.07139652],\n", " [-0.02452876],\n", " [-0.0547075 ],\n", " [-0.03638469],\n", " [ 0.0164281 ]])" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "diabetes_X_train" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python [conda root]", "language": "python", "name": "conda-root-py" }, "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.2" } }, "nbformat": 4, "nbformat_minor": 0 }