{ "cells": [ { "cell_type": "markdown", "id": "8ddec272", "metadata": {}, "source": [ "# Practice 01 · My first notebook\n", "\n", "Machine Learning · DUT S3 · 2026-2027 · Dr. Soufiane Hourri\n", "\n", "**Before you start:** save this notebook as `Practice01_Lastname.ipynb` in your `ML_2026` folder, next to `penguins.csv`.\n", "\n", "Run a cell with **Shift+Enter**. Esc = command mode, Enter = edit mode. A/B = new cell above/below. M = Markdown, Y = code." ] }, { "cell_type": "markdown", "id": "63be4097", "metadata": {}, "source": [ "## Exercise 1 · A first notebook\n", "\n", "**1.** Double-click this cell and replace this text: write a title with `#`, your name in **bold**, and a list of today's goals with `-`. Then run the cell." ] }, { "cell_type": "markdown", "id": "b8ecd76b", "metadata": {}, "source": [ "*(Write here)*" ] }, { "cell_type": "markdown", "id": "874d2143", "metadata": {}, "source": [ "**2.** Store your name and your group in two variables, then print a sentence with an f-string." ] }, { "cell_type": "code", "execution_count": null, "id": "32c211ce", "metadata": {}, "outputs": [], "source": [ "name = \"\"\n", "group = \"\"\n", "# print(f\"...\")\n" ] }, { "cell_type": "markdown", "id": "2653147d", "metadata": {}, "source": [ "**3.** Compute the mean and the median of these grades by hand in Python (use `sum`, `len`, `sorted`)." ] }, { "cell_type": "code", "execution_count": null, "id": "8bcd06ed", "metadata": {}, "outputs": [], "source": [ "grades = [12, 15, 9, 14, 11, 16, 13]\n", "# your code\n" ] }, { "cell_type": "markdown", "id": "ccc134c4", "metadata": {}, "source": [ "**4.** Check your results with the `statistics` module (`statistics.mean`, `statistics.median`, `statistics.stdev`)." ] }, { "cell_type": "code", "execution_count": null, "id": "b3ba513e", "metadata": {}, "outputs": [], "source": [ "import statistics\n", "# your code\n" ] }, { "cell_type": "markdown", "id": "827338da", "metadata": {}, "source": [ "**5.** Kernel > Restart Kernel and Run All Cells. Does everything run without error? Save with Ctrl+S (Cmd+S on Mac)." ] }, { "cell_type": "markdown", "id": "9791349e", "metadata": {}, "source": [ "## Exercise 2 · Session 01 statistics, locally\n", "\n", "`penguins.csv` must be in the same folder as this notebook." ] }, { "cell_type": "code", "execution_count": null, "id": "c76bdec9", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import matplotlib.pyplot as plt\n", "\n", "df = pd.read_csv(\"penguins.csv\")\n", "print(df.shape)\n", "print(df.isna().sum())" ] }, { "cell_type": "markdown", "id": "c9c7c9e5", "metadata": {}, "source": [ "**1.** Mean, median, standard deviation, Q1 and Q3 of `body_mass_g`." ] }, { "cell_type": "code", "execution_count": null, "id": "09f94209", "metadata": {}, "outputs": [], "source": [ "# your code\n" ] }, { "cell_type": "markdown", "id": "d88cb4d6", "metadata": {}, "source": [ "**2.** Count the penguins of each species. Which species is the mode?" ] }, { "cell_type": "code", "execution_count": null, "id": "5201d32d", "metadata": {}, "outputs": [], "source": [ "# your code\n" ] }, { "cell_type": "markdown", "id": "aadbaa79", "metadata": {}, "source": [ "**3.** Draw a histogram of `flipper_length_mm`. How many peaks?" ] }, { "cell_type": "code", "execution_count": null, "id": "3e7eb544", "metadata": {}, "outputs": [], "source": [ "# your code\n" ] }, { "cell_type": "markdown", "id": "24db84ca", "metadata": {}, "source": [ "**4.** Correlation between `flipper_length_mm` and `body_mass_g`." ] }, { "cell_type": "code", "execution_count": null, "id": "69de3831", "metadata": {}, "outputs": [], "source": [ "# your code\n" ] }, { "cell_type": "markdown", "id": "77201fb7", "metadata": {}, "source": [ "**5.** Export this notebook: File > Save and Export Notebook As > HTML." ] }, { "cell_type": "markdown", "id": "c92c0486", "metadata": {}, "source": [ "## Exercise 3 · Environments (only if you finished)\n", "\n", "In Anaconda Prompt (Windows) or Terminal (macOS), not in the notebook:\n", "\n", "```\n", "conda create -n ml python=3.13 jupyterlab pandas scikit-learn seaborn\n", "conda activate ml\n", "conda env list\n", "jupyter lab\n", "```\n", "\n", "Write below: what does the prompt show after `conda activate ml`? What does `conda env list` display?" ] }, { "cell_type": "markdown", "id": "a3f481cd", "metadata": {}, "source": [ "*(Your answer)*" ] } ], "metadata": {}, "nbformat": 4, "nbformat_minor": 5 }