{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Title : Ex: Polynomial Regression \n",
"- Goal: Create cubic polynomial least-squares regression\n",
"\n",
"## Description\n",
"\n",
"After fitting the model and getting the predictions, you should see the following plot: \n",
"\n",
"\n",
"\n",
"\n",
"\n",
"## Hints: \n",
"\n",
"Formulas in statsmodels\n",
"\n",
"sm.ols\n",
"\n",
"numpy vander\n",
"\n",
"Refer to lecture notebook.\n",
"\n",
"Do not change any other code except the blanks."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"import statsmodels.formula.api as sm\n",
"\n",
"%matplotlib inline "
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n", " | x | \n", "y | \n", "
---|---|---|
73 | \n", "0.006248 | \n", "17.329551 | \n", "
142 | \n", "0.104671 | \n", "15.268703 | \n", "
34 | \n", "0.246137 | \n", "15.394678 | \n", "
17 | \n", "0.420595 | \n", "12.743181 | \n", "
5 | \n", "0.455565 | \n", "15.480800 | \n", "