From d7498f35dd22d0f0c761a036762731dd81cc2716 Mon Sep 17 00:00:00 2001 From: Gianluca Teti <51110452+gteti@users.noreply.github.com> Date: Mon, 14 Aug 2023 19:34:47 +0200 Subject: [PATCH 1/3] Update 01_the_machine_learning_landscape.ipynb Fix SSL error when doing the read directly --- 01_the_machine_learning_landscape.ipynb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/01_the_machine_learning_landscape.ipynb b/01_the_machine_learning_landscape.ipynb index 1c748ec9..30d964ee 100644 --- a/01_the_machine_learning_landscape.ipynb +++ b/01_the_machine_learning_landscape.ipynb @@ -153,7 +153,18 @@ "\n", "# Download and prepare the data\n", "data_root = \"https://github.com/ageron/data/raw/main/\"\n", - "lifesat = pd.read_csv(data_root + \"lifesat/lifesat.csv\")\n", + "url = data_root + "lifesat/lifesat.csv", + "\n", + "# Disable verification of SSL certificate\n", + "ssl_context = ssl.create_default_context()\n", + "ssl_context.check_hostname = False\n", + "ssl_context.verify_mode = ssl.CERT_NONE\n", + "\n", + "# Download CSV file\n", + "response = urllib.request.urlopen(url, context=ssl_context)\n", + "\n", + "# Read the CSV data\n", + "lifesat = pd.read_csv(response)\n", "X = lifesat[[\"GDP per capita (USD)\"]].values\n", "y = lifesat[[\"Life satisfaction\"]].values\n", "\n", From e85c455ecd3651a1a8ea02564307e187ba68b7db Mon Sep 17 00:00:00 2001 From: Gianluca Teti <51110452+gteti@users.noreply.github.com> Date: Mon, 14 Aug 2023 19:36:27 +0200 Subject: [PATCH 2/3] Update 01_the_machine_learning_landscape.ipynb Bugfix for url --- 01_the_machine_learning_landscape.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/01_the_machine_learning_landscape.ipynb b/01_the_machine_learning_landscape.ipynb index 30d964ee..4b983df5 100644 --- a/01_the_machine_learning_landscape.ipynb +++ b/01_the_machine_learning_landscape.ipynb @@ -153,7 +153,7 @@ "\n", "# Download and prepare the data\n", "data_root = \"https://github.com/ageron/data/raw/main/\"\n", - "url = data_root + "lifesat/lifesat.csv", + "url = data_root + 'lifesat/lifesat.csv'\n", "\n", "# Disable verification of SSL certificate\n", "ssl_context = ssl.create_default_context()\n", From edf93a1308441fe83d0926aaa8ebf0678ba125aa Mon Sep 17 00:00:00 2001 From: Gianluca Teti <51110452+gteti@users.noreply.github.com> Date: Tue, 15 Aug 2023 19:28:30 +0200 Subject: [PATCH 3/3] Update 01_the_machine_learning_landscape.ipynb Added SSL import --- 01_the_machine_learning_landscape.ipynb | 1 + 1 file changed, 1 insertion(+) diff --git a/01_the_machine_learning_landscape.ipynb b/01_the_machine_learning_landscape.ipynb index 4b983df5..f9241959 100644 --- a/01_the_machine_learning_landscape.ipynb +++ b/01_the_machine_learning_landscape.ipynb @@ -149,6 +149,7 @@ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", + "import ssl\n", "from sklearn.linear_model import LinearRegression\n", "\n", "# Download and prepare the data\n",