Upload files to "Tugas.Regression"
This commit is contained in:
parent
c195dd8fc6
commit
5581c4c8bf
@ -0,0 +1,532 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<p style=\"text-align:center\">\n",
|
||||
" <a href=\"https://skills.network\" target=\"_blank\">\n",
|
||||
" <img src=\"https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/assets/logos/SN_web_lightmode.png\" width=\"200\" alt=\"Skills Network Logo\">\n",
|
||||
" </a>\n",
|
||||
"</p>\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"# Polynomial Regression\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"Estimated time needed: **15** minutes\n",
|
||||
" \n",
|
||||
"\n",
|
||||
"## Objectives\n",
|
||||
"\n",
|
||||
"After completing this lab you will be able to:\n",
|
||||
"\n",
|
||||
"* Use scikit-learn to implement Polynomial Regression\n",
|
||||
"* Create a model, train it, test it and use the model\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<h1>Table of contents</h1>\n",
|
||||
"\n",
|
||||
"<div class=\"alert alert-block alert-info\" style=\"margin-top: 20px\">\n",
|
||||
" <ol>\n",
|
||||
" <li><a href=\"#download_data\">Downloading Data</a></li>\n",
|
||||
" <li><a href=\"#polynomial_regression\">Polynomial regression</a></li>\n",
|
||||
" <li><a href=\"#evaluation\">Evaluation</a></li>\n",
|
||||
" <li><a href=\"#practice\">Practice</a></li>\n",
|
||||
" </ol>\n",
|
||||
"</div>\n",
|
||||
"<br>\n",
|
||||
"<hr>\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Importing Needed packages\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"import pandas as pd\n",
|
||||
"import pylab as pl\n",
|
||||
"import numpy as np\n",
|
||||
"%matplotlib inline\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<h2 id=\"download_data\">Downloading Data</h2>\n",
|
||||
"To download the data, we will use !wget to download it from IBM Object Storage.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!wget -O FuelConsumption.csv https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/IBMDeveloperSkillsNetwork-ML0101EN-SkillsNetwork/labs/Module%202/data/FuelConsumptionCo2.csv"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"__Did you know?__ When it comes to Machine Learning, you will likely be working with large datasets. As a business, where can you host your data? IBM is offering a unique opportunity for businesses, with 10 Tb of IBM Cloud Object Storage: [Sign up now for free](https://www.ibm.com/us-en/cloud/object-storage?utm_source=skills_network&utm_content=in_lab_content_link&utm_id=Lab-IBMDeveloperSkillsNetwork-ML0101EN-SkillsNetwork)\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"\n",
|
||||
"## Understanding the Data\n",
|
||||
"\n",
|
||||
"### `FuelConsumption.csv`:\n",
|
||||
"We have downloaded a fuel consumption dataset, **`FuelConsumption.csv`**, which contains model-specific fuel consumption ratings and estimated carbon dioxide emissions for new light-duty vehicles for retail sale in Canada. [Dataset source](http://open.canada.ca/data/en/dataset/98f1a129-f628-4ce4-b24d-6f16bf24dd64)\n",
|
||||
"\n",
|
||||
"- **MODELYEAR** e.g. 2014\n",
|
||||
"- **MAKE** e.g. Acura\n",
|
||||
"- **MODEL** e.g. ILX\n",
|
||||
"- **VEHICLE CLASS** e.g. SUV\n",
|
||||
"- **ENGINE SIZE** e.g. 4.7\n",
|
||||
"- **CYLINDERS** e.g 6\n",
|
||||
"- **TRANSMISSION** e.g. A6\n",
|
||||
"- **FUEL CONSUMPTION in CITY(L/100 km)** e.g. 9.9\n",
|
||||
"- **FUEL CONSUMPTION in HWY (L/100 km)** e.g. 8.9\n",
|
||||
"- **FUEL CONSUMPTION COMB (L/100 km)** e.g. 9.2\n",
|
||||
"- **CO2 EMISSIONS (g/km)** e.g. 182 --> low --> 0\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Reading the data in\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"df = pd.read_csv(\"FuelConsumption.csv\")\n",
|
||||
"\n",
|
||||
"# take a look at the dataset\n",
|
||||
"df.head()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Let's select some features that we want to use for regression.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"cdf = df[['ENGINESIZE','CYLINDERS','FUELCONSUMPTION_COMB','CO2EMISSIONS']]\n",
|
||||
"cdf.head(9)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Let's plot Emission values with respect to Engine size:\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"plt.scatter(cdf.ENGINESIZE, cdf.CO2EMISSIONS, color='blue')\n",
|
||||
"plt.xlabel(\"Engine size\")\n",
|
||||
"plt.ylabel(\"Emission\")\n",
|
||||
"plt.show()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"#### Creating train and test dataset\n",
|
||||
"Train/Test Split involves splitting the dataset into training and testing sets respectively, which are mutually exclusive. After which, you train with the training set and test with the testing set.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"msk = np.random.rand(len(df)) < 0.8\n",
|
||||
"train = cdf[msk]\n",
|
||||
"test = cdf[~msk]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<h2 id=\"polynomial_regression\">Polynomial regression</h2>\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Sometimes, the trend of data is not really linear, and looks curvy. In this case we can use Polynomial regression methods. In fact, many different regressions exist that can be used to fit whatever the dataset looks like, such as quadratic, cubic, and so on, and it can go on and on to infinite degrees.\n",
|
||||
"\n",
|
||||
"In essence, we can call all of these, polynomial regression, where the relationship between the independent variable x and the dependent variable y is modeled as an nth degree polynomial in x. Lets say you want to have a polynomial regression (let's make 2 degree polynomial):\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"$$y = b + \\theta_1 x + \\theta_2 x^2$$\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"Now, the question is: how we can fit our data on this equation while we have only x values, such as __Engine Size__? \n",
|
||||
"Well, we can create a few additional features: 1, $x$, and $x^2$.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"__PolynomialFeatures()__ function in Scikit-learn library, drives a new feature sets from the original feature set. That is, a matrix will be generated consisting of all polynomial combinations of the features with degree less than or equal to the specified degree. For example, lets say the original feature set has only one feature, _ENGINESIZE_. Now, if we select the degree of the polynomial to be 2, then it generates 3 features, degree=0, degree=1 and degree=2: \n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from sklearn.preprocessing import PolynomialFeatures\n",
|
||||
"from sklearn import linear_model\n",
|
||||
"train_x = np.asanyarray(train[['ENGINESIZE']])\n",
|
||||
"train_y = np.asanyarray(train[['CO2EMISSIONS']])\n",
|
||||
"\n",
|
||||
"test_x = np.asanyarray(test[['ENGINESIZE']])\n",
|
||||
"test_y = np.asanyarray(test[['CO2EMISSIONS']])\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"poly = PolynomialFeatures(degree=2)\n",
|
||||
"train_x_poly = poly.fit_transform(train_x)\n",
|
||||
"train_x_poly"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"**fit_transform** takes our x values, and output a list of our data raised from power of 0 to power of 2 (since we set the degree of our polynomial to 2). \n",
|
||||
"\n",
|
||||
"The equation and the sample example is displayed below. \n",
|
||||
"\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"\\begin{bmatrix}\n",
|
||||
" v_1\\\\\\\\\\\\\n",
|
||||
" v_2\\\\\\\\\n",
|
||||
" \\vdots\\\\\\\\\n",
|
||||
" v_n\n",
|
||||
"\\end{bmatrix}\\longrightarrow \\begin{bmatrix}\n",
|
||||
" [ 1 & v_1 & v_1^2]\\\\\\\\\n",
|
||||
" [ 1 & v_2 & v_2^2]\\\\\\\\\n",
|
||||
" \\vdots & \\vdots & \\vdots\\\\\\\\\n",
|
||||
" [ 1 & v_n & v_n^2]\n",
|
||||
"\\end{bmatrix}\n",
|
||||
"$$\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"\\begin{bmatrix}\n",
|
||||
" 2.\\\\\\\\\n",
|
||||
" 2.4\\\\\\\\\n",
|
||||
" 1.5\\\\\\\\\n",
|
||||
" \\vdots\n",
|
||||
"\\end{bmatrix} \\longrightarrow \\begin{bmatrix}\n",
|
||||
" [ 1 & 2. & 4.]\\\\\\\\\n",
|
||||
" [ 1 & 2.4 & 5.76]\\\\\\\\\n",
|
||||
" [ 1 & 1.5 & 2.25]\\\\\\\\\n",
|
||||
" \\vdots & \\vdots & \\vdots\\\\\\\\\n",
|
||||
"\\end{bmatrix}\n",
|
||||
"$$\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"It looks like feature sets for multiple linear regression analysis, right? Yes. It Does. \n",
|
||||
"Indeed, Polynomial regression is a special case of linear regression, with the main idea of how do you select your features. Just consider replacing the $x$ with $x_1$, $x_1^2$ with $x_2$, and so on. Then the 2nd degree equation would be turn into:\n",
|
||||
"\n",
|
||||
"$$y = b + \\theta_1 x_1 + \\theta_2 x_2$$\n",
|
||||
"\n",
|
||||
"Now, we can deal with it as a 'linear regression' problem. Therefore, this polynomial regression is considered to be a special case of traditional multiple linear regression. So, you can use the same mechanism as linear regression to solve such problems. \n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"so we can use __LinearRegression()__ function to solve it:\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"clf = linear_model.LinearRegression()\n",
|
||||
"train_y_ = clf.fit(train_x_poly, train_y)\n",
|
||||
"# The coefficients\n",
|
||||
"print ('Coefficients: ', clf.coef_)\n",
|
||||
"print ('Intercept: ',clf.intercept_)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"As mentioned before, __Coefficient__ and __Intercept__ , are the parameters of the fit curvy line. \n",
|
||||
"Given that it is a typical multiple linear regression, with 3 parameters, and knowing that the parameters are the intercept and coefficients of hyperplane, sklearn has estimated them from our new set of feature sets. Lets plot it:\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"plt.scatter(train.ENGINESIZE, train.CO2EMISSIONS, color='blue')\n",
|
||||
"XX = np.arange(0.0, 10.0, 0.1)\n",
|
||||
"yy = clf.intercept_[0]+ clf.coef_[0][1]*XX+ clf.coef_[0][2]*np.power(XX, 2)\n",
|
||||
"plt.plot(XX, yy, '-r' )\n",
|
||||
"plt.xlabel(\"Engine size\")\n",
|
||||
"plt.ylabel(\"Emission\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<h2 id=\"evaluation\">Evaluation</h2>\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from sklearn.metrics import r2_score\n",
|
||||
"\n",
|
||||
"test_x_poly = poly.transform(test_x)\n",
|
||||
"test_y_ = clf.predict(test_x_poly)\n",
|
||||
"\n",
|
||||
"print(\"Mean absolute error: %.2f\" % np.mean(np.absolute(test_y_ - test_y)))\n",
|
||||
"print(\"Residual sum of squares (MSE): %.2f\" % np.mean((test_y_ - test_y) ** 2))\n",
|
||||
"print(\"R2-score: %.2f\" % r2_score(test_y,test_y_ ) )"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<h2 id=\"practice\">Practice</h2>\n",
|
||||
"Try to use a polynomial regression with the dataset but this time with degree three (cubic). Does it result in better accuracy?\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# write your code here\n",
|
||||
"import numpy as np\n",
|
||||
"import pandas as pd\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"from sklearn import linear_model\n",
|
||||
"from sklearn.preprocessing import PolynomialFeatures\n",
|
||||
"from sklearn.metrics import r2_score\n",
|
||||
"from sklearn.model_selection import train_test_split\n",
|
||||
"\n",
|
||||
"df = pd.read_csv(\"FuelConsumptionCo2.csv\")\n",
|
||||
"cdf = df[['ENGINESIZE', 'CO2EMISSIONS']]\n",
|
||||
"\n",
|
||||
"train, test = train_test_split(cdf, test_size=0.2, random_state=42)\n",
|
||||
"train_x = np.asanyarray(train[['ENGINESIZE']])\n",
|
||||
"train_y = np.asanyarray(train[['CO2EMISSIONS']])\n",
|
||||
"test_x = np.asanyarray(test[['ENGINESIZE']])\n",
|
||||
"test_y = np.asanyarray(test[['CO2EMISSIONS']])\n",
|
||||
"\n",
|
||||
"poly3 = PolynomialFeatures(degree=3)\n",
|
||||
"train_x_poly3 = poly3.fit_transform(train_x)\n",
|
||||
"\n",
|
||||
"clf3 = linear_model.LinearRegression()\n",
|
||||
"clf3.fit(train_x_poly3, train_y)\n",
|
||||
"\n",
|
||||
"print(\"Coefficients: \", clf3.coef_)\n",
|
||||
"print(\"Intercept: \", clf3.intercept_)\n",
|
||||
"\n",
|
||||
"plt.scatter(train.ENGINESIZE, train.CO2EMISSIONS, color='blue')\n",
|
||||
"XX = np.arange(0.0, 10.0, 0.1)\n",
|
||||
"YY = (clf3.intercept_[0]\n",
|
||||
" + clf3.coef_[0][1]*XX\n",
|
||||
" + clf3.coef_[0][2]*np.power(XX, 2)\n",
|
||||
" + clf3.coef_[0][3]*np.power(XX, 3))\n",
|
||||
"plt.plot(XX, YY, '-r')\n",
|
||||
"plt.xlabel(\"Engine size\")\n",
|
||||
"plt.ylabel(\"Emission\")\n",
|
||||
"plt.title(\"Polynomial Regression (Degree 3)\")\n",
|
||||
"plt.show()\n",
|
||||
"\n",
|
||||
"test_x_poly3 = poly3.transform(test_x)\n",
|
||||
"test_y3_ = clf3.predict(test_x_poly3)\n",
|
||||
"\n",
|
||||
"print(\"Mean absolute error: %.2f\" % np.mean(np.absolute(test_y3_ - test_y)))\n",
|
||||
"print(\"Residual sum of squares (MSE): %.2f\" % np.mean((test_y3_ - test_y) ** 2))\n",
|
||||
"print(\"R2-score: %.2f\" % r2_score(test_y, test_y3_))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<details><summary>Click here for the solution</summary>\n",
|
||||
"\n",
|
||||
"```python \n",
|
||||
"poly3 = PolynomialFeatures(degree=3)\n",
|
||||
"train_x_poly3 = poly3.fit_transform(train_x)\n",
|
||||
"clf3 = linear_model.LinearRegression()\n",
|
||||
"train_y3_ = clf3.fit(train_x_poly3, train_y)\n",
|
||||
"\n",
|
||||
"# The coefficients\n",
|
||||
"print ('Coefficients: ', clf3.coef_)\n",
|
||||
"print ('Intercept: ',clf3.intercept_)\n",
|
||||
"plt.scatter(train.ENGINESIZE, train.CO2EMISSIONS, color='blue')\n",
|
||||
"XX = np.arange(0.0, 10.0, 0.1)\n",
|
||||
"yy = clf3.intercept_[0]+ clf3.coef_[0][1]*XX + clf3.coef_[0][2]*np.power(XX, 2) + clf3.coef_[0][3]*np.power(XX, 3)\n",
|
||||
"plt.plot(XX, yy, '-r' )\n",
|
||||
"plt.xlabel(\"Engine size\")\n",
|
||||
"plt.ylabel(\"Emission\")\n",
|
||||
"test_x_poly3 = poly3.transform(test_x)\n",
|
||||
"test_y3_ = clf3.predict(test_x_poly3)\n",
|
||||
"print(\"Mean absolute error: %.2f\" % np.mean(np.absolute(test_y3_ - test_y)))\n",
|
||||
"print(\"Residual sum of squares (MSE): %.2f\" % np.mean((test_y3_ - test_y) ** 2))\n",
|
||||
"print(\"R2-score: %.2f\" % r2_score(test_y,test_y3_ ) )\n",
|
||||
"\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"</details>\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<h2>Want to learn more?</h2>\n",
|
||||
"\n",
|
||||
"IBM SPSS Modeler is a comprehensive analytics platform that has many machine learning algorithms. It has been designed to bring predictive intelligence to decisions made by individuals, by groups, by systems – by your enterprise as a whole. A free trial is available through this course, available here: <a href=\"https://www.ibm.com/analytics/spss-statistics-software?utm_source=skills_network&utm_content=in_lab_content_link&utm_id=Lab-IBMDeveloperSkillsNetwork-ML0101EN-SkillsNetwork\">SPSS Modeler</a>\n",
|
||||
"\n",
|
||||
"Also, you can use Watson Studio to run these notebooks faster with bigger datasets. Watson Studio is IBM's leading cloud solution for data scientists, built by data scientists. With Jupyter notebooks, RStudio, Apache Spark and popular libraries pre-packaged in the cloud, Watson Studio enables data scientists to collaborate on their projects without having to install anything. Join the fast-growing community of Watson Studio users today with a free account at <a href=\"https://www.ibm.com/cloud/watson-studio?utm_source=skills_network&utm_content=in_lab_content_link&utm_id=Lab-IBMDeveloperSkillsNetwork-ML0101EN-SkillsNetwork\">Watson Studio</a>\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Thank you for completing this lab!\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"## Author\n",
|
||||
"\n",
|
||||
"Saeed Aghabozorgi\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"### Other Contributors\n",
|
||||
"\n",
|
||||
"<a href=\"https://www.linkedin.com/in/joseph-s-50398b136/\" target=\"_blank\">Joseph Santarcangelo</a>\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"## <h3 align=\"center\"> © IBM Corporation 2020. All rights reserved. <h3/>\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"<!--## Change Log\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"| Date (YYYY-MM-DD) | Version | Changed By | Change Description |\n",
|
||||
"|---|---|---|---|\n",
|
||||
"| 2021-01-11 | 2.3 | Lakshmi | Changed R2-score calculation in polynomial regression |\n",
|
||||
"| 2020-11-04 | 2.2 | Lakshmi | Made changes in markdown of equations |\n",
|
||||
"| 2020-11-03 | 2.1 | Lakshmi | Made changes in URL |\n",
|
||||
"| 2020-08-27 | 2.0 | Lavanya | Moved lab to course repo in GitLab |\n",
|
||||
"| | | | |\n",
|
||||
"| | | | | --!>\n",
|
||||
"\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python",
|
||||
"language": "python",
|
||||
"name": "conda-env-python-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.7.12"
|
||||
},
|
||||
"prev_pub_hash": "4dc110debac287dfd374a575573c16e62a80a935b3bbe2b2f6d5a0598e6e33f6"
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
@ -0,0 +1,448 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<p style=\"text-align:center\">\n",
|
||||
" <a href=\"https://skills.network\" target=\"_blank\">\n",
|
||||
" <img src=\"https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/assets/logos/SN_web_lightmode.png\" width=\"200\" alt=\"Skills Network Logo\">\n",
|
||||
" </a>\n",
|
||||
"</p>\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"# Multiple Linear Regression\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"Estimated time needed: **15** minutes\n",
|
||||
" \n",
|
||||
"\n",
|
||||
"## Objectives\n",
|
||||
"\n",
|
||||
"After completing this lab you will be able to:\n",
|
||||
"\n",
|
||||
"* Use scikit-learn to implement Multiple Linear Regression\n",
|
||||
"* Create a model, train it, test it and use the model\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<h1>Table of contents</h1>\n",
|
||||
"\n",
|
||||
"<div class=\"alert alert-block alert-info\" style=\"margin-top: 20px\">\n",
|
||||
" <ol>\n",
|
||||
" <li><a href=\"#understanding-data\">Understanding the Data</a></li>\n",
|
||||
" <li><a href=\"#reading_data\">Reading the Data in</a></li>\n",
|
||||
" <li><a href=\"#multiple_regression_model\">Multiple Regression Model</a></li>\n",
|
||||
" <li><a href=\"#prediction\">Prediction</a></li>\n",
|
||||
" <li><a href=\"#practice\">Practice</a></li>\n",
|
||||
" </ol>\n",
|
||||
"</div>\n",
|
||||
"<br>\n",
|
||||
"<hr>\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Importing Needed packages\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"import pandas as pd\n",
|
||||
"import pylab as pl\n",
|
||||
"import numpy as np\n",
|
||||
"%matplotlib inline"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Downloading Data\n",
|
||||
"To download the data, we will use !wget to download it from IBM Object Storage.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"--2025-10-20 06:45:18-- https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/IBMDeveloperSkillsNetwork-ML0101EN-SkillsNetwork/labs/Module%202/data/FuelConsumptionCo2.csv\n",
|
||||
"Resolving cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud (cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud)... 169.63.118.104, 169.63.118.104\n",
|
||||
"Connecting to cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud (cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud)|169.63.118.104|:443... connected.\n",
|
||||
"HTTP request sent, awaiting response... 200 OK\n",
|
||||
"Length: 72629 (71K) [text/csv]\n",
|
||||
"Saving to: ‘FuelConsumption.csv’\n",
|
||||
"\n",
|
||||
"FuelConsumption.csv 100%[===================>] 70.93K --.-KB/s in 0.005s \n",
|
||||
"\n",
|
||||
"2025-10-20 06:45:19 (15.3 MB/s) - ‘FuelConsumption.csv’ saved [72629/72629]\n",
|
||||
"\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"!wget -O FuelConsumption.csv https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/IBMDeveloperSkillsNetwork-ML0101EN-SkillsNetwork/labs/Module%202/data/FuelConsumptionCo2.csv"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"\n",
|
||||
"<h2 id=\"understanding_data\">Understanding the Data</h2>\n",
|
||||
"\n",
|
||||
"### `FuelConsumption.csv`:\n",
|
||||
"We have downloaded a fuel consumption dataset, **`FuelConsumption.csv`**, which contains model-specific fuel consumption ratings and estimated carbon dioxide emissions for new light-duty vehicles for retail sale in Canada. [Dataset source](http://open.canada.ca/data/en/dataset/98f1a129-f628-4ce4-b24d-6f16bf24dd64)\n",
|
||||
"\n",
|
||||
"- **MODELYEAR** e.g. 2014\n",
|
||||
"- **MAKE** e.g. Acura\n",
|
||||
"- **MODEL** e.g. ILX\n",
|
||||
"- **VEHICLE CLASS** e.g. SUV\n",
|
||||
"- **ENGINE SIZE** e.g. 4.7\n",
|
||||
"- **CYLINDERS** e.g 6\n",
|
||||
"- **TRANSMISSION** e.g. A6\n",
|
||||
"- **FUELTYPE** e.g. z\n",
|
||||
"- **FUEL CONSUMPTION in CITY(L/100 km)** e.g. 9.9\n",
|
||||
"- **FUEL CONSUMPTION in HWY (L/100 km)** e.g. 8.9\n",
|
||||
"- **FUEL CONSUMPTION COMB (L/100 km)** e.g. 9.2\n",
|
||||
"- **CO2 EMISSIONS (g/km)** e.g. 182 --> low --> 0\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<h2 id=\"reading_data\">Reading the data in</h2>\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"df = pd.read_csv(\"FuelConsumption.csv\")\n",
|
||||
"\n",
|
||||
"# take a look at the dataset\n",
|
||||
"df.head()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Let's select some features that we want to use for regression.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"cdf = df[['ENGINESIZE','CYLINDERS','FUELCONSUMPTION_CITY','FUELCONSUMPTION_HWY','FUELCONSUMPTION_COMB','CO2EMISSIONS']]\n",
|
||||
"cdf.head(9)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Let's plot Emission values with respect to Engine size:\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "NameError",
|
||||
"evalue": "name 'plt' is not defined",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
||||
"\u001b[0;32m/tmp/ipykernel_3917/181093676.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mplt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mscatter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcdf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mENGINESIZE\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcdf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mCO2EMISSIONS\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcolor\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'blue'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mplt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mxlabel\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Engine size\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mplt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mylabel\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Emission\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mplt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mshow\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
||||
"\u001b[0;31mNameError\u001b[0m: name 'plt' is not defined"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"plt.scatter(cdf.ENGINESIZE, cdf.CO2EMISSIONS, color='blue')\n",
|
||||
"plt.xlabel(\"Engine size\")\n",
|
||||
"plt.ylabel(\"Emission\")\n",
|
||||
"plt.show()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"#### Creating train and test dataset\n",
|
||||
"Train/Test Split involves splitting the dataset into training and testing sets respectively, which are mutually exclusive. After which, you train with the training set and test with the testing set. \n",
|
||||
"This will provide a more accurate evaluation on out-of-sample accuracy because the testing dataset is not part of the dataset that have been used to train the model. Therefore, it gives us a better understanding of how well our model generalizes on new data.\n",
|
||||
"\n",
|
||||
"We know the outcome of each data point in the testing dataset, making it great to test with! Since this data has not been used to train the model, the model has no knowledge of the outcome of these data points. So, in essence, it is truly an out-of-sample testing.\n",
|
||||
"\n",
|
||||
"Let's split our dataset into train and test sets. Around 80% of the entire dataset will be used for training and 20% for testing. We create a mask to select random rows using the __np.random.rand()__ function: \n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"msk = np.random.rand(len(df)) < 0.8\n",
|
||||
"train = cdf[msk]\n",
|
||||
"test = cdf[~msk]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"#### Train data distribution\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"plt.scatter(train.ENGINESIZE, train.CO2EMISSIONS, color='blue')\n",
|
||||
"plt.xlabel(\"Engine size\")\n",
|
||||
"plt.ylabel(\"Emission\")\n",
|
||||
"plt.show()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<h2 id=\"multiple_regression_model\">Multiple Regression Model</h2>\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"In reality, there are multiple variables that impact the co2emission. When more than one independent variable is present, the process is called multiple linear regression. An example of multiple linear regression is predicting co2emission using the features FUELCONSUMPTION_COMB, EngineSize and Cylinders of cars. The good thing here is that multiple linear regression model is the extension of the simple linear regression model.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from sklearn import linear_model\n",
|
||||
"regr = linear_model.LinearRegression()\n",
|
||||
"x = np.asanyarray(train[['ENGINESIZE','CYLINDERS','FUELCONSUMPTION_COMB']])\n",
|
||||
"y = np.asanyarray(train[['CO2EMISSIONS']])\n",
|
||||
"regr.fit (x, y)\n",
|
||||
"# The coefficients\n",
|
||||
"print ('Coefficients: ', regr.coef_)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"As mentioned before, __Coefficient__ and __Intercept__ are the parameters of the fitted line. \n",
|
||||
"Given that it is a multiple linear regression model with 3 parameters and that the parameters are the intercept and coefficients of the hyperplane, sklearn can estimate them from our data. Scikit-learn uses plain Ordinary Least Squares method to solve this problem.\n",
|
||||
"\n",
|
||||
"#### Ordinary Least Squares (OLS)\n",
|
||||
"OLS is a method for estimating the unknown parameters in a linear regression model. OLS chooses the parameters of a linear function of a set of explanatory variables by minimizing the sum of the squares of the differences between the target dependent variable and those predicted by the linear function. In other words, it tries to minimizes the sum of squared errors (SSE) or mean squared error (MSE) between the target variable (y) and our predicted output ($\\hat{y}$) over all samples in the dataset.\n",
|
||||
"\n",
|
||||
"OLS can find the best parameters using of the following methods:\n",
|
||||
"* Solving the model parameters analytically using closed-form equations\n",
|
||||
"* Using an optimization algorithm (Gradient Descent, Stochastic Gradient Descent, Newton’s Method, etc.)\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<h2 id=\"prediction\">Prediction</h2>\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"y_hat= regr.predict(test[['ENGINESIZE','CYLINDERS','FUELCONSUMPTION_COMB']])\n",
|
||||
"x = np.asanyarray(test[['ENGINESIZE','CYLINDERS','FUELCONSUMPTION_COMB']])\n",
|
||||
"y = np.asanyarray(test[['CO2EMISSIONS']])\n",
|
||||
"print(\"Mean Squared Error (MSE) : %.2f\"\n",
|
||||
" % np.mean((y_hat - y) ** 2))\n",
|
||||
"\n",
|
||||
"# Explained variance score: 1 is perfect prediction\n",
|
||||
"print('Variance score: %.2f' % regr.score(x, y))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"__Explained variance regression score:__ \n",
|
||||
"Let $\\hat{y}$ be the estimated target output, y the corresponding (correct) target output, and Var be the Variance (the square of the standard deviation). Then the explained variance is estimated as follows:\n",
|
||||
"\n",
|
||||
"$\\texttt{explainedVariance}(y, \\hat{y}) = 1 - \\frac{Var\\{ y - \\hat{y}\\}}{Var\\{y\\}}$ \n",
|
||||
"The best possible score is 1.0, the lower values are worse.\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<h2 id=\"practice\">Practice</h2>\n",
|
||||
"Try to use a multiple linear regression with the same dataset, but this time use FUELCONSUMPTION_CITY and FUELCONSUMPTION_HWY instead of FUELCONSUMPTION_COMB. Does it result in better accuracy?\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Coefficients: [[11.23567565 7.0089373 5.59604353 3.81386072]]\n",
|
||||
"Residual sum of squares: 511.51\n",
|
||||
"Variance score: 0.88\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import pandas as pd\n",
|
||||
"import numpy as np\n",
|
||||
"from sklearn import linear_model\n",
|
||||
"from sklearn.model_selection import train_test_split\n",
|
||||
"\n",
|
||||
"df = pd.read_csv(\"FuelConsumptionCo2.csv\")\n",
|
||||
"train, test = train_test_split(df, test_size=0.2, random_state=42)\n",
|
||||
"\n",
|
||||
"regr = linear_model.LinearRegression()\n",
|
||||
"x_train = np.asanyarray(train[['ENGINESIZE', 'CYLINDERS', 'FUELCONSUMPTION_CITY', 'FUELCONSUMPTION_HWY']])\n",
|
||||
"y_train = np.asanyarray(train[['CO2EMISSIONS']])\n",
|
||||
"regr.fit(x_train, y_train)\n",
|
||||
"print('Coefficients:', regr.coef_)\n",
|
||||
"\n",
|
||||
"x_test = np.asanyarray(test[['ENGINESIZE', 'CYLINDERS', 'FUELCONSUMPTION_CITY', 'FUELCONSUMPTION_HWY']])\n",
|
||||
"y_test = np.asanyarray(test[['CO2EMISSIONS']])\n",
|
||||
"y_pred = regr.predict(x_test)\n",
|
||||
"\n",
|
||||
"print(\"Residual sum of squares: %.2f\" % np.mean((y_pred - y_test) ** 2))\n",
|
||||
"print(\"Variance score: %.2f\" % regr.score(x_test, y_test))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<details><summary>Click here for the solution</summary>\n",
|
||||
"\n",
|
||||
"```python\n",
|
||||
"regr = linear_model.LinearRegression()\n",
|
||||
"x = np.asanyarray(train[['ENGINESIZE','CYLINDERS','FUELCONSUMPTION_CITY','FUELCONSUMPTION_HWY']])\n",
|
||||
"y = np.asanyarray(train[['CO2EMISSIONS']])\n",
|
||||
"regr.fit (x, y)\n",
|
||||
"print ('Coefficients: ', regr.coef_)\n",
|
||||
"y_= regr.predict(test[['ENGINESIZE','CYLINDERS','FUELCONSUMPTION_CITY','FUELCONSUMPTION_HWY']])\n",
|
||||
"x = np.asanyarray(test[['ENGINESIZE','CYLINDERS','FUELCONSUMPTION_CITY','FUELCONSUMPTION_HWY']])\n",
|
||||
"y = np.asanyarray(test[['CO2EMISSIONS']])\n",
|
||||
"print(\"Residual sum of squares: %.2f\"% np.mean((y_ - y) ** 2))\n",
|
||||
"print('Variance score: %.2f' % regr.score(x, y))\n",
|
||||
"\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"</details>\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Thank you for completing this lab!\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"## Author\n",
|
||||
"\n",
|
||||
"Saeed Aghabozorgi\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"### Other Contributors\n",
|
||||
"\n",
|
||||
"<a href=\"https://www.linkedin.com/in/joseph-s-50398b136/\" target=\"_blank\">Joseph Santarcangelo</a>\n",
|
||||
"\n",
|
||||
"## <h3 align=\"center\"> © IBM Corporation 2020. All rights reserved. <h3/>\n",
|
||||
" \n",
|
||||
"<!--\n",
|
||||
"\n",
|
||||
"## Change Log\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"| Date (YYYY-MM-DD) | Version | Changed By | Change Description |\n",
|
||||
"|---|---|---|---|\n",
|
||||
"| 2020-11-03 | 2.1 | Lakshmi | Made changes in URL |\n",
|
||||
"| 2020-08-27 | 2.0 | Lavanya | Moved lab to course repo in GitLab |\n",
|
||||
"| | | | |\n",
|
||||
"| | | | |\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"--!>\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python",
|
||||
"language": "python",
|
||||
"name": "conda-env-python-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.7.12"
|
||||
},
|
||||
"prev_pub_hash": "c1170d4cb1c9bbce7dbbef74b645fc6b265a5aaf4ce89c4ac861feed8769ed99"
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user