Skip to content

Commit 1bf1616

Browse files
committed
add in-class activities
1 parent 65955f2 commit 1bf1616

File tree

5 files changed

+179
-133
lines changed

5 files changed

+179
-133
lines changed

3-Supervised-1-Regression.ipynb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,11 +328,22 @@
328328
"\n",
329329
"Up next, we’ll explore **Classification** techniques!\n"
330330
]
331+
},
332+
{
333+
"cell_type": "markdown",
334+
"metadata": {},
335+
"source": [
336+
"## In-class Activity:\n",
337+
"- Implement another regression algorithm using a different dataset.\n",
338+
"- Use scikit-learn to choose dataset and new regression algorithm.\n",
339+
"- Datasets: [Toy datasets](https://scikit-learn.org/1.5/datasets/toy_dataset.html)\n",
340+
"- Algorithms: [Scikit-learn algorithms](https://scikit-learn.org/stable/supervised_learning.html#supervised-learning)"
341+
]
331342
}
332343
],
333344
"metadata": {
334345
"kernelspec": {
335-
"display_name": "base",
346+
"display_name": ".venv",
336347
"language": "python",
337348
"name": "python3"
338349
},
@@ -346,7 +357,7 @@
346357
"name": "python",
347358
"nbconvert_exporter": "python",
348359
"pygments_lexer": "ipython3",
349-
"version": "3.11.5"
360+
"version": "3.11.10"
350361
}
351362
},
352363
"nbformat": 4,

3-Supervised-2-Classification.ipynb

Lines changed: 6 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -909,67 +909,11 @@
909909
"cell_type": "markdown",
910910
"metadata": {},
911911
"source": [
912-
"## 📏 How Do We Evaluate Classification Models?\n",
913-
"\n",
914-
"We evaluate classification models using various metrics to understand their performance. Common evaluation metrics include accuracy, precision, recall, F1-score and Mathew's correlation coefficient (MCC) based on the confusion matrix.\n",
915-
"\n",
916-
"### Confusion Matrix:\n",
917-
"- A table summarizing true positives, false positives, true negatives, and false negatives.\n",
918-
"\n",
919-
"| | Predicted Positive | Predicted Negative |\n",
920-
"|----------------|---------------------|---------------------|\n",
921-
"| **Actual Positive** | True Positive (TP) | False Negative (FN) |\n",
922-
"| **Actual Negative** | False Positive (FP) | True Negative (TN) |\n",
923-
"\n",
924-
"**True Positive (TP)**: Correctly predicted positive samples.\n",
925-
"\n",
926-
"**False Positive (FP)**: Incorrectly predicted positive samples.\n",
927-
"\n",
928-
"**True Negative (TN)**: Correctly predicted negative samples.\n",
929-
"\n",
930-
"**False Negative (FN)**: Incorrectly predicted negative samples.\n",
931-
"\n",
932-
"### 1️⃣ Accuracy:\n",
933-
"- Percentage of correctly predicted samples.\n",
934-
"- Formula: Accuracy = \\(\\frac{TP + TN}{TP + TN + FP + FN}\\)\n",
935-
"- Limitation: Can be misleading for imbalanced datasets.\n",
936-
"\n",
937-
"---\n",
938-
"\n",
939-
"### 2️⃣ Precision:\n",
940-
"- Of all the predicted positives, how many are truly positive?\n",
941-
"- Formula:\n",
942-
" \\[\n",
943-
" \\text{Precision} = \\frac{\\text{True Positives}}{\\text{True Positives} + \\text{False Positives}}\n",
944-
" \\]\n",
945-
"\n",
946-
"---\n",
947-
"\n",
948-
"### 3️⃣ Recall (Sensitivity):\n",
949-
"- Of all the actual positives, how many were correctly predicted?\n",
950-
"- Formula:\n",
951-
" \\[\n",
952-
" \\text{Recall} = \\frac{\\text{True Positives}}{\\text{True Positives} + \\text{False Negatives}}\n",
953-
" \\]\n",
954-
"\n",
955-
"---\n",
956-
"\n",
957-
"### 4️⃣ F1-Score:\n",
958-
"- Harmonic mean of precision and recall. Useful when you want to balance both.\n",
959-
"- Formula:\n",
960-
" \\[\n",
961-
" \\text{F1-Score} = 2 \\times \\frac{\\text{Precision} \\times \\text{Recall}}{\\text{Precision} + \\text{Recall}}\n",
962-
" \\]\n",
963-
"\n",
964-
"---\n",
965-
"\n",
966-
"### 5️⃣ Confusion Matrix:\n",
967-
"- A table summarizing true positives, false positives, true negatives, and false negatives.\n",
968-
"\n",
969-
"| | Predicted Positive | Predicted Negative |\n",
970-
"|----------------|---------------------|---------------------|\n",
971-
"| **Actual Positive** | True Positive (TP) | False Negative (FN) |\n",
972-
"| **Actual Negative** | False Positive (FP) | True Negative (TN) |\n"
912+
"## In-class Activity:\n",
913+
"- Implement another classification algorithm using a different dataset.\n",
914+
"- Use scikit-learn to choose dataset and new classification algorithm.\n",
915+
"- Datasets: [Toy datasets](https://scikit-learn.org/1.5/datasets/toy_dataset.html)\n",
916+
"- Algorithms: [Scikit-learn algorithms](https://scikit-learn.org/stable/supervised_learning.html#supervised-learning)"
973917
]
974918
}
975919
],
@@ -989,7 +933,7 @@
989933
"name": "python",
990934
"nbconvert_exporter": "python",
991935
"pygments_lexer": "ipython3",
992-
"version": "3.11.5"
936+
"version": "3.11.10"
993937
}
994938
},
995939
"nbformat": 4,

4-Unsupervised-1-Clustering.ipynb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,15 @@
683683
"\n",
684684
"For more information on clustering, refer to the [Scikit-learn documentation](https://scikit-learn.org/stable/modules/clustering.html)."
685685
]
686+
},
687+
{
688+
"cell_type": "markdown",
689+
"metadata": {},
690+
"source": [
691+
"## In-class Activity: Implementing another Clustering with the dataset.\n",
692+
"- Choose an unsupervised learning technique (e.g., hierarchical clustering) and apply it to the dataset. \n",
693+
"- See scikit-learn's documentation for more information on [clustering algorithms](https://scikit-learn.org/stable/modules/clustering.html)."
694+
]
686695
}
687696
],
688697
"metadata": {
@@ -701,7 +710,7 @@
701710
"name": "python",
702711
"nbconvert_exporter": "python",
703712
"pygments_lexer": "ipython3",
704-
"version": "3.11.5"
713+
"version": "3.11.10"
705714
}
706715
},
707716
"nbformat": 4,

5-In-Class-assignment.ipynb

Lines changed: 150 additions & 68 deletions
Large diffs are not rendered by default.

model.pkl

553 KB
Binary file not shown.

0 commit comments

Comments
 (0)