{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"slideshow": {
"slide_type": "skip"
},
"tags": [
"hide-input"
]
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"\n",
"\n"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%%html\n",
"\n",
"\n",
"\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {
"tags": [
"remove-cell"
]
},
"source": [
"---\n",
"license:\n",
" code: MIT\n",
" content: CC-BY-4.0\n",
"github: https://github.com/ocademy-ai/machine-learning\n",
"venue: By Ocademy\n",
"open_access: true\n",
"bibliography:\n",
" - https://raw.githubusercontent.com/ocademy-ai/machine-learning/main/open-machine-learning-jupyter-book/references.bib\n",
"---"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "0MRC0e0KhQ0S",
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"# Model Selection"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"## Introduction\n",
"\n",
"* Model Selection is the process of choosing the best model among all the potential candidate models for a given problem. \n",
"* The aim of the model selection process is to select a machine learning algorithm that evaluates to perform well against all the different parameters."
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## Outline\n",
"\n",
"* Over-fitting and under-fitting\n",
"* Bias variance tradeoff\n",
"* L1 and L2 Regularization\n",
"* Early stopping\n",
"* Dropout\n",
"* Tuning the hyper-parameters of an estimator"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## Over-fitting and under-fitting\n",
"\n",
"- Regression\n",
" \n",
""
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"## Over-fitting and under-fitting\n",
"\n",
"- Regression\n",
" - Training data points\n",
"\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"## Over-fitting and under-fitting\n",
"\n",
"- Regression\n",
" - Over-fitting model fits very well on training data\n",
"\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"## Over-fitting and under-fitting\n",
"\n",
"- Regression\n",
" - Over-fitting model fits poorly on test data\n",
"\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"## Over-fitting and under-fitting\n",
"\n",
"- Regression\n",
" - Under-fitting model fits poorly on training data\n",
"\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"## Over-fitting and under-fitting\n",
"\n",
"- Regression\n",
" - Under-fitting model fits poorly on test data\n",
"\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"## Over-fitting and under-fitting\n",
"\n",
"- Classification\n",
"\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## Bias variance tradeoff\n",
"\n",
"- Graphical illustration of variance and bias \n",
"\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"## Bias variance tradeoff\n",
"\n",
"- Model complexity v.s. error\n",
"\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## L1 and L2 regularization\n",
"\n",
"$$L2\\ Loss = Loss + {\\lambda}\\sum_{i} w_i^2$$\n",
"\n",
"$$L1\\ Loss = Loss + {\\lambda}\\sum_{i} \\lvert w \\rvert$$"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"## L1 and L2 Regularization\n",
"\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"## L1 and L2 Regularization\n",
"\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"## L1 and L2 Regularization\n",
"\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"## L1 and L2 Regularization\n",
"\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"## L1 and L2 Regularization\n",
"- The impact of the value of $\\lambda$ \n",
" \n",
""
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## Early stopping\n",
" \n",
""
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"## Dropout\n",
" \n",
""
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"## Prediction after dropout\n",
" \n",
""
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"## Conclusions\n",
"\n",
"- Training size matters\n",
"\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"## Conclusions\n",
"\n",
"- How to choose a good model\n",
"\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"## Conclusions\n",
"\n",
""
]
}
],
"metadata": {
"celltoolbar": "Slideshow",
"colab": {
"authorship_tag": "ABX9TyOsvB/iqEjYj3VN6C/JbvkE",
"collapsed_sections": [],
"machine_shape": "hm",
"name": "logistic_regression.ipynb",
"provenance": [],
"toc_visible": true
},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"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.9"
}
},
"nbformat": 4,
"nbformat_minor": 1
}