Spaces:
Sleeping
Sleeping
Upload 35 files
Browse files- .gitattributes +10 -0
- pages/modules/Module_01/Module_01.ipynb +90 -0
- pages/modules/Module_01/Overview.jpg +3 -0
- pages/modules/Module_01/Overview.txt +13 -0
- pages/modules/Module_02/Module_02.ipynb +158 -0
- pages/modules/Module_02/Overview.jpg +3 -0
- pages/modules/Module_02/Overview.txt +12 -0
- pages/modules/Module_03/Module_03.ipynb +122 -0
- pages/modules/Module_03/Overview.jpg +3 -0
- pages/modules/Module_03/Overview.txt +12 -0
- pages/modules/Module_04/Module_04.ipynb +116 -0
- pages/modules/Module_04/Overview.jpg +3 -0
- pages/modules/Module_04/Overview.txt +10 -0
- pages/modules/Module_05/Module_05.ipynb +107 -0
- pages/modules/Module_05/Overview.jpg +3 -0
- pages/modules/Module_05/Overview.txt +12 -0
- pages/modules/Module_06/Module_06.ipynb +144 -0
- pages/modules/Module_06/Overview.jpg +3 -0
- pages/modules/Module_06/Overview.txt +15 -0
- pages/modules/Module_07/Module_07.ipynb +91 -0
- pages/modules/Module_07/Overview.jpg +3 -0
- pages/modules/Module_07/Overview.txt +12 -0
- pages/modules/Module_08/Module_08.ipynb +124 -0
- pages/modules/Module_08/Overview.jpg +3 -0
- pages/modules/Module_08/Overview.txt +17 -0
- pages/modules/Module_09/Module_09.ipynb +157 -0
- pages/modules/Module_09/Overview.jpg +3 -0
- pages/modules/Module_09/Overview.txt +18 -0
- pages/modules/Module_10/Module_10.ipynb +119 -0
- pages/modules/Module_10/Overview.jpg +3 -0
- pages/modules/Module_10/Overview.txt +17 -0
- pages/modules/Module_11/Module_11.ipynb +0 -0
- pages/modules/Module_11/Overview.jpg +0 -0
- pages/modules/Module_11/Overview.txt +16 -0
- pages/modules/Overview/Overview.jpg +0 -0
- pages/modules/Overview/Overview.txt +15 -0
.gitattributes
CHANGED
|
@@ -39,3 +39,13 @@ assets/thumbs_up.gif filter=lfs diff=lfs merge=lfs -text
|
|
| 39 |
assets/TOK.jpg filter=lfs diff=lfs merge=lfs -text
|
| 40 |
pages/assets/ascend.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 41 |
pages/assets/juicy_fruit.mp3 filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
assets/TOK.jpg filter=lfs diff=lfs merge=lfs -text
|
| 40 |
pages/assets/ascend.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 41 |
pages/assets/juicy_fruit.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
pages/modules/Module_01/Overview.jpg filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
pages/modules/Module_02/Overview.jpg filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
pages/modules/Module_03/Overview.jpg filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
pages/modules/Module_04/Overview.jpg filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
pages/modules/Module_05/Overview.jpg filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
pages/modules/Module_06/Overview.jpg filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
pages/modules/Module_07/Overview.jpg filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
pages/modules/Module_08/Overview.jpg filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
pages/modules/Module_09/Overview.jpg filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
pages/modules/Module_10/Overview.jpg filter=lfs diff=lfs merge=lfs -text
|
pages/modules/Module_01/Module_01.ipynb
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"id": "46688de2",
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"source": [
|
| 8 |
+
"# Module 1: Introduction to Machine Learning and E-Commerce Context\n",
|
| 9 |
+
"\n",
|
| 10 |
+
"## Lesson 1.1: What is Machine Learning?\n",
|
| 11 |
+
"\n",
|
| 12 |
+
"- **Machine Learning (ML)** is a technique that enables computers to learn patterns from data and make predictions or decisions without being explicitly programmed.\n",
|
| 13 |
+
"- Types of ML:\n",
|
| 14 |
+
" - *Supervised Learning*: Learn from labeled data (e.g. classification, regression).\n",
|
| 15 |
+
" - *Unsupervised Learning*: Find patterns without labels (e.g. clustering).\n",
|
| 16 |
+
" - *Reinforcement Learning*: Learn by trial and error with rewards.\n",
|
| 17 |
+
"- Real-world examples:\n",
|
| 18 |
+
" - Email spam detection\n",
|
| 19 |
+
" - Product recommendations\n",
|
| 20 |
+
" - Image recognition"
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"cell_type": "code",
|
| 25 |
+
"execution_count": null,
|
| 26 |
+
"id": "fa78899d",
|
| 27 |
+
"metadata": {},
|
| 28 |
+
"outputs": [],
|
| 29 |
+
"source": [
|
| 30 |
+
"# Pseudo-code example: Simple spam detection\n",
|
| 31 |
+
"\n",
|
| 32 |
+
"def train_supervised_model(features, labels):\n",
|
| 33 |
+
" # Imagine this trains a model\n",
|
| 34 |
+
" return 'trained_model'\n",
|
| 35 |
+
"\n",
|
| 36 |
+
"# Dummy data (for explanation only)\n",
|
| 37 |
+
"features = ['email features']\n",
|
| 38 |
+
"labels = ['spam', 'not spam']\n",
|
| 39 |
+
"model = train_supervised_model(features, labels)\n",
|
| 40 |
+
"\n",
|
| 41 |
+
"new_email = 'Some new email data'\n",
|
| 42 |
+
"prediction = 'spam' # Dummy prediction\n",
|
| 43 |
+
"\n",
|
| 44 |
+
"if prediction == 'spam':\n",
|
| 45 |
+
" print(\"This email is spam\")\n",
|
| 46 |
+
"else:\n",
|
| 47 |
+
" print(\"This email is not spam\")"
|
| 48 |
+
]
|
| 49 |
+
},
|
| 50 |
+
{
|
| 51 |
+
"cell_type": "markdown",
|
| 52 |
+
"id": "13f0169f",
|
| 53 |
+
"metadata": {},
|
| 54 |
+
"source": [
|
| 55 |
+
"## Lesson 1.2: Business Problem — Predicting Purchase from Browsing Behavior\n",
|
| 56 |
+
"\n",
|
| 57 |
+
"- E-commerce sites want to understand if users will buy now, later, or possibly never.\n",
|
| 58 |
+
"- Benefits include: personalized marketing, better inventory control, targeted ads.\n",
|
| 59 |
+
"- Typical purchase intent labels:\n",
|
| 60 |
+
" - **Purchase Now**: User makes a purchase during session.\n",
|
| 61 |
+
" - **Purchase Later**: User did not buy now but buys within a time window later.\n",
|
| 62 |
+
" - **No Purchase**: User only browses with no buying intent detected.\n",
|
| 63 |
+
"\n",
|
| 64 |
+
"### Exercise:\n",
|
| 65 |
+
"- Think of 3 behaviors on a website that might indicate buying intent."
|
| 66 |
+
]
|
| 67 |
+
}
|
| 68 |
+
],
|
| 69 |
+
"metadata": {
|
| 70 |
+
"kernelspec": {
|
| 71 |
+
"display_name": "Python 3 (ipykernel)",
|
| 72 |
+
"language": "python",
|
| 73 |
+
"name": "python3"
|
| 74 |
+
},
|
| 75 |
+
"language_info": {
|
| 76 |
+
"codemirror_mode": {
|
| 77 |
+
"name": "ipython",
|
| 78 |
+
"version": 3
|
| 79 |
+
},
|
| 80 |
+
"file_extension": ".py",
|
| 81 |
+
"mimetype": "text/x-python",
|
| 82 |
+
"name": "python",
|
| 83 |
+
"nbconvert_exporter": "python",
|
| 84 |
+
"pygments_lexer": "ipython3",
|
| 85 |
+
"version": "3.12.4"
|
| 86 |
+
}
|
| 87 |
+
},
|
| 88 |
+
"nbformat": 4,
|
| 89 |
+
"nbformat_minor": 5
|
| 90 |
+
}
|
pages/modules/Module_01/Overview.jpg
ADDED
|
Git LFS Details
|
pages/modules/Module_01/Overview.txt
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Module 1: Introduction to Machine Learning and E-Commerce Context
|
| 2 |
+
|
| 3 |
+
Lesson 1.1: What is Machine Learning?
|
| 4 |
+
|
| 5 |
+
o Brief overview of ML concepts
|
| 6 |
+
o Types of ML (supervised, unsupervised, reinforcement)
|
| 7 |
+
o Real-world ML applications
|
| 8 |
+
|
| 9 |
+
Lesson 1.2: Business Problem — Predicting Purchase from Browsing Behavior
|
| 10 |
+
|
| 11 |
+
o Understanding e-commerce purchase funnels
|
| 12 |
+
o Why predict purchase intent?
|
| 13 |
+
o Types of user outcomes: purchase now, purchase later, no intent to purchase
|
pages/modules/Module_02/Module_02.ipynb
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"id": "fde9e65f",
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"source": [
|
| 8 |
+
"# Module 2: Basics of Python Programming\n",
|
| 9 |
+
"\n",
|
| 10 |
+
"## Lesson 2.1: Python Essentials for ML\n",
|
| 11 |
+
"\n",
|
| 12 |
+
"- Variables, data types, basic functions\n",
|
| 13 |
+
"- Control flow: loops and conditionals\n",
|
| 14 |
+
"- Using Jupyter Notebook for interactive coding"
|
| 15 |
+
]
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"cell_type": "code",
|
| 19 |
+
"execution_count": null,
|
| 20 |
+
"id": "17367a18",
|
| 21 |
+
"metadata": {},
|
| 22 |
+
"outputs": [],
|
| 23 |
+
"source": [
|
| 24 |
+
"# Example: Variables and types\n",
|
| 25 |
+
"user_name = \"Alice\"\n",
|
| 26 |
+
"pages_visited = 5\n",
|
| 27 |
+
"average_time_on_page = 12.5 # minutes\n",
|
| 28 |
+
"is_returning_visitor = True\n",
|
| 29 |
+
"\n",
|
| 30 |
+
"print(\"User:\", user_name)\n",
|
| 31 |
+
"print(\"Pages Visited:\", pages_visited)\n",
|
| 32 |
+
"print(\"Avg Time per Page:\", average_time_on_page)\n",
|
| 33 |
+
"print(\"Returning Visitor?\", is_returning_visitor)"
|
| 34 |
+
]
|
| 35 |
+
},
|
| 36 |
+
{
|
| 37 |
+
"cell_type": "code",
|
| 38 |
+
"execution_count": null,
|
| 39 |
+
"id": "e0bda962",
|
| 40 |
+
"metadata": {},
|
| 41 |
+
"outputs": [],
|
| 42 |
+
"source": [
|
| 43 |
+
"# Example: Conditional statements\n",
|
| 44 |
+
"if pages_visited > 3:\n",
|
| 45 |
+
" print(user_name + \" is engaged with the website.\")\n",
|
| 46 |
+
"else:\n",
|
| 47 |
+
" print(user_name + \" is casually browsing.\")"
|
| 48 |
+
]
|
| 49 |
+
},
|
| 50 |
+
{
|
| 51 |
+
"cell_type": "code",
|
| 52 |
+
"execution_count": null,
|
| 53 |
+
"id": "ebf9beb3",
|
| 54 |
+
"metadata": {},
|
| 55 |
+
"outputs": [],
|
| 56 |
+
"source": [
|
| 57 |
+
"# Example: Loop to print page numbers visited\n",
|
| 58 |
+
"for page in range(1, pages_visited + 1):\n",
|
| 59 |
+
" print(f\"Visited page {page}\")"
|
| 60 |
+
]
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"cell_type": "markdown",
|
| 64 |
+
"id": "da881d36",
|
| 65 |
+
"metadata": {},
|
| 66 |
+
"source": [
|
| 67 |
+
"## Lesson 2.2: Libraries for Data Science\n",
|
| 68 |
+
"\n",
|
| 69 |
+
"Introduction to essential Python libraries:\n",
|
| 70 |
+
"- **NumPy**: numerical computing\n",
|
| 71 |
+
"- **Pandas**: data manipulation and analysis\n",
|
| 72 |
+
"- **Matplotlib** and **Seaborn**: data visualization"
|
| 73 |
+
]
|
| 74 |
+
},
|
| 75 |
+
{
|
| 76 |
+
"cell_type": "code",
|
| 77 |
+
"execution_count": null,
|
| 78 |
+
"id": "2b8d230c",
|
| 79 |
+
"metadata": {},
|
| 80 |
+
"outputs": [],
|
| 81 |
+
"source": [
|
| 82 |
+
"import pandas as pd\n",
|
| 83 |
+
"import matplotlib.pyplot as plt\n",
|
| 84 |
+
"import seaborn as sns\n",
|
| 85 |
+
"\n",
|
| 86 |
+
"# Create a simple sample dataset\n",
|
| 87 |
+
"data = {\n",
|
| 88 |
+
" 'session_id': [1, 2, 3, 4, 5],\n",
|
| 89 |
+
" 'pages_visited': [5, 3, 8, 2, 7],\n",
|
| 90 |
+
" 'session_duration': [45, 25, 80, 15, 60] # in minutes\n",
|
| 91 |
+
"}\n",
|
| 92 |
+
"\n",
|
| 93 |
+
"df = pd.DataFrame(data)\n",
|
| 94 |
+
"print(df.head())"
|
| 95 |
+
]
|
| 96 |
+
},
|
| 97 |
+
{
|
| 98 |
+
"cell_type": "code",
|
| 99 |
+
"execution_count": null,
|
| 100 |
+
"id": "68d69205",
|
| 101 |
+
"metadata": {},
|
| 102 |
+
"outputs": [],
|
| 103 |
+
"source": [
|
| 104 |
+
"# Plotting number of pages visited per session\n",
|
| 105 |
+
"plt.figure(figsize=(8, 5))\n",
|
| 106 |
+
"sns.barplot(x=df['session_id'], y=df['pages_visited'], palette='viridis')\n",
|
| 107 |
+
"plt.title('Pages Visited per Session')\n",
|
| 108 |
+
"plt.xlabel('Session ID')\n",
|
| 109 |
+
"plt.ylabel('Pages Visited')\n",
|
| 110 |
+
"plt.show()"
|
| 111 |
+
]
|
| 112 |
+
},
|
| 113 |
+
{
|
| 114 |
+
"cell_type": "markdown",
|
| 115 |
+
"id": "9bb97233",
|
| 116 |
+
"metadata": {},
|
| 117 |
+
"source": [
|
| 118 |
+
"## Exercises:\n",
|
| 119 |
+
"1. Write a function `engagement_label(pages)` that returns \"High engagement\" if pages > 4, else \"Low engagement\".\n",
|
| 120 |
+
"2. Load a CSV file called `sample_browsing_data.csv` (you can create one or I can provide sample data later) and print basic statistics.\n",
|
| 121 |
+
"3. Plot a histogram of session durations from the loaded data."
|
| 122 |
+
]
|
| 123 |
+
},
|
| 124 |
+
{
|
| 125 |
+
"cell_type": "markdown",
|
| 126 |
+
"id": "079950e5",
|
| 127 |
+
"metadata": {},
|
| 128 |
+
"source": [
|
| 129 |
+
"## Potential Student Questions:\n",
|
| 130 |
+
"- What are the differences between Python data types?\n",
|
| 131 |
+
"- When do we use for loops versus while loops?\n",
|
| 132 |
+
"- How does Jupyter Notebook help with data science?\n",
|
| 133 |
+
"- Why do we import libraries and what are they used for?"
|
| 134 |
+
]
|
| 135 |
+
}
|
| 136 |
+
],
|
| 137 |
+
"metadata": {
|
| 138 |
+
"kernelspec": {
|
| 139 |
+
"display_name": "Python 3 (ipykernel)",
|
| 140 |
+
"language": "python",
|
| 141 |
+
"name": "python3"
|
| 142 |
+
},
|
| 143 |
+
"language_info": {
|
| 144 |
+
"codemirror_mode": {
|
| 145 |
+
"name": "ipython",
|
| 146 |
+
"version": 3
|
| 147 |
+
},
|
| 148 |
+
"file_extension": ".py",
|
| 149 |
+
"mimetype": "text/x-python",
|
| 150 |
+
"name": "python",
|
| 151 |
+
"nbconvert_exporter": "python",
|
| 152 |
+
"pygments_lexer": "ipython3",
|
| 153 |
+
"version": "3.12.4"
|
| 154 |
+
}
|
| 155 |
+
},
|
| 156 |
+
"nbformat": 4,
|
| 157 |
+
"nbformat_minor": 5
|
| 158 |
+
}
|
pages/modules/Module_02/Overview.jpg
ADDED
|
Git LFS Details
|
pages/modules/Module_02/Overview.txt
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Module 2: Basics of Python Programming
|
| 2 |
+
|
| 3 |
+
Lesson 2.1: Python Essentials for ML
|
| 4 |
+
|
| 5 |
+
o Data types, variables, functions
|
| 6 |
+
o Control structures (loops, conditionals)
|
| 7 |
+
o Introduction to Jupyter Notebooks
|
| 8 |
+
|
| 9 |
+
Lesson 2.2: Libraries for Data Science
|
| 10 |
+
|
| 11 |
+
o NumPy and Pandas for data manipulation
|
| 12 |
+
o Matplotlib and Seaborn for data visualization
|
pages/modules/Module_03/Module_03.ipynb
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {},
|
| 6 |
+
"source": [
|
| 7 |
+
"# Module 3: Understanding the Data\n",
|
| 8 |
+
"\n",
|
| 9 |
+
"## Lesson 3.1: Exploring Web Browsing Behavior Data\n",
|
| 10 |
+
"\n",
|
| 11 |
+
"- Discuss typical features in browsing datasets:\n",
|
| 12 |
+
" - session_duration (seconds or minutes)\n",
|
| 13 |
+
" - pages_visited\n",
|
| 14 |
+
" - time_per_page\n",
|
| 15 |
+
" - bounce_rate\n",
|
| 16 |
+
" - cart_additions\n",
|
| 17 |
+
"- Introduce the target variable: purchase intent\n",
|
| 18 |
+
" - 'purchase_now', 'purchase_later', 'no_purchase'\n",
|
| 19 |
+
"- Understand data collection methods conceptually (cookies, session logs)"
|
| 20 |
+
]
|
| 21 |
+
},
|
| 22 |
+
{
|
| 23 |
+
"cell_type": "markdown",
|
| 24 |
+
"metadata": {},
|
| 25 |
+
"source": [
|
| 26 |
+
"## Lesson 3.2: Data Loading and Exploration\n",
|
| 27 |
+
"\n",
|
| 28 |
+
"In this lesson, we will load a sample browsing dataset and explore it using basic pandas operations."
|
| 29 |
+
]
|
| 30 |
+
},
|
| 31 |
+
{
|
| 32 |
+
"cell_type": "code",
|
| 33 |
+
"metadata": {},
|
| 34 |
+
"execution_count": null,
|
| 35 |
+
"outputs": [],
|
| 36 |
+
"source": [
|
| 37 |
+
"# Import libraries\n",
|
| 38 |
+
"import pandas as pd\n",
|
| 39 |
+
"import matplotlib.pyplot as plt\n",
|
| 40 |
+
"\n",
|
| 41 |
+
"# Load sample data (replace with your path or URL)\n",
|
| 42 |
+
"data = pd.read_csv('sample_browsing_data.csv')\n",
|
| 43 |
+
"\n",
|
| 44 |
+
"# Display first 5 rows\n",
|
| 45 |
+
"print(data.head())"
|
| 46 |
+
]
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"cell_type": "code",
|
| 50 |
+
"metadata": {},
|
| 51 |
+
"execution_count": null,
|
| 52 |
+
"outputs": [],
|
| 53 |
+
"source": [
|
| 54 |
+
"# Show data info and summary statistics\n",
|
| 55 |
+
"print(\"\\nData Info:\")\n",
|
| 56 |
+
"print(data.info())\n",
|
| 57 |
+
"\n",
|
| 58 |
+
"print(\"\\nSummary Statistics:\")\n",
|
| 59 |
+
"print(data.describe())"
|
| 60 |
+
]
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"cell_type": "code",
|
| 64 |
+
"metadata": {},
|
| 65 |
+
"execution_count": null,
|
| 66 |
+
"outputs": [],
|
| 67 |
+
"source": [
|
| 68 |
+
"# Count unique values in target variable\n",
|
| 69 |
+
"print('\\nPurchase Intent Distribution:')\n",
|
| 70 |
+
"print(data['purchase_intent'].value_counts())"
|
| 71 |
+
]
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"cell_type": "code",
|
| 75 |
+
"metadata": {},
|
| 76 |
+
"execution_count": null,
|
| 77 |
+
"outputs": [],
|
| 78 |
+
"source": [
|
| 79 |
+
"# Visualize distribution of purchase intent\n",
|
| 80 |
+
"data['purchase_intent'].value_counts().plot(kind='bar', title='Purchase Intent Distribution')\n",
|
| 81 |
+
"plt.xlabel('Purchase Intent')\n",
|
| 82 |
+
"plt.ylabel('Number of Sessions')\n",
|
| 83 |
+
"plt.show()"
|
| 84 |
+
]
|
| 85 |
+
},
|
| 86 |
+
{
|
| 87 |
+
"cell_type": "markdown",
|
| 88 |
+
"metadata": {},
|
| 89 |
+
"source": [
|
| 90 |
+
"## Exercises:\n",
|
| 91 |
+
"1. Load the `sample_browsing_data.csv` file.\n",
|
| 92 |
+
"2. Use `.info()` and `.describe()` to understand your dataset.\n",
|
| 93 |
+
"3. Count how many sessions belong to each purchase intent category.\n",
|
| 94 |
+
"4. Plot the distribution of a numeric feature (e.g., `session_duration`)."
|
| 95 |
+
]
|
| 96 |
+
},
|
| 97 |
+
{
|
| 98 |
+
"cell_type": "markdown",
|
| 99 |
+
"metadata": {},
|
| 100 |
+
"source": [
|
| 101 |
+
"## Potential Student Questions:\n",
|
| 102 |
+
"- What do the different columns represent?\n",
|
| 103 |
+
"- Why do we look at both `.info()` and `.describe()`?\n",
|
| 104 |
+
"- How is purchase intent labeled if the user doesn't buy immediately?\n",
|
| 105 |
+
"- How can we trust the quality of collected web browsing data?"
|
| 106 |
+
]
|
| 107 |
+
}
|
| 108 |
+
],
|
| 109 |
+
"metadata": {
|
| 110 |
+
"kernelspec": {
|
| 111 |
+
"display_name": "Python 3",
|
| 112 |
+
"language": "python",
|
| 113 |
+
"name": "python3"
|
| 114 |
+
},
|
| 115 |
+
"language_info": {
|
| 116 |
+
"name": "python",
|
| 117 |
+
"version": "3.x"
|
| 118 |
+
}
|
| 119 |
+
},
|
| 120 |
+
"nbformat": 4,
|
| 121 |
+
"nbformat_minor": 5
|
| 122 |
+
}
|
pages/modules/Module_03/Overview.jpg
ADDED
|
Git LFS Details
|
pages/modules/Module_03/Overview.txt
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Module 3: Understanding the Data
|
| 2 |
+
|
| 3 |
+
Lesson 3.1: Exploring Web Browsing Behavior Data
|
| 4 |
+
|
| 5 |
+
o Typical data fields: session duration, pages visited, time on page, bounce rate, cart additions
|
| 6 |
+
o Data collection methods (cookies, session logs — conceptual)
|
| 7 |
+
|
| 8 |
+
Lesson 3.2: Data Loading and Exploration
|
| 9 |
+
|
| 10 |
+
o Loading sample browsing data into Pandas
|
| 11 |
+
o Basic descriptive statistics and visualization
|
| 12 |
+
o Identifying target variable and features
|
pages/modules/Module_04/Module_04.ipynb
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {},
|
| 6 |
+
"source": [
|
| 7 |
+
"# Module 4: Data Preprocessing & Feature Engineering\n",
|
| 8 |
+
"\n",
|
| 9 |
+
"## Lesson 4.1: Handling Missing Data and Data Cleaning\n",
|
| 10 |
+
"\n",
|
| 11 |
+
"- Identify missing values in dataset\n",
|
| 12 |
+
"- Techniques for handling missing data: dropping, imputing\n",
|
| 13 |
+
"- Cleaning inconsistent or noisy data"
|
| 14 |
+
]
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"cell_type": "code",
|
| 18 |
+
"metadata": {},
|
| 19 |
+
"execution_count": null,
|
| 20 |
+
"outputs": [],
|
| 21 |
+
"source": [
|
| 22 |
+
"import pandas as pd\n",
|
| 23 |
+
"\n",
|
| 24 |
+
"# Load sample data\n",
|
| 25 |
+
"data = pd.read_csv('sample_browsing_data.csv')\n",
|
| 26 |
+
"\n",
|
| 27 |
+
"# Check for missing values\n",
|
| 28 |
+
"print(\"Missing values per column:\")\n",
|
| 29 |
+
"print(data.isnull().sum())"
|
| 30 |
+
]
|
| 31 |
+
},
|
| 32 |
+
{
|
| 33 |
+
"cell_type": "code",
|
| 34 |
+
"metadata": {},
|
| 35 |
+
"execution_count": null,
|
| 36 |
+
"outputs": [],
|
| 37 |
+
"source": [
|
| 38 |
+
"# Fill missing 'session_duration' values with median\n",
|
| 39 |
+
"median_duration = data['session_duration'].median()\n",
|
| 40 |
+
"data['session_duration'].fillna(median_duration, inplace=True)\n",
|
| 41 |
+
"\n",
|
| 42 |
+
"# Verify no missing values remain in 'session_duration'\n",
|
| 43 |
+
"print(\"Missing values in 'session_duration' after fill:\", data['session_duration'].isnull().sum())"
|
| 44 |
+
]
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
"cell_type": "markdown",
|
| 48 |
+
"metadata": {},
|
| 49 |
+
"source": [
|
| 50 |
+
"## Lesson 4.2: Feature Engineering\n",
|
| 51 |
+
"\n",
|
| 52 |
+
"- Creating new features from existing data\n",
|
| 53 |
+
"- Example: Average time spent per page\n",
|
| 54 |
+
"- Encoding categorical variables with one-hot encoding"
|
| 55 |
+
]
|
| 56 |
+
},
|
| 57 |
+
{
|
| 58 |
+
"cell_type": "code",
|
| 59 |
+
"metadata": {},
|
| 60 |
+
"execution_count": null,
|
| 61 |
+
"outputs": [],
|
| 62 |
+
"source": [
|
| 63 |
+
"# Create average time spent per page feature\n",
|
| 64 |
+
"data['avg_time_per_page'] = data['session_duration'] / data['pages_visited']\n",
|
| 65 |
+
"print(data[['session_duration', 'pages_visited', 'avg_time_per_page']].head())"
|
| 66 |
+
]
|
| 67 |
+
},
|
| 68 |
+
{
|
| 69 |
+
"cell_type": "code",
|
| 70 |
+
"metadata": {},
|
| 71 |
+
"execution_count": null,
|
| 72 |
+
"outputs": [],
|
| 73 |
+
"source": [
|
| 74 |
+
"# One-hot encode 'device_type' categorical feature\n",
|
| 75 |
+
"data = pd.get_dummies(data, columns=['device_type'], drop_first=True)\n",
|
| 76 |
+
"\n",
|
| 77 |
+
"# Show new columns resulting from one-hot encoding\n",
|
| 78 |
+
"print(data.columns)"
|
| 79 |
+
]
|
| 80 |
+
},
|
| 81 |
+
{
|
| 82 |
+
"cell_type": "markdown",
|
| 83 |
+
"metadata": {},
|
| 84 |
+
"source": [
|
| 85 |
+
"## Exercises:\n",
|
| 86 |
+
"1. Identify columns with missing values and decide how to handle them.\n",
|
| 87 |
+
"2. Engineer a new feature: \"cart_additions_per_session\" (if you have cart additions data).\n",
|
| 88 |
+
"3. Convert any other categorical variables in your dataset to one-hot encoded columns."
|
| 89 |
+
]
|
| 90 |
+
},
|
| 91 |
+
{
|
| 92 |
+
"cell_type": "markdown",
|
| 93 |
+
"metadata": {},
|
| 94 |
+
"source": [
|
| 95 |
+
"## Potential Student Questions:\n",
|
| 96 |
+
"- When should I fill missing data vs remove rows?\n",
|
| 97 |
+
"- What are some common strategies for feature engineering?\n",
|
| 98 |
+
"- Why do we need to one-hot encode categorical variables?\n",
|
| 99 |
+
"- How can feature engineering improve model performance?"
|
| 100 |
+
]
|
| 101 |
+
}
|
| 102 |
+
],
|
| 103 |
+
"metadata": {
|
| 104 |
+
"kernelspec": {
|
| 105 |
+
"display_name": "Python 3",
|
| 106 |
+
"language": "python",
|
| 107 |
+
"name": "python3"
|
| 108 |
+
},
|
| 109 |
+
"language_info": {
|
| 110 |
+
"name": "python",
|
| 111 |
+
"version": "3.x"
|
| 112 |
+
}
|
| 113 |
+
},
|
| 114 |
+
"nbformat": 4,
|
| 115 |
+
"nbformat_minor": 5
|
| 116 |
+
}
|
pages/modules/Module_04/Overview.jpg
ADDED
|
Git LFS Details
|
pages/modules/Module_04/Overview.txt
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Module 4: Data Preprocessing & Feature Engineering
|
| 2 |
+
|
| 3 |
+
Lesson 4.1: Handling Missing Data and Data Cleaning
|
| 4 |
+
o Identifying missing or inconsistent data
|
| 5 |
+
o Imputing missing values
|
| 6 |
+
|
| 7 |
+
Lesson 4.2: Feature Engineering
|
| 8 |
+
o Creating new features from raw browsing data (e.g., average time per page, number of product page visits)
|
| 9 |
+
o Encoding categorical variables
|
| 10 |
+
o Feature scaling for ML algorithms
|
pages/modules/Module_05/Module_05.ipynb
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {},
|
| 6 |
+
"source": [
|
| 7 |
+
"# Module 5: Introduction to Classification and XGBoost\n",
|
| 8 |
+
"\n",
|
| 9 |
+
"## Lesson 5.1: Classification Problem\n",
|
| 10 |
+
"\n",
|
| 11 |
+
"- Difference between classification and regression\n",
|
| 12 |
+
"- Introduction to multi-class classification (3 classes: purchase now, purchase later, no purchase)\n",
|
| 13 |
+
"- Encoding categorical labels as numbers for ML models"
|
| 14 |
+
]
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"cell_type": "code",
|
| 18 |
+
"metadata": {},
|
| 19 |
+
"execution_count": null,
|
| 20 |
+
"outputs": [],
|
| 21 |
+
"source": [
|
| 22 |
+
"import pandas as pd\n",
|
| 23 |
+
"from sklearn.preprocessing import LabelEncoder\n",
|
| 24 |
+
"\n",
|
| 25 |
+
"# Assume data loaded previously\n",
|
| 26 |
+
"data = pd.read_csv('sample_browsing_data.csv')\n",
|
| 27 |
+
"\n",
|
| 28 |
+
"# Show unique classes in target\n",
|
| 29 |
+
"print(\"Purchase intent classes:\", data['purchase_intent'].unique())\n",
|
| 30 |
+
"\n",
|
| 31 |
+
"# Encode target labels numerically\n",
|
| 32 |
+
"le = LabelEncoder()\n",
|
| 33 |
+
"data['purchase_intent_encoded'] = le.fit_transform(data['purchase_intent'])\n",
|
| 34 |
+
"print(data[['purchase_intent', 'purchase_intent_encoded']].head())"
|
| 35 |
+
]
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"cell_type": "markdown",
|
| 39 |
+
"metadata": {},
|
| 40 |
+
"source": [
|
| 41 |
+
"## Lesson 5.2: Introduction to XGBoost\n",
|
| 42 |
+
"\n",
|
| 43 |
+
"- What is XGBoost? Tree boosting algorithm often effective for tabular data\n",
|
| 44 |
+
"- Installation and import\n",
|
| 45 |
+
"- Basic concepts: boosting, trees, objective function"
|
| 46 |
+
]
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"cell_type": "code",
|
| 50 |
+
"metadata": {},
|
| 51 |
+
"execution_count": null,
|
| 52 |
+
"outputs": [],
|
| 53 |
+
"source": [
|
| 54 |
+
"# Install XGBoost if not already installed (uncomment to run in Jupyter)\n",
|
| 55 |
+
"# !pip install xgboost\n",
|
| 56 |
+
"\n",
|
| 57 |
+
"import xgboost as xgb\n",
|
| 58 |
+
"print(\"XGBoost version:\", xgb.__version__)\n"
|
| 59 |
+
]
|
| 60 |
+
},
|
| 61 |
+
{
|
| 62 |
+
"cell_type": "markdown",
|
| 63 |
+
"metadata": {},
|
| 64 |
+
"source": [
|
| 65 |
+
"### Summary:\n",
|
| 66 |
+
"- We prepare features and labels\n",
|
| 67 |
+
"- Encode labels for multi-class classification\n",
|
| 68 |
+
"- Use XGBoost as an effective classifier for predicting purchase intent"
|
| 69 |
+
]
|
| 70 |
+
},
|
| 71 |
+
{
|
| 72 |
+
"cell_type": "markdown",
|
| 73 |
+
"metadata": {},
|
| 74 |
+
"source": [
|
| 75 |
+
"## Exercises:\n",
|
| 76 |
+
"1. Explore your dataset target classes.\n",
|
| 77 |
+
"2. Encode the purchase intent column using LabelEncoder.\n",
|
| 78 |
+
"3. Try installing and importing XGBoost on your system or notebook.\n",
|
| 79 |
+
"4. Read about XGBoost's key concepts (boosting, trees) from official docs or tutorials."
|
| 80 |
+
]
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"cell_type": "markdown",
|
| 84 |
+
"metadata": {},
|
| 85 |
+
"source": [
|
| 86 |
+
"## Potential Student Questions:\n",
|
| 87 |
+
"- Why do we convert labels to numbers?\n",
|
| 88 |
+
"- What makes XGBoost powerful compared to other classifiers?\n",
|
| 89 |
+
"- Can XGBoost handle multi-class problems?\n",
|
| 90 |
+
"- Do we need to preprocess data differently for XGBoost?"
|
| 91 |
+
]
|
| 92 |
+
}
|
| 93 |
+
],
|
| 94 |
+
"metadata": {
|
| 95 |
+
"kernelspec": {
|
| 96 |
+
"display_name": "Python 3",
|
| 97 |
+
"language": "python",
|
| 98 |
+
"name": "python3"
|
| 99 |
+
},
|
| 100 |
+
"language_info": {
|
| 101 |
+
"name": "python",
|
| 102 |
+
"version": "3.x"
|
| 103 |
+
}
|
| 104 |
+
},
|
| 105 |
+
"nbformat": 4,
|
| 106 |
+
"nbformat_minor": 5
|
| 107 |
+
}
|
pages/modules/Module_05/Overview.jpg
ADDED
|
Git LFS Details
|
pages/modules/Module_05/Overview.txt
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Module 5: Introduction to Classification and XGBoost
|
| 2 |
+
|
| 3 |
+
Lesson 5.1: Classification Problems
|
| 4 |
+
|
| 5 |
+
o Defining classification vs regression
|
| 6 |
+
o Multi-class classification explanation (purchase now, later, no purchase)
|
| 7 |
+
|
| 8 |
+
Lesson 5.2: Introduction to XGBoost
|
| 9 |
+
|
| 10 |
+
o What is XGBoost and why use it?
|
| 11 |
+
o Boosting concepts and decision trees (simple intuition)
|
| 12 |
+
o Installing and importing XGBoost in Python
|
pages/modules/Module_06/Module_06.ipynb
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {},
|
| 6 |
+
"source": [
|
| 7 |
+
"# Module 6: Building the Predictive Model\n",
|
| 8 |
+
"\n",
|
| 9 |
+
"## Lesson 6.1: Splitting Data into Train and Test Sets\n",
|
| 10 |
+
"\n",
|
| 11 |
+
"- Importance of splitting data to evaluate generalization\n",
|
| 12 |
+
"- Use scikit-learn's `train_test_split`"
|
| 13 |
+
]
|
| 14 |
+
},
|
| 15 |
+
{
|
| 16 |
+
"cell_type": "code",
|
| 17 |
+
"metadata": {},
|
| 18 |
+
"execution_count": null,
|
| 19 |
+
"outputs": [],
|
| 20 |
+
"source": [
|
| 21 |
+
"import pandas as pd\n",
|
| 22 |
+
"from sklearn.model_selection import train_test_split\n",
|
| 23 |
+
"\n",
|
| 24 |
+
"# Load dataset and encode target if needed\n",
|
| 25 |
+
"data = pd.read_csv('sample_browsing_data.csv')\n",
|
| 26 |
+
"from sklearn.preprocessing import LabelEncoder\n",
|
| 27 |
+
"le = LabelEncoder()\n",
|
| 28 |
+
"data['purchase_intent_encoded'] = le.fit_transform(data['purchase_intent'])\n",
|
| 29 |
+
"\n",
|
| 30 |
+
"# Define features and target\n",
|
| 31 |
+
"X = data.drop(columns=['purchase_intent', 'purchase_intent_encoded'])\n",
|
| 32 |
+
"y = data['purchase_intent_encoded']\n",
|
| 33 |
+
"\n",
|
| 34 |
+
"# Split data\n",
|
| 35 |
+
"X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n",
|
| 36 |
+
"\n",
|
| 37 |
+
"print(f\"Training samples: {len(X_train)}\")\n",
|
| 38 |
+
"print(f\"Test samples: {len(X_test)}\")"
|
| 39 |
+
]
|
| 40 |
+
},
|
| 41 |
+
{
|
| 42 |
+
"cell_type": "markdown",
|
| 43 |
+
"metadata": {},
|
| 44 |
+
"source": [
|
| 45 |
+
"## Lesson 6.2: Training the XGBoost Classifier\n",
|
| 46 |
+
"\n",
|
| 47 |
+
"- Initialize XGBoost classifier for multi-class\n",
|
| 48 |
+
"- Fit model on training data"
|
| 49 |
+
]
|
| 50 |
+
},
|
| 51 |
+
{
|
| 52 |
+
"cell_type": "code",
|
| 53 |
+
"metadata": {},
|
| 54 |
+
"execution_count": null,
|
| 55 |
+
"outputs": [],
|
| 56 |
+
"source": [
|
| 57 |
+
"import xgboost as xgb\n",
|
| 58 |
+
"\n",
|
| 59 |
+
"# Initialize model with parameters for multi-class\n",
|
| 60 |
+
"model = xgb.XGBClassifier(objective='multi:softmax', num_class=3, eval_metric='mlogloss', use_label_encoder=False, seed=42)\n",
|
| 61 |
+
"\n",
|
| 62 |
+
"# Train model\n",
|
| 63 |
+
"model.fit(X_train, y_train)"
|
| 64 |
+
]
|
| 65 |
+
},
|
| 66 |
+
{
|
| 67 |
+
"cell_type": "markdown",
|
| 68 |
+
"metadata": {},
|
| 69 |
+
"source": [
|
| 70 |
+
"## Lesson 6.3: Evaluating Model Performance\n",
|
| 71 |
+
"\n",
|
| 72 |
+
"- Predict on test set\n",
|
| 73 |
+
"- Calculate accuracy and classification report\n",
|
| 74 |
+
"- Plot confusion matrix"
|
| 75 |
+
]
|
| 76 |
+
},
|
| 77 |
+
{
|
| 78 |
+
"cell_type": "code",
|
| 79 |
+
"metadata": {},
|
| 80 |
+
"execution_count": null,
|
| 81 |
+
"outputs": [],
|
| 82 |
+
"source": [
|
| 83 |
+
"from sklearn.metrics import accuracy_score, classification_report, confusion_matrix\n",
|
| 84 |
+
"import matplotlib.pyplot as plt\n",
|
| 85 |
+
"import seaborn as sns\n",
|
| 86 |
+
"\n",
|
| 87 |
+
"# Predictions\n",
|
| 88 |
+
"y_pred = model.predict(X_test)\n",
|
| 89 |
+
"\n",
|
| 90 |
+
"# Accuracy\n",
|
| 91 |
+
"acc = accuracy_score(y_test, y_pred)\n",
|
| 92 |
+
"print(f\"Accuracy on test set: {acc:.2f}\")\n",
|
| 93 |
+
"\n",
|
| 94 |
+
"# Classification report\n",
|
| 95 |
+
"print(\"Classification Report:\")\n",
|
| 96 |
+
"print(classification_report(y_test, y_pred, target_names=le.classes_))\n",
|
| 97 |
+
"\n",
|
| 98 |
+
"# Confusion matrix\n",
|
| 99 |
+
"cm = confusion_matrix(y_test, y_pred)\n",
|
| 100 |
+
"plt.figure(figsize=(7,5))\n",
|
| 101 |
+
"sns.heatmap(cm, annot=True, fmt='d', cmap='Blues', xticklabels=le.classes_, yticklabels=le.classes_)\n",
|
| 102 |
+
"plt.xlabel('Predicted Label')\n",
|
| 103 |
+
"plt.ylabel('True Label')\n",
|
| 104 |
+
"plt.title('Confusion Matrix')\n",
|
| 105 |
+
"plt.show()"
|
| 106 |
+
]
|
| 107 |
+
},
|
| 108 |
+
{
|
| 109 |
+
"cell_type": "markdown",
|
| 110 |
+
"metadata": {},
|
| 111 |
+
"source": [
|
| 112 |
+
"## Exercises:\n",
|
| 113 |
+
"1. Split your dataset into train/test sets with 80/20 ratio.\n",
|
| 114 |
+
"2. Initialize and train an XGBoost classifier with multi-class support.\n",
|
| 115 |
+
"3. Compute test accuracy and plot the confusion matrix.\n",
|
| 116 |
+
"4. Experiment with different random states and observe accuracy changes."
|
| 117 |
+
]
|
| 118 |
+
},
|
| 119 |
+
{
|
| 120 |
+
"cell_type": "markdown",
|
| 121 |
+
"metadata": {},
|
| 122 |
+
"source": [
|
| 123 |
+
"## Potential Student Questions:\n",
|
| 124 |
+
"- Why do we split data and not train on the entire set?\n",
|
| 125 |
+
"- What is the confusion matrix and how do we interpret it?\n",
|
| 126 |
+
"- What is multi-class softmax objective in XGBoost?\n",
|
| 127 |
+
"- How do parameters like `random_state` affect results?"
|
| 128 |
+
]
|
| 129 |
+
}
|
| 130 |
+
],
|
| 131 |
+
"metadata": {
|
| 132 |
+
"kernelspec": {
|
| 133 |
+
"display_name": "Python 3",
|
| 134 |
+
"language": "python",
|
| 135 |
+
"name": "python3"
|
| 136 |
+
},
|
| 137 |
+
"language_info": {
|
| 138 |
+
"name": "python",
|
| 139 |
+
"version": "3.x"
|
| 140 |
+
}
|
| 141 |
+
},
|
| 142 |
+
"nbformat": 4,
|
| 143 |
+
"nbformat_minor": 5
|
| 144 |
+
}
|
pages/modules/Module_06/Overview.jpg
ADDED
|
Git LFS Details
|
pages/modules/Module_06/Overview.txt
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Module 6: Building the Predictive Model
|
| 2 |
+
|
| 3 |
+
Lesson 6.1: Splitting Data into Train and Test Sets
|
| 4 |
+
|
| 5 |
+
o Purpose of train-test split
|
| 6 |
+
o Using scikit-learn’s train_test_split
|
| 7 |
+
|
| 8 |
+
Lesson 6.2: Training the XGBoost Classifier
|
| 9 |
+
o Configuring XGBoost parameters for multi-class classification
|
| 10 |
+
o Fitting the model to training data
|
| 11 |
+
|
| 12 |
+
Lesson 6.3: Evaluating Model Performance
|
| 13 |
+
o Accuracy, precision, recall, F1-score basics
|
| 14 |
+
o Confusion matrix explanation and visualization
|
| 15 |
+
o Introduction to cross-validation (concept overview)
|
pages/modules/Module_07/Module_07.ipynb
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {},
|
| 6 |
+
"source": [
|
| 7 |
+
"# Module 7: Feature Importance and Model Interpretation\n",
|
| 8 |
+
"\n",
|
| 9 |
+
"## Lesson 7.1: Understanding Feature Importance\n",
|
| 10 |
+
"\n",
|
| 11 |
+
"- Why feature importance matters\n",
|
| 12 |
+
"- How XGBoost calculates feature importance (weight, gain, cover)\n",
|
| 13 |
+
"- Visualizing feature importance"
|
| 14 |
+
]
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"cell_type": "code",
|
| 18 |
+
"metadata": {},
|
| 19 |
+
"execution_count": null,
|
| 20 |
+
"outputs": [],
|
| 21 |
+
"source": [
|
| 22 |
+
"import pandas as pd\n",
|
| 23 |
+
"import xgboost as xgb\n",
|
| 24 |
+
"import matplotlib.pyplot as plt\n",
|
| 25 |
+
"\n",
|
| 26 |
+
"# Load dataset and train model (reuse from Module 6)\n",
|
| 27 |
+
"data = pd.read_csv('sample_browsing_data.csv')\n",
|
| 28 |
+
"from sklearn.preprocessing import LabelEncoder\n",
|
| 29 |
+
"le = LabelEncoder()\n",
|
| 30 |
+
"data['purchase_intent_encoded'] = le.fit_transform(data['purchase_intent'])\n",
|
| 31 |
+
"X = data.drop(columns=['purchase_intent', 'purchase_intent_encoded'])\n",
|
| 32 |
+
"y = data['purchase_intent_encoded']\n",
|
| 33 |
+
" \n",
|
| 34 |
+
"from sklearn.model_selection import train_test_split\n",
|
| 35 |
+
"X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n",
|
| 36 |
+
"\n",
|
| 37 |
+
"model = xgb.XGBClassifier(objective='multi:softmax', num_class=3, use_label_encoder=False, eval_metric='mlogloss', seed=42)\n",
|
| 38 |
+
"model.fit(X_train, y_train)\n",
|
| 39 |
+
"\n",
|
| 40 |
+
"# Plot feature importance\n",
|
| 41 |
+
"xgb.plot_importance(model, max_num_features=10, importance_type='gain')\n",
|
| 42 |
+
"plt.title('Top 10 Feature Importances (Gain)')\n",
|
| 43 |
+
"plt.show()"
|
| 44 |
+
]
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
"cell_type": "markdown",
|
| 48 |
+
"metadata": {},
|
| 49 |
+
"source": [
|
| 50 |
+
"## Lesson 7.2: Using Feature Importance for Insights\n",
|
| 51 |
+
"\n",
|
| 52 |
+
"- Understand which features drive purchase intent predictions\n",
|
| 53 |
+
"- Discuss practical applications of feature importance (marketing, product design)"
|
| 54 |
+
]
|
| 55 |
+
},
|
| 56 |
+
{
|
| 57 |
+
"cell_type": "markdown",
|
| 58 |
+
"metadata": {},
|
| 59 |
+
"source": [
|
| 60 |
+
"## Exercises:\n",
|
| 61 |
+
"1. Plot the feature importance of your dataset’s model.\n",
|
| 62 |
+
"2. Identify the top 5 features and suggest why they might be important.\n",
|
| 63 |
+
"3. Write a short paragraph explaining how you’d use these insights in a business context."
|
| 64 |
+
]
|
| 65 |
+
},
|
| 66 |
+
{
|
| 67 |
+
"cell_type": "markdown",
|
| 68 |
+
"metadata": {},
|
| 69 |
+
"source": [
|
| 70 |
+
"## Potential Student Questions:\n",
|
| 71 |
+
"- What does 'gain' mean in feature importance?\n",
|
| 72 |
+
"- Are feature importance scores always reliable?\n",
|
| 73 |
+
"- Can feature importance tell us about causality?\n",
|
| 74 |
+
"- How to handle features that appear unimportant?"
|
| 75 |
+
]
|
| 76 |
+
}
|
| 77 |
+
],
|
| 78 |
+
"metadata": {
|
| 79 |
+
"kernelspec": {
|
| 80 |
+
"display_name": "Python 3",
|
| 81 |
+
"language": "python",
|
| 82 |
+
"name": "python3"
|
| 83 |
+
},
|
| 84 |
+
"language_info": {
|
| 85 |
+
"name": "python",
|
| 86 |
+
"version": "3.x"
|
| 87 |
+
}
|
| 88 |
+
},
|
| 89 |
+
"nbformat": 4,
|
| 90 |
+
"nbformat_minor": 5
|
| 91 |
+
}
|
pages/modules/Module_07/Overview.jpg
ADDED
|
Git LFS Details
|
pages/modules/Module_07/Overview.txt
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Module 7: Feature Importance and Model Interpretation
|
| 2 |
+
|
| 3 |
+
Lesson 7.1: Understanding Feature Importance
|
| 4 |
+
|
| 5 |
+
o Why feature importance matters
|
| 6 |
+
o How XGBoost calculates feature importance (gain, cover, weight)
|
| 7 |
+
o Plotting feature importance with XGBoost built-in functions and external libraries (Matplotlib, SHAP overview)
|
| 8 |
+
|
| 9 |
+
Lesson 7.2: Using Feature Importance for Insights
|
| 10 |
+
|
| 11 |
+
o Identifying key drivers of purchase intent
|
| 12 |
+
o Practical implications for marketing strategies or UI improvements
|
pages/modules/Module_08/Module_08.ipynb
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {},
|
| 6 |
+
"source": [
|
| 7 |
+
"# Module 8: Dimensionality Reduction and Feature Selection\n",
|
| 8 |
+
"\n",
|
| 9 |
+
"## Lesson 8.1: Why Reduce Features?\n",
|
| 10 |
+
"- Discuss curse of dimensionality and computational cost\n",
|
| 11 |
+
"- Benefits: faster training, reduced noise, easier visualization"
|
| 12 |
+
]
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"cell_type": "markdown",
|
| 16 |
+
"metadata": {},
|
| 17 |
+
"source": [
|
| 18 |
+
"## Lesson 8.2: Principal Component Analysis (PCA)\n",
|
| 19 |
+
"- Introduce PCA concept: transform features into uncorrelated principal components\n",
|
| 20 |
+
"- Apply PCA to scaled data\n",
|
| 21 |
+
"- Plot explained variance to identify how many components to keep"
|
| 22 |
+
]
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"cell_type": "code",
|
| 26 |
+
"metadata": {},
|
| 27 |
+
"execution_count": null,
|
| 28 |
+
"outputs": [],
|
| 29 |
+
"source": [
|
| 30 |
+
"import pandas as pd\n",
|
| 31 |
+
"import numpy as np\n",
|
| 32 |
+
"from sklearn.decomposition import PCA\n",
|
| 33 |
+
"from sklearn.preprocessing import StandardScaler\n",
|
| 34 |
+
"import matplotlib.pyplot as plt\n",
|
| 35 |
+
"\n",
|
| 36 |
+
"# Load dataset\n",
|
| 37 |
+
"data = pd.read_csv('sample_browsing_data.csv')\n",
|
| 38 |
+
"X = data.drop(columns=['purchase_intent'])\n",
|
| 39 |
+
"\n",
|
| 40 |
+
"# Some preprocessing: handle missing, drop non-numeric if needed\n",
|
| 41 |
+
"X = X.select_dtypes(include=[np.number])\n",
|
| 42 |
+
"X.fillna(X.median(), inplace=True)\n",
|
| 43 |
+
"\n",
|
| 44 |
+
"# Scale features\n",
|
| 45 |
+
"scaler = StandardScaler()\n",
|
| 46 |
+
"X_scaled = scaler.fit_transform(X)\n",
|
| 47 |
+
"\n",
|
| 48 |
+
"# Apply PCA\n",
|
| 49 |
+
"pca = PCA()\n",
|
| 50 |
+
"pca.fit(X_scaled)\n",
|
| 51 |
+
"\n",
|
| 52 |
+
"# Plot cumulative explained variance\n",
|
| 53 |
+
"plt.figure(figsize=(8,5))\n",
|
| 54 |
+
"plt.plot(np.cumsum(pca.explained_variance_ratio_))\n",
|
| 55 |
+
"plt.xlabel('Number of Principal Components')\n",
|
| 56 |
+
"plt.ylabel('Cumulative Explained Variance')\n",
|
| 57 |
+
"plt.title('PCA - Explained Variance vs Number of Components')\n",
|
| 58 |
+
"plt.grid(True)\n",
|
| 59 |
+
"plt.show()"
|
| 60 |
+
]
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"cell_type": "markdown",
|
| 64 |
+
"metadata": {},
|
| 65 |
+
"source": [
|
| 66 |
+
"## Lesson 8.3: The Elbow Method for Feature Selection\n",
|
| 67 |
+
"- Use the \"elbow\" in explained variance plot to decide how many components to keep\n",
|
| 68 |
+
"- Dimensionality reduction improves model speed and may improve accuracy"
|
| 69 |
+
]
|
| 70 |
+
},
|
| 71 |
+
{
|
| 72 |
+
"cell_type": "code",
|
| 73 |
+
"metadata": {},
|
| 74 |
+
"execution_count": null,
|
| 75 |
+
"outputs": [],
|
| 76 |
+
"source": [
|
| 77 |
+
"# Example: choose number of components that explain at least 90% variance\n",
|
| 78 |
+
"cumulative_variance = np.cumsum(pca.explained_variance_ratio_)\n",
|
| 79 |
+
"n_components_90 = np.argmax(cumulative_variance >= 0.90) + 1\n",
|
| 80 |
+
"print(f\"Number of components to explain 90% variance: {n_components_90}\")\n",
|
| 81 |
+
"\n",
|
| 82 |
+
"# Transform data with selected components\n",
|
| 83 |
+
"pca_selected = PCA(n_components=n_components_90)\n",
|
| 84 |
+
"X_reduced = pca_selected.fit_transform(X_scaled)\n",
|
| 85 |
+
"print(f\"Shape of reduced data: {X_reduced.shape}\")"
|
| 86 |
+
]
|
| 87 |
+
},
|
| 88 |
+
{
|
| 89 |
+
"cell_type": "markdown",
|
| 90 |
+
"metadata": {},
|
| 91 |
+
"source": [
|
| 92 |
+
"## Exercises:\n",
|
| 93 |
+
"1. Perform PCA on your dataset features.\n",
|
| 94 |
+
"2. Plot and interpret the explained variance curve.\n",
|
| 95 |
+
"3. Choose the number of components using the elbow method.\n",
|
| 96 |
+
"4. Transform your dataset into the reduced PCA space."
|
| 97 |
+
]
|
| 98 |
+
},
|
| 99 |
+
{
|
| 100 |
+
"cell_type": "markdown",
|
| 101 |
+
"metadata": {},
|
| 102 |
+
"source": [
|
| 103 |
+
"## Potential Student Questions:\n",
|
| 104 |
+
"- What does each principal component represent?\n",
|
| 105 |
+
"- Should we always reduce dimensionality?\n",
|
| 106 |
+
"- How to decide how many components to keep?\n",
|
| 107 |
+
"- Does PCA guarantee better model accuracy?"
|
| 108 |
+
]
|
| 109 |
+
}
|
| 110 |
+
],
|
| 111 |
+
"metadata": {
|
| 112 |
+
"kernelspec": {
|
| 113 |
+
"display_name": "Python 3",
|
| 114 |
+
"language": "python",
|
| 115 |
+
"name": "python3"
|
| 116 |
+
},
|
| 117 |
+
"language_info": {
|
| 118 |
+
"name": "python",
|
| 119 |
+
"version": "3.x"
|
| 120 |
+
}
|
| 121 |
+
},
|
| 122 |
+
"nbformat": 4,
|
| 123 |
+
"nbformat_minor": 5
|
| 124 |
+
}
|
pages/modules/Module_08/Overview.jpg
ADDED
|
Git LFS Details
|
pages/modules/Module_08/Overview.txt
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Module 8: Dimensionality Reduction and Feature Selection
|
| 2 |
+
|
| 3 |
+
Lesson 8.1: Why Reduce Features?
|
| 4 |
+
|
| 5 |
+
o Curse of dimensionality and model complexity
|
| 6 |
+
o Benefits of dimensionality reduction
|
| 7 |
+
|
| 8 |
+
Lesson 8.2: Principal Component Analysis (PCA)
|
| 9 |
+
|
| 10 |
+
o Intuition of PCA—capturing variance in fewer dimensions
|
| 11 |
+
o Applying PCA to browsing features
|
| 12 |
+
o Visualizing principal components
|
| 13 |
+
|
| 14 |
+
Lesson 8.3: The Elbow Method for Feature Selection
|
| 15 |
+
|
| 16 |
+
o Concept of the elbow method to decide number of components or clusters
|
| 17 |
+
o Plotting explained variance ratio to select dimension count
|
pages/modules/Module_09/Module_09.ipynb
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {},
|
| 6 |
+
"source": [
|
| 7 |
+
"# Module 9: Clustering and User Segmentation\n",
|
| 8 |
+
"\n",
|
| 9 |
+
"## Lesson 9.1: Introduction to Unsupervised Learning and Clustering\n",
|
| 10 |
+
"\n",
|
| 11 |
+
"- Difference between supervised and unsupervised learning\n",
|
| 12 |
+
"- Why cluster users? To find natural groupings for marketing and personalization"
|
| 13 |
+
]
|
| 14 |
+
},
|
| 15 |
+
{
|
| 16 |
+
"cell_type": "markdown",
|
| 17 |
+
"metadata": {},
|
| 18 |
+
"source": [
|
| 19 |
+
"## Lesson 9.2: K-Means Clustering\n",
|
| 20 |
+
"\n",
|
| 21 |
+
"- How K-Means works: Iterative cluster assignment and centroid updates\n",
|
| 22 |
+
"- Choosing number of clusters (k) using elbow method"
|
| 23 |
+
]
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"cell_type": "code",
|
| 27 |
+
"metadata": {},
|
| 28 |
+
"execution_count": null,
|
| 29 |
+
"outputs": [],
|
| 30 |
+
"source": [
|
| 31 |
+
"import pandas as pd\n",
|
| 32 |
+
"import numpy as np\n",
|
| 33 |
+
"from sklearn.cluster import KMeans\n",
|
| 34 |
+
"from sklearn.preprocessing import StandardScaler\n",
|
| 35 |
+
"import matplotlib.pyplot as plt\n",
|
| 36 |
+
"\n",
|
| 37 |
+
"# Load dataset\n",
|
| 38 |
+
"data = pd.read_csv('sample_browsing_data.csv')\n",
|
| 39 |
+
"\n",
|
| 40 |
+
"# Select numeric features for clustering\n",
|
| 41 |
+
"X = data.select_dtypes(include=[np.number])\n",
|
| 42 |
+
"X.fillna(X.median(), inplace=True)\n",
|
| 43 |
+
"\n",
|
| 44 |
+
"# Scale features\n",
|
| 45 |
+
"scaler = StandardScaler()\n",
|
| 46 |
+
"X_scaled = scaler.fit_transform(X)\n",
|
| 47 |
+
"\n",
|
| 48 |
+
"# Elbow method to find optimal k\n",
|
| 49 |
+
"inertia = []\n",
|
| 50 |
+
"k_range = range(1, 11)\n",
|
| 51 |
+
"for k in k_range:\n",
|
| 52 |
+
" kmeans = KMeans(n_clusters=k, random_state=42)\n",
|
| 53 |
+
" kmeans.fit(X_scaled)\n",
|
| 54 |
+
" inertia.append(kmeans.inertia_)\n",
|
| 55 |
+
"\n",
|
| 56 |
+
"plt.figure(figsize=(8,5))\n",
|
| 57 |
+
"plt.plot(k_range, inertia, 'bo-')\n",
|
| 58 |
+
"plt.xlabel('Number of clusters k')\n",
|
| 59 |
+
"plt.ylabel('Inertia (Sum of squared distances)')\n",
|
| 60 |
+
"plt.title('Elbow Method For Optimal k')\n",
|
| 61 |
+
"plt.show()"
|
| 62 |
+
]
|
| 63 |
+
},
|
| 64 |
+
{
|
| 65 |
+
"cell_type": "markdown",
|
| 66 |
+
"metadata": {},
|
| 67 |
+
"source": [
|
| 68 |
+
"## Lesson 9.3: Analyzing and Labeling Segments\n",
|
| 69 |
+
"\n",
|
| 70 |
+
"- Choose number of clusters (e.g., k=3)\n",
|
| 71 |
+
"- Fit K-Means and assign cluster labels\n",
|
| 72 |
+
"- Analyze cluster centers and interpret user behaviors"
|
| 73 |
+
]
|
| 74 |
+
},
|
| 75 |
+
{
|
| 76 |
+
"cell_type": "code",
|
| 77 |
+
"metadata": {},
|
| 78 |
+
"execution_count": null,
|
| 79 |
+
"outputs": [],
|
| 80 |
+
"source": [
|
| 81 |
+
"k_optimal = 3\n",
|
| 82 |
+
"kmeans = KMeans(n_clusters=k_optimal, random_state=42)\n",
|
| 83 |
+
"data['cluster'] = kmeans.fit_predict(X_scaled)\n",
|
| 84 |
+
"\n",
|
| 85 |
+
"# Display cluster counts\n",
|
| 86 |
+
"print(data['cluster'].value_counts())\n",
|
| 87 |
+
"\n",
|
| 88 |
+
"# Calculate cluster centers (in scaled space)\n",
|
| 89 |
+
"centers = kmeans.cluster_centers_\n",
|
| 90 |
+
"\n",
|
| 91 |
+
"# Convert centers back to original scale for interpretation\n",
|
| 92 |
+
"centers_orig = scaler.inverse_transform(centers)\n",
|
| 93 |
+
"centers_df = pd.DataFrame(centers_orig, columns=X.columns)\n",
|
| 94 |
+
"print(\"Cluster Centers (approximate feature means):\")\n",
|
| 95 |
+
"print(centers_df)\n",
|
| 96 |
+
"\n",
|
| 97 |
+
"# Visualize clusters using first two principal components (optional)\n",
|
| 98 |
+
"from sklearn.decomposition import PCA\n",
|
| 99 |
+
"pca = PCA(n_components=2)\n",
|
| 100 |
+
"X_pca = pca.fit_transform(X_scaled)\n",
|
| 101 |
+
"\n",
|
| 102 |
+
"plt.figure(figsize=(8,6))\n",
|
| 103 |
+
"plt.scatter(X_pca[:,0], X_pca[:,1], c=data['cluster'], cmap='viridis', alpha=0.6)\n",
|
| 104 |
+
"plt.xlabel('PCA Component 1')\n",
|
| 105 |
+
"plt.ylabel('PCA Component 2')\n",
|
| 106 |
+
"plt.title('User Clusters Visualization (PCA)')\n",
|
| 107 |
+
"plt.colorbar(label='Cluster')\n",
|
| 108 |
+
"plt.show()"
|
| 109 |
+
]
|
| 110 |
+
},
|
| 111 |
+
{
|
| 112 |
+
"cell_type": "markdown",
|
| 113 |
+
"metadata": {},
|
| 114 |
+
"source": [
|
| 115 |
+
"## Lesson 9.4: Using Clusters to Enhance Purchase Predictions\n",
|
| 116 |
+
"\n",
|
| 117 |
+
"- Discuss adding cluster assignments as a feature to classifiers\n",
|
| 118 |
+
"- Segment-specific marketing strategies\n"
|
| 119 |
+
]
|
| 120 |
+
},
|
| 121 |
+
{
|
| 122 |
+
"cell_type": "markdown",
|
| 123 |
+
"metadata": {},
|
| 124 |
+
"source": [
|
| 125 |
+
"## Exercises:\n",
|
| 126 |
+
"1. Apply K-Means clustering to your browsing data.\n",
|
| 127 |
+
"2. Use the elbow method to select an optimal number of clusters.\n",
|
| 128 |
+
"3. Analyze and describe characteristics of each cluster.\n",
|
| 129 |
+
"4. Visualize the clusters on 2D PCA components."
|
| 130 |
+
]
|
| 131 |
+
},
|
| 132 |
+
{
|
| 133 |
+
"cell_type": "markdown",
|
| 134 |
+
"metadata": {},
|
| 135 |
+
"source": [
|
| 136 |
+
"## Potential Student Questions:\n",
|
| 137 |
+
"- How does K-Means assign clusters?\n",
|
| 138 |
+
"- What if clusters are not well separated?\n",
|
| 139 |
+
"- Can we use other clustering methods?\n",
|
| 140 |
+
"- How do clusters improve prediction or marketing?"
|
| 141 |
+
]
|
| 142 |
+
}
|
| 143 |
+
],
|
| 144 |
+
"metadata": {
|
| 145 |
+
"kernelspec": {
|
| 146 |
+
"display_name": "Python 3",
|
| 147 |
+
"language": "python",
|
| 148 |
+
"name": "python3"
|
| 149 |
+
},
|
| 150 |
+
"language_info": {
|
| 151 |
+
"name": "python",
|
| 152 |
+
"version": "3.x"
|
| 153 |
+
}
|
| 154 |
+
},
|
| 155 |
+
"nbformat": 4,
|
| 156 |
+
"nbformat_minor": 5
|
| 157 |
+
}
|
pages/modules/Module_09/Overview.jpg
ADDED
|
Git LFS Details
|
pages/modules/Module_09/Overview.txt
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Module 9: Clustering and User Segmentation
|
| 2 |
+
|
| 3 |
+
Lesson 9.1: Introduction to Unsupervised Learning and Clustering
|
| 4 |
+
|
| 5 |
+
o Difference between supervised and unsupervised learning
|
| 6 |
+
o Use cases for clustering in e-commerce (user segmentation, personalized marketing)
|
| 7 |
+
|
| 8 |
+
Lesson 9.2: K-Means Clustering
|
| 9 |
+
o How K-Means works conceptually
|
| 10 |
+
o Applying K-Means on browsing behavior features
|
| 11 |
+
o Finding optimal number of clusters (using elbow method)
|
| 12 |
+
|
| 13 |
+
Lesson 9.3: Analyzing and Labeling Segments
|
| 14 |
+
o Profiling clusters based on feature averages
|
| 15 |
+
o Assigning marketing personas or labels (e.g., window shoppers, deal hunters, loyal customers)
|
| 16 |
+
|
| 17 |
+
Lesson 9.4: Using Clusters to Enhance Purchase Predictions
|
| 18 |
+
o Combining clustering results as new features or separate workflows
|
pages/modules/Module_10/Module_10.ipynb
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {},
|
| 6 |
+
"source": [
|
| 7 |
+
"# Module 10: Advanced Model Improvement and Ethical Considerations\n",
|
| 8 |
+
"\n",
|
| 9 |
+
"## Lesson 10.1: Hyperparameter Tuning and Handling Class Imbalance\n",
|
| 10 |
+
"\n",
|
| 11 |
+
"- Importance of tuning model hyperparameters to improve performance\n",
|
| 12 |
+
"- Overview of Grid Search and Random Search\n",
|
| 13 |
+
"- Handling class imbalance: resampling, class weights\n"
|
| 14 |
+
]
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"cell_type": "code",
|
| 18 |
+
"metadata": {},
|
| 19 |
+
"execution_count": null,
|
| 20 |
+
"outputs": [],
|
| 21 |
+
"source": [
|
| 22 |
+
"import pandas as pd\n",
|
| 23 |
+
"from sklearn.model_selection import train_test_split, GridSearchCV\n",
|
| 24 |
+
"from sklearn.preprocessing import LabelEncoder\n",
|
| 25 |
+
"import xgboost as xgb\n",
|
| 26 |
+
"\n",
|
| 27 |
+
"# Load and prepare data\n",
|
| 28 |
+
"data = pd.read_csv('sample_browsing_data.csv')\n",
|
| 29 |
+
"le = LabelEncoder()\n",
|
| 30 |
+
"data['purchase_intent_encoded'] = le.fit_transform(data['purchase_intent'])\n",
|
| 31 |
+
"\n",
|
| 32 |
+
"X = data.drop(columns=['purchase_intent', 'purchase_intent_encoded'])\n",
|
| 33 |
+
"y = data['purchase_intent_encoded']\n",
|
| 34 |
+
"\n",
|
| 35 |
+
"X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n",
|
| 36 |
+
"\n",
|
| 37 |
+
"# Define model\n",
|
| 38 |
+
"model = xgb.XGBClassifier(objective='multi:softmax', num_class=3, use_label_encoder=False, eval_metric='mlogloss', seed=42)\n",
|
| 39 |
+
"\n",
|
| 40 |
+
"# Hyperparameter grid\n",
|
| 41 |
+
"param_grid = {\n",
|
| 42 |
+
" 'max_depth': [3, 5],\n",
|
| 43 |
+
" 'learning_rate': [0.1, 0.01],\n",
|
| 44 |
+
" 'n_estimators': [50, 100]\n",
|
| 45 |
+
"}\n",
|
| 46 |
+
"\n",
|
| 47 |
+
"# Setup GridSearchCV\n",
|
| 48 |
+
"grid_search = GridSearchCV(model, param_grid, cv=3, scoring='accuracy', verbose=1)\n",
|
| 49 |
+
"\n",
|
| 50 |
+
"# Fit grid search\n",
|
| 51 |
+
"grid_search.fit(X_train, y_train)\n",
|
| 52 |
+
"\n",
|
| 53 |
+
"print(f\"Best parameters: {grid_search.best_params_}\")\n",
|
| 54 |
+
"print(f\"Best cross-validation accuracy: {grid_search.best_score_:.2f}\")"
|
| 55 |
+
]
|
| 56 |
+
},
|
| 57 |
+
{
|
| 58 |
+
"cell_type": "markdown",
|
| 59 |
+
"metadata": {},
|
| 60 |
+
"source": [
|
| 61 |
+
"## Handling Class Imbalance (Conceptual)\n",
|
| 62 |
+
"\n",
|
| 63 |
+
"- Techniques:\n",
|
| 64 |
+
" - Oversampling minority class\n",
|
| 65 |
+
" - Undersampling majority class\n",
|
| 66 |
+
" - Using class weights in model training\n",
|
| 67 |
+
"- XGBoost supports scale_pos_weight parameter for binary imbalance (multi-class requires other approaches)"
|
| 68 |
+
]
|
| 69 |
+
},
|
| 70 |
+
{
|
| 71 |
+
"cell_type": "markdown",
|
| 72 |
+
"metadata": {},
|
| 73 |
+
"source": [
|
| 74 |
+
"## Lesson 10.2: Ethical Considerations in ML for E-Commerce\n",
|
| 75 |
+
"\n",
|
| 76 |
+
"- **Privacy:** Ethical collection and use of browsing data\n",
|
| 77 |
+
"- **Bias and fairness:** Avoid reinforcing stereotypes or discrimination\n",
|
| 78 |
+
"- **Transparency:** Explainability of ML predictions\n",
|
| 79 |
+
"- **User consent:** Informing users how data is used\n",
|
| 80 |
+
"\n",
|
| 81 |
+
"Discuss examples and best practices."
|
| 82 |
+
]
|
| 83 |
+
},
|
| 84 |
+
{
|
| 85 |
+
"cell_type": "markdown",
|
| 86 |
+
"metadata": {},
|
| 87 |
+
"source": [
|
| 88 |
+
"## Exercises:\n",
|
| 89 |
+
"1. Perform hyperparameter tuning on your XGBoost model using GridSearchCV.\n",
|
| 90 |
+
"2. Research techniques to handle class imbalance and describe which might fit e-commerce data.\n",
|
| 91 |
+
"3. Write a paragraph on ethical issues you foresee in using ML to predict purchase intent."
|
| 92 |
+
]
|
| 93 |
+
},
|
| 94 |
+
{
|
| 95 |
+
"cell_type": "markdown",
|
| 96 |
+
"metadata": {},
|
| 97 |
+
"source": [
|
| 98 |
+
"## Potential Student Questions:\n",
|
| 99 |
+
"- How do hyperparameters affect model performance?\n",
|
| 100 |
+
"- What happens if classes are imbalanced?\n",
|
| 101 |
+
"- How can models be made fair and unbiased?\n",
|
| 102 |
+
"- What are real risks of privacy violations?"
|
| 103 |
+
]
|
| 104 |
+
}
|
| 105 |
+
],
|
| 106 |
+
"metadata": {
|
| 107 |
+
"kernelspec": {
|
| 108 |
+
"display_name": "Python 3",
|
| 109 |
+
"language": "python",
|
| 110 |
+
"name": "python3"
|
| 111 |
+
},
|
| 112 |
+
"language_info": {
|
| 113 |
+
"name": "python",
|
| 114 |
+
"version": "3.x"
|
| 115 |
+
}
|
| 116 |
+
},
|
| 117 |
+
"nbformat": 4,
|
| 118 |
+
"nbformat_minor": 5
|
| 119 |
+
}
|
pages/modules/Module_10/Overview.jpg
ADDED
|
Git LFS Details
|
pages/modules/Module_10/Overview.txt
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Module 10: Advanced Model Improvements
|
| 2 |
+
|
| 3 |
+
Lesson 7.1: Hyperparameter Tuning
|
| 4 |
+
|
| 5 |
+
o Concepts of hyperparameters (learning rate, max_depth, etc.)
|
| 6 |
+
o Grid search or random search (concept overview)
|
| 7 |
+
|
| 8 |
+
Lesson 7.2: Handling Class (Data) Imbalances
|
| 9 |
+
|
| 10 |
+
o What is class imbalance?
|
| 11 |
+
o Techniques to address imbalance (resampling, class weights)
|
| 12 |
+
|
| 13 |
+
Lesson 7.3
|
| 14 |
+
|
| 15 |
+
o Discussions on explainability with SHAP or LIME (optional)
|
| 16 |
+
|
| 17 |
+
|
pages/modules/Module_11/Module_11.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
pages/modules/Module_11/Overview.jpg
ADDED
|
pages/modules/Module_11/Overview.txt
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Module 11 An Actual Application and Deployment
|
| 2 |
+
|
| 3 |
+
Lesson 11.1: Running your own real prediction application on real data
|
| 4 |
+
|
| 5 |
+
Students will go through the entire pipeline:
|
| 6 |
+
|
| 7 |
+
o Load and preprocess a provided browsing dataset
|
| 8 |
+
o Engineer relevant features
|
| 9 |
+
o Train and evaluate an XGBoost classifier
|
| 10 |
+
o Interpret the results and discuss practical implications
|
| 11 |
+
|
| 12 |
+
Lesson 11.2: Ethical Considerations
|
| 13 |
+
|
| 14 |
+
o Privacy concerns with user data
|
| 15 |
+
o Fairness and bias in predictions
|
| 16 |
+
o Transparency and explainability of ML models
|
pages/modules/Overview/Overview.jpg
ADDED
|
pages/modules/Overview/Overview.txt
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Welcome to "Will They Buy It"
|
| 2 |
+
|
| 3 |
+
Select the first module using the sidebar on the left
|
| 4 |
+
|
| 5 |
+
Lesson 1.1: What is Machine Learning?
|
| 6 |
+
|
| 7 |
+
o Brief overview of ML concepts
|
| 8 |
+
o Types of ML (supervised, unsupervised, reinforcement)
|
| 9 |
+
o Real-world ML applications
|
| 10 |
+
|
| 11 |
+
Lesson 1.2: Business Problem — Predicting Purchase from Browsing Behavior
|
| 12 |
+
|
| 13 |
+
o Understanding e-commerce purchase funnels
|
| 14 |
+
o Why predict purchase intent?
|
| 15 |
+
o Types of user outcomes: purchase now, purchase later, no intent to purchase
|