{ "cells": [ { "cell_type": "markdown", "metadata": { "id": "xatbmi443EQ2" }, "source": [ "# 2 Efficient Data Manipulation Using NumPy" ] }, { "cell_type": "markdown", "metadata": { "id": "ZnDK0n3q3EQ3" }, "source": [ "In data science, the moment you collect numeric measurements, the next question is how to store and manipulate them efficiently so you can clean them, summarize them, and eventually visualize and model them. In this notebook, we will learn about NumPy, a core numerical computation library in Python. The notebook covers what NumPy arrays are, why they are more suitable than standard Python lists for numerical data, and how to perform the various operations that you will need when conducting data analysis.\n", "\n", "NumPy also serves as a basis of other Python libraries that are frequently used for data science, so let's make sure you have a good understanding of it here.\n", "If you would like to learn NumPy more, please refer to the official documentation ([https://numpy.org/](https://numpy.org/))." ] }, { "cell_type": "markdown", "metadata": { "id": "LSO0iTUH3EQ4" }, "source": [ "### Table of Contents\n", "\n", "- **2.1 Overview of NumPy**\n", " - 2.1.1 Loading Libraries\n", "\n", "- **2.2 Introduction to NumPy**\n", " - 2.2.1 Basic Operations\n", " - 2.2.2 Python Lists vs. NumPy Arrays\n", "\n", "- **2.3 NumPy Indexing 1**\n", " - 2.3.1 Single Element Indexing\n", " - 2.3.2 Slicing\n", " - 2.3.3 Boolean Indexing\n", "\n", "- **2.4 NumPy 2D Arrays**\n", " - 2.4.1 Creating 2D Arrays\n", " - 2.4.2 Math Operations\n", " - 2.4.3 Axis and Aggregation Functions\n", "\n", "- **2.5 NumPy Indexing 2**\n", " - 2.5.1 Indexing\n", " - 2.5.2 Slicing\n", " - 2.5.3 Boolean Indexing\n", "\n", "- **2.6 NumPy Advanced**\n", " - 2.6.1 Constants\n", " - 2.6.2 NumPy Arrays with Random Values\n", " - 2.6.3 Matrix Calculation\n", "\n", "- **2.7 Comprehensive Question**" ] }, { "cell_type": "markdown", "metadata": { "id": "3VusLSTc3EQ4" }, "source": [ "## 2.1 Overview of NumPy\n", "In data science and machine learning, most “data” eventually becomes numbers arranged as vectors (1D) and matrices (2D), and progress comes from repeatedly applying the same mathematical operations—transformations, summaries, and linear algebra—at scale. Python’s built-in types like lists are **great for general-purpose programming**, but they are **not designed for efficient numerical computation**. For example, you may experience writing many loops, re-implementing common routines, and producing code that is harder to read and slower to run as the dataset grows. **NumPy** fills that gap by providing a **dedicated array object** and a rich set of fast, consistent operations for numerical data, which is why it sits underneath much of the Python data stack." ] }, { "cell_type": "markdown", "metadata": { "id": "iM7d8x1sx1ql" }, "source": [ "### 2.1.1 Loading Libraries\n", "\n", "We will first need to import the NumPy library.\n", "\n", "In Python, there are mainly two syntaxes for loading a library.\n", "\n", "```\n", "(1) `import` library_name `as` alias\n", "\n", "(2) `from` library_name `import` module/function_name\n", "```\n", "\n", "(1) is used to load the entire library.\n", "\n", "(2) can be used to load modules or functions in a hierarchical library.\n", "\n", "Use it according to your purpose." ] }, { "cell_type": "markdown", "metadata": { "id": "JVvXw2AnlmZy" }, "source": [ "The following cell imports NumPy library with the alias `np`. NumPy is generally loaded with the alias `np`. You can choose to use other aliases, but this may result in lower interpretability of the code." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "id": "dskC6jiOyMY-" }, "outputs": [], "source": [ "import numpy as np" ] }, { "cell_type": "markdown", "metadata": { "id": "HSy_GBSayNiE" }, "source": [ "NumPy is hierarchical in its functionality, consisting of many modules and functions to serve various purposes (e.g. random generator, matrix operation, etc.). In the following cell, we will import specific modules using `from numpy import module_name`." ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "id": "bZBEO9B0yZyo" }, "outputs": [], "source": [ "from numpy import random\n", "from numpy import linalg as LA" ] }, { "cell_type": "markdown", "metadata": { "id": "jdxx6M_yygxq" }, "source": [ "This imports `random` and `linalg` module from NumPy library. For `linalg` module, it is imported with the alias `LA`. By doing this, you can code more efficiently as you can write, for example, `random.function_name()` instead of `np.random.function_name()`." ] }, { "cell_type": "markdown", "metadata": { "id": "o36iW7613EQ_" }, "source": [ "## 2.2 Introduction to NumPy\n", "\n", "NumPy is a powerful library for numerical computing in Python. It provides support for arrays, matrices, and a vast collection of mathematical functions to operate on them. While Python list is mainly a flexible container for holding objects, NumPy array (`numpy.ndarray`) is a multi-dimensional data structure that can hold elements of the same data type. It is optimized for optimized for numerical operations by storing data in a compact and contiguous memory block. This makes NumPy a perfect choice to store and analyze data efficiently and conveniently, making them the backbone of many machine learning and data science workflows.\n", "\n", "Python's List can easily be converted into a `numpy.ndarray` using the `np.array()` function.\n" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 18, "status": "ok", "timestamp": 1786168098014, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "ubHU-j_f3ERS", "outputId": "81168776-f5c0-4c7d-fdca-84a175d6069a" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "a: [1 2 3 4 5]\n", "b: [ 6 7 8 9 10]\n", "type of a: \n", "type of b: \n" ] } ], "source": [ "# Python list\n", "a = [1, 2, 3, 4, 5]\n", "b = [6, 7, 8, 9, 10]\n", "\n", "# Convert list to np.ndarray\n", "a = np.array(a)\n", "b = np.array(b)\n", "\n", "print(\"a: \", a)\n", "print(\"b: \", b)\n", "# Checking the type of a and b\n", "print(\"type of a:\", type(a))\n", "print(\"type of b:\", type(b))" ] }, { "cell_type": "markdown", "metadata": { "id": "gPTynie0lmZ0" }, "source": [ "To convert from `np.ndarray` to a Python list, you can use the `.tolist()` method." ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 59, "status": "ok", "timestamp": 1786168098075, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "kR4J2F54lmZ0", "outputId": "d46d3f26-f184-4f3b-a405-a16f5f29099c" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[1, 2, 3, 4, 5]\n", "\n" ] } ], "source": [ "a_list = a.tolist() # Convert np.ndarray back to list\n", "\n", "print(a_list)\n", "print(type(a_list))" ] }, { "cell_type": "markdown", "metadata": { "id": "iX_X8ve54s0G" }, "source": [ "Key Features of `numpy.ndarray`:\n", "- **Homogeneous**: All elements are of the same type.\n", "- **Efficient**: Designed for performance in numerical computations.\n", "- **Flexible**: Supports slicing, indexing, and advanced operations." ] }, { "cell_type": "markdown", "metadata": { "id": "UJVveJuLlmZ0" }, "source": [ "### 2.2.1 Basic Operations\n", "\n", "In this section, we will introduce the basic operations of `np.ndarray`. The fundamental concept of NumPy operations here is **universal**. By universal operations, we mean applying operations individually to each element of an array.\n", "\n", "Let’s experience this by looking at some examples. Here, we will assume as situation where the target data is available on the Web as a CSV file, which can be downloaded and used.\n", "\n", "Although it is possible to download the data in advance from a browser, Python can also directly read and save the data, so this section explains how to download the data using NumPy." ] }, { "cell_type": "markdown", "metadata": { "id": "eeRAwnRGlmZ0" }, "source": [ "#### Downloading the Dataset\n", "We will use the [sample dataset from NOAA](https://www.ncdc.noaa.gov/cdo-web/datasets) which contains data of daily temperature and precipitation recorded at one of the weather observing stations operated by NOAA (National Oceanic and Atmospheric Administration, USA).\n", "\n", "The first few rows of the data looks like this:\n", "| STATION | STATION_NAME | ELEVATION | LATITUDE | LONGITUDE | DATE | TMAX | TMIN | PRCP |\n", "|:---:|:---|:---|:---|:---|:---|:---|:---|:---|\n", "| GHCND:USC00327027 | PETERSBURG 2 N ND US | 466.3 | 48.0355 | -98.01 | 20100101 | -178 | -311 | 0 |\n", "| GHCND:USC00327027 | PETERSBURG 2 N ND US | 466.3 | 48.0355 | -98.01 | 20100102 | -244 | -322 | 0 |\n", "| GHCND:USC00327027 | PETERSBURG 2 N ND US | 466.3 | 48.0355 | -98.01 | 20100103 | -194 | -289 | 0 |\n", "| GHCND:USC00327027 | PETERSBURG 2 N ND US | 466.3 | 48.0355 | -98.01 | 20100104 | -167 | -200 | 15 |\n", "\n", "The columns represent:\n", "- `STATION`, `STATION_NAME`, `ELEVATION`, `LATITUDE`, `LONGITUDE`: location of the station\n", "- `DATE`: date of record in YYYYMMDD format\n", "- `TMAX`: maximum temperature, measured in tenths of degrees Celsius ($^\\circ{C}$)\n", "- `TMIN`: minimum temperature, measured in tenths of degrees Celsius ($^\\circ{C}$)\n", "- `PRCP`: precipitation, measured in tenths of millimeters ($mm$)\n", "\n", "To download and load the dataset as `np.array`, we will use `np.loadtxt()` function. The extra arguments are used to shape the data in the desired format:\n", "- `delimiter=','`: specify delimiter as a comma ',' (default)\n", "- `usecols=[6,7,8]`: import 7th to 9th columns from the CSV (note: Python indices start from 0)\n", "- `skiprows=1`: do not use the 1st row, as this is a header row\n", "\n", "Run the following cell to download and load the data." ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "id": "ygrHTXWJlmZ0" }, "outputs": [], "source": [ "URL = \"https://www.ncei.noaa.gov/pub/data/cdo/samples/GHCND_sample_csv.csv\"\n", "\n", "raw = np.loadtxt(URL, delimiter=\",\", usecols=[6,7,8], skiprows=1)" ] }, { "cell_type": "markdown", "metadata": { "id": "c6KyCGbUlmZ0" }, "source": [ "For the remaining of this section, we will use only a subset of the data for simplicity by slicing the data (details on slicing will be covered in 2.3.2)." ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 32, "status": "ok", "timestamp": 1786168098112, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "8WN4Cre0lmZ0", "outputId": "433ced10-c089-46d1-9f88-4f872cfe0285" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Week 1 TMAX: [-178. -244. -194. -167. -133. -133. -150.]\n", "Week 1 TMIN: [-311. -322. -289. -200. -167. -172. -278.]\n", "Week 1 PRCP: [ 0. 0. 0. 15. 9999. 9999. 0.]\n" ] } ], "source": [ "week_one_tmax = raw[0:7, 0]\n", "week_one_tmin = raw[0:7, 1]\n", "week_one_prcp = raw[0:7, 2]\n", "week_two_tmax = raw[7:14, 0]\n", "print(\"Week 1 TMAX:\", week_one_tmax)\n", "print(\"Week 1 TMIN:\", week_one_tmin)\n", "print(\"Week 1 PRCP:\", week_one_prcp)" ] }, { "cell_type": "markdown", "metadata": { "id": "Ri-Y_EgmlmZ1" }, "source": [ "The length of a one-dimensional array can be obtained using `len()`, just like for Python lists. However, it is more common to use `shape` attribute of the array." ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 25, "status": "ok", "timestamp": 1786168098115, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "wAaXo2BOlmZ1", "outputId": "9ca63983-1d7e-4824-b0fa-d4951b206899" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Size of Week 1 TMAX: 7\n", "Size of Week 1 TMAX: (7,)\n" ] } ], "source": [ "# Check the size of the arrays\n", "print(\"Size of Week 1 TMAX:\", len(week_one_tmax))\n", "\n", "# Alternatively, we can check the shape of the arrays\n", "print(\"Size of Week 1 TMAX:\", week_one_tmax.shape)" ] }, { "cell_type": "markdown", "metadata": { "id": "VowQf8z9lmZ1" }, "source": [ "#### Math Operations\n", "\n", "Math operations can be performed using the same symbols as in regular Python numeric types. These operations return the result for each element individually (**universal!**)\n", "\n", "```python\n", "a = np.array([1, 2, 3, 4, 5])\n", "b = np.array([2, 2, 3, 6, 1])\n", "\n", "print(\"Sum:\", a + b)\n", "> Sum: [ 3 4 6 10 6]\n", "print(\"Difference:\", a - b)\n", ">\n", "Difference: [-1 0 0 -2 4]\n", "print(\"Product:\", a * b)\n", ">\n", "Product: [ 2 4 9 24 5]\n", "print(\"Quotient:\", a / b)\n", "> Quotient: [0.5 1. 1. 0.66666667 5.]\n", "```\n", "\n", "Let's look at this using the NOAA data.\n", "\n", "Since `TMAX` and `TMIN` are measured in tenths of degrees Celsius, we can divide by 10 to convert to degrees Celsius. `PRCP` should be divided by 10 to convert to millimeters." ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 51, "status": "ok", "timestamp": 1786168098165, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "s4vejHowlmZ1", "outputId": "fcac016e-5079-47d1-f2f1-058968a1c68f" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Week 1 TMAX (in Celsius): [-17.8 -24.4 -19.4 -16.7 -13.3 -13.3 -15. ]\n", "Week 1 TMIN (in Celsius): [-31.1 -32.2 -28.9 -20. -16.7 -17.2 -27.8]\n", "Week 1 PRCP (in mm): [ 0. 0. 0. 1.5 999.9 999.9 0. ]\n" ] } ], "source": [ "week_one_tmax = week_one_tmax / 10\n", "week_one_tmin = week_one_tmin / 10\n", "week_one_prcp = week_one_prcp / 10\n", "print(\"Week 1 TMAX (in Celsius):\", week_one_tmax)\n", "print(\"Week 1 TMIN (in Celsius):\", week_one_tmin)\n", "print(\"Week 1 PRCP (in mm):\", week_one_prcp)" ] }, { "cell_type": "markdown", "metadata": { "id": "a7-PMVdxlmZ1" }, "source": [ "We can then calculate metrics such as daily temperature range." ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 34, "status": "ok", "timestamp": 1786168098166, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "dkcZePLHlmZ1", "outputId": "4e8650da-0e69-4b14-acf4-ab55c0a15d1e" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Week 1 TRANGE (in Celsius): [13.3 7.8 9.5 3.3 3.4 3.9 12.8]\n" ] } ], "source": [ "week_one_trange = week_one_tmax - week_one_tmin\n", "print(\"Week 1 TRANGE (in Celsius):\", week_one_trange)" ] }, { "cell_type": "markdown", "metadata": { "id": "jjMaIK5RlmZ1" }, "source": [ "Other functions, such as built-in functions of Python lists (such as `max` and `sum`) are also implemented in NumPy." ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 19, "status": "ok", "timestamp": 1786168098167, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "sos6M05tlmZ1", "outputId": "418eafb5-3b5c-43f0-adcf-38b15e44e3c5" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Hottest day in Week 1: -13.3\n", "Total rainfall in Week 1: 2001.3\n", "Average TMAX in Week 1: -17.128571428571426\n", "Standard deviation of TMAX in Week 1: 3.6354265954097102\n" ] } ], "source": [ "print(\"Hottest day in Week 1:\", np.max(week_one_tmax))\n", "print(\"Total rainfall in Week 1:\", np.sum(week_one_prcp))\n", "print(\"Average TMAX in Week 1:\", np.mean(week_one_tmax)) # mean is the average\n", "print(\"Standard deviation of TMAX in Week 1:\", np.std(week_one_tmax)) # std is the standard deviation" ] }, { "cell_type": "markdown", "metadata": { "id": "wb5JH2TWlmZ1" }, "source": [ "##### Note: Division by zero\n", "\n", "In standard Python, division by zero leads to an error." ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 146 }, "executionInfo": { "elapsed": 8, "status": "error", "timestamp": 1786168098172, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "T4DRB8YIlmZ1", "outputId": "958203fc-2bfe-4598-e9e6-d8cbab40e3f1" }, "outputs": [ { "ename": "ZeroDivisionError", "evalue": "division by zero", "output_type": "error", "traceback": [ "\u001b[31m---------------------------------------------------------------------------\u001b[39m", "\u001b[31mZeroDivisionError\u001b[39m Traceback (most recent call last)", "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[13]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m \u001b[32;43m2\u001b[39;49m\u001b[43m \u001b[49m\u001b[43m/\u001b[49m\u001b[43m \u001b[49m\u001b[32;43m0\u001b[39;49m\n", "\u001b[31mZeroDivisionError\u001b[39m: division by zero" ] } ], "source": [ "2 / 0" ] }, { "cell_type": "markdown", "metadata": { "id": "GzJn1daflmZ1" }, "source": [ "However, NumPy processes this differently." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 43, "status": "ok", "timestamp": 1786168101854, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "BAgD1hY1lmZ1", "outputId": "d1478adb-e82b-441e-83c0-6792b3213cfd" }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_2627/3476717761.py:3: RuntimeWarning: divide by zero encountered in divide\n", " a / 0\n" ] }, { "data": { "text/plain": [ "array([inf, inf, inf])" ] }, "execution_count": 67, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a = np.array([1, 2, 3])\n", "\n", "a / 0" ] }, { "cell_type": "markdown", "metadata": { "id": "fqbBestylmZ1" }, "source": [ "In the example, `inf` appears because of division by zero. This is a special number defined by numpy as `np.inf`, representing infinity. Additionally, a warning message is displayed indicating a division by zero occurred.\n", "Some functions in libraries like scikit-learn, which will be covered in this course, may raise errors if `np.inf` is present." ] }, { "cell_type": "markdown", "metadata": { "id": "glGWCn2wlmZ1" }, "source": [ "#### Other Functions\n", "\n", "Other mathematical functions implemented are also computed universally. We provide some examples below.\n", "\n", "Precipitation distributions are usually very skewed (lots of dry days, a few heavy rain days). A common way to transform this data is `np.log1p()`, which calculates $\\log(1+x)$." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 66, "status": "ok", "timestamp": 1786168103333, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "h9QNAVdMlmZ1", "outputId": "887d82dc-ec4b-495d-b4ef-482ed420960d" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Log-transformed PRCP: [0. 0. 0. 0.91629073 6.90865487 6.90865487\n", " 0. ]\n" ] } ], "source": [ "log_prcp = np.log1p(week_one_prcp) # log1p to avoid log(0)\n", "print(\"Log-transformed PRCP:\", log_prcp)" ] }, { "cell_type": "markdown", "metadata": { "id": "tMAk_4wQlmZ2" }, "source": [ "This can be converted back by using `np.expm1()`, which calculates $\\exp(x)-1$." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 171, "status": "ok", "timestamp": 1786168104734, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "4lipzilvlmZ2", "outputId": "5407d376-9b84-4759-c542-385314c6aa7d" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Inverse log-transformed PRCP: [ 0. 0. 0. 1.5 999.9 999.9 0. ]\n" ] } ], "source": [ "inv_prcp = np.expm1(log_prcp) # expm1 to reverse log1p\n", "print(\"Inverse log-transformed PRCP:\", inv_prcp)" ] }, { "cell_type": "markdown", "metadata": { "id": "OrBN4zAElmZ2" }, "source": [ "To view the entire list of universal functions, please refer to the [documentation](https://numpy.org/doc/stable/reference/ufuncs.html)." ] }, { "cell_type": "markdown", "metadata": { "id": "uY08gJNilmZ2" }, "source": [ "#### Conditional Operations\n", "\n", "In Python, normal conditional operations (like `==` or `>`) return boolean values (`True` or `False`).\n", "\n", "```python\n", "3 > 5\n", "> False\n", "```\n", "\n", "With `np.ndarray`, conditional operation returns the result of the conditional operation for each element as `np.ndarray`, not a bool value (**universal!**). This is different from the behavior with Python lists.\n", "\n", "```python\n", "a = np.array([1, 2, 3, 4, 5])\n", "b = np.array([2, 2, 3, 6, 1])\n", "\n", "print(\"a==a:\", a==a)\n", "> a==a: [ True True True True True]\n", "print(\"a==b:\", a==b)\n", "> a==b: [False True True False False]\n", "print(\"a>b:\", a>b)\n", "> a>b: [False False False False True]\n", "print(\"Type of a==b:\", a==b)\n", "> Type of a==b: \n", "```\n", "\n", "Let's look at this using the NOAA data.\n", "\n", "For example, we can find which days did not rain by comparing `PRCP` with 0." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 100, "status": "ok", "timestamp": 1786168106371, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "niVBBk0_lmZ2", "outputId": "88a118df-4537-4a1e-9034-12764ab042f4" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Week 1 precipitation is zero: [ True True True False False False True]\n", "Type of the boolean array: \n" ] } ], "source": [ "print(\"Week 1 precipitation is zero:\", week_one_prcp == 0)\n", "print(\"Type of the boolean array:\", type(week_one_prcp == 0))" ] }, { "cell_type": "markdown", "metadata": { "id": "URq_zPEqlmZ2" }, "source": [ "We can also find the days in which the minimum temperature is below -10 degrees Celsius." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 163, "status": "ok", "timestamp": 1786168108018, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "0vYugAcKlmZ2", "outputId": "a1efc9a8-5d0a-44a1-f4ad-d5ac3ed75964" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Week 1 TMIN less than -10°C: [ True True True True True True True]\n" ] } ], "source": [ "print(\"Week 1 TMIN less than -10°C:\", week_one_tmin < -10)" ] }, { "cell_type": "markdown", "metadata": { "id": "vJSXv8holmZ2" }, "source": [ "#### Broadcasting\n", "\n", "In NumPy, when performing a universal binary operation on two arrays with different lengths or dimensions, one of the arrays is automatically broadcast to match the other in terms of dimensions and length. This is called **broadcasting**.\n", "\n", "Let's learn about broadcasting using one-dimensional arrays (vectors) as an example." ] }, { "cell_type": "markdown", "metadata": { "id": "BsEEWLaSlmZ2" }, "source": [ "The simplest broadcasting example is when an arry and a scalar value are combined in an operation." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 31, "status": "ok", "timestamp": 1786168109228, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "al3vLYC-lmZ2", "outputId": "0d28f51f-2897-4ad5-e0ee-e6334e2b92db" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2a = [2 4 6]\n" ] } ], "source": [ "a = np.array([1, 2, 3])\n", "\n", "print(\"2a =\", 2 * a)" ] }, { "cell_type": "markdown", "metadata": { "id": "1CXH7fEQlmZ2" }, "source": [ "The number `2` is an `int`, and NumPy treats it as a 0-dimensional array (scalar). However, to perform a universal binary operation like * with the 1-dimensional array a (which has length 3), the other operand must also be a 1-dimensional array of length 5.\n", "\n", "Here, NumPy first automatically converts `2` into a 0-dimensional `np.array(2)`. Then, to match the dimensions, it converts it into a 1-dimensional array `np.array([2])`. To match the length, NumPy automatically expands `np.array([2])` into `np.array([2, 2, 2])`, repeating the same value, and then performs the calculation." ] }, { "cell_type": "markdown", "metadata": { "id": "1eVA92yJlmZ2" }, "source": [ "![Numpy broadcast](https://numpy.org/doc/stable/_images/broadcasting_1.png)" ] }, { "cell_type": "markdown", "metadata": { "id": "qgqusvpRlmZ2" }, "source": [ "Reference URL: https://numpy.org/doc/stable/_images/broadcasting_1.png" ] }, { "cell_type": "markdown", "metadata": { "id": "s8MdgLaMlmZ2" }, "source": [ "You can see this by performing the following calculation and checking that it outputs the same result." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 39, "status": "ok", "timestamp": 1786168110914, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "6jglfKKMlmZ2", "outputId": "0b16f9de-fb84-45dd-c29e-76ecdb326bb5" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2a = [2 4 6]\n" ] } ], "source": [ "twos = np.array([2, 2, 2])\n", "\n", "print(\"2a =\", twos * a)" ] }, { "cell_type": "markdown", "metadata": { "id": "MGEMt-PAlmZ2" }, "source": [ "Now, let's consider what happens when we perform a binary operation on two 1-dimensional arrays." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 183 }, "executionInfo": { "elapsed": 43, "status": "error", "timestamp": 1786168112573, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "4TXnWnlXlmZ2", "outputId": "8483e53b-a6d3-4d3d-eb2a-5f6d055dd5e3" }, "outputs": [ { "ename": "ValueError", "evalue": "operands could not be broadcast together with shapes (5,) (2,) ", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m/tmp/ipykernel_2627/1876273761.py\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0mc\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0marray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"b + c =\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mb\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mc\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m# This will raise an error due to shape mismatch\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;31mValueError\u001b[0m: operands could not be broadcast together with shapes (5,) (2,) " ] } ], "source": [ "b = np.array([1, 2, 3, 4, 5])\n", "c = np.array([1, 2])\n", "\n", "print(\"b + c =\", b + c) # This will raise an error due to shape mismatch" ] }, { "cell_type": "markdown", "metadata": { "id": "UKvvpoAQlmZ2" }, "source": [ "An error will occur here. In broadcasting, when aligning dimensions and lengths, the length must be 1 in order for NumPy to repeat and match the length. If the length is not 1, NumPy cannot automatically broadcast the array." ] }, { "cell_type": "markdown", "metadata": { "id": "-kDxD9ld3ERB" }, "source": [ "### 2.2.2 Python Lists vs. NumPy Arrays\n", "\n", "#### Why Use NumPy?\n", "As explained preivously, in data science, you spend most of your time doing numeric operations on collections of values: converting units, computing statistics, filtering rows, and preparing feature matrices for plotting and machine learning. Python lists can store those values, but they are general-purpose containers, not numeric computing tools. **NumPy arrays are designed for this purpose at scale**:\n", "- **Convenience**: It provides a rich set of functions for numerical tasks.\n", "- **Performance**: NumPy operations are optimized using C and Fortran, leading to faster computations even for large datasets." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "IeOhZHTSlmZ3" }, "outputs": [], "source": [ "# Convert week_one_tmax and week_one_tmin to lists for demonstration\n", "week_one_tmax_list = week_one_tmax.tolist()\n", "week_one_tmin_list = week_one_tmin.tolist()" ] }, { "cell_type": "markdown", "metadata": { "id": "gZmUobFulmZ3" }, "source": [ "#### NumPy's Strengths (1): Convenience" ] }, { "cell_type": "markdown", "metadata": { "id": "U7wdnGDvlmZ3" }, "source": [ "##### Example 1: Single list/array operation\n", "\n", "Using NOAA dataset, let's consider calculating the mean `TMAX`.\n", "\n", "When using Python lists, you would need to write the following." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 40, "status": "ok", "timestamp": 1786168117114, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "sJM1rT5klmZ3", "outputId": "0355abf1-dbe0-4ca3-f79b-e78f59ac79f3" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Average TMAX in Week 1: -17.12857142857143\n" ] } ], "source": [ "week_one_tmax_list_mean = sum(week_one_tmax_list) / len(week_one_tmax_list)\n", "print(\"Average TMAX in Week 1:\", week_one_tmax_list_mean)" ] }, { "cell_type": "markdown", "metadata": { "id": "62Jy28ZvlmZ3" }, "source": [ "However, NumPy allows to do this operation much conveniently, as the function is already implemented." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 24, "status": "ok", "timestamp": 1786168118394, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "MrbkIN-6lmZ3", "outputId": "e855313a-ea26-4d7b-de1d-7494b85b1c29" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Average TMAX in Week 1: -17.128571428571426\n" ] } ], "source": [ "week_one_tmax_mean = np.mean(week_one_tmax)\n", "print(\"Average TMAX in Week 1:\", week_one_tmax_mean)" ] }, { "cell_type": "markdown", "metadata": { "id": "oqhXCmvslmZ3" }, "source": [ "##### Example 2: Multiple list/array operation\n", "\n", "Next, consider calculating the mean range of temperature." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 54, "status": "ok", "timestamp": 1786168119840, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "UmfIRwQTlmZ3", "outputId": "b5d5875a-7a07-45ba-80f1-0c8bc85e6f3f" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Average range of temperature in Week 1: 7.714285714285714\n" ] } ], "source": [ "def mean_range(tmin_list, tmax_list):\n", " assert len(tmin_list) == len(tmax_list) # Return an error if the lengths of the lists are not the same\n", "\n", " trange_list = []\n", " for tmin, tmax in zip(tmin_list, tmax_list):\n", " trange = tmax - tmin\n", " trange_list.append(trange)\n", "\n", " return sum(trange_list) / len(trange_list)\n", "\n", "week_one_trange_list_mean = mean_range(week_one_tmin_list, week_one_tmax_list)\n", "print(\"Average range of temperature in Week 1:\", week_one_trange_list_mean)" ] }, { "cell_type": "markdown", "metadata": { "id": "_9dbRtLXlmZ3" }, "source": [ "Again, NumPy allows to do this operation conveniently." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 44, "status": "ok", "timestamp": 1786168120497, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "63FzbA8hlmZ3", "outputId": "b6897843-4449-4fdf-9ba0-4e2c9698bbae" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Average range of temperature in Week 1: 7.714285714285714\n" ] } ], "source": [ "print(\"Average range of temperature in Week 1:\", np.mean(week_one_tmax - week_one_tmin))" ] }, { "cell_type": "markdown", "metadata": { "id": "YMhP1q_l3ERY" }, "source": [ "NumPy already provides a rich set of basic operations and functions, so there's no need to implement them from scratch in Python." ] }, { "cell_type": "markdown", "metadata": { "id": "7RV01PAp3ERY" }, "source": [ "#### NumPy's Strengths (2): Performance\n", ">\n", "Another major advantage to using NumPy is its **execution time**. NumPy is internally written in C, and for matrix operations, it uses a high-performance matrix computation library called the BLAS API, which makes it much faster than Python for similar tasks." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 36, "status": "ok", "timestamp": 1786168121953, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "8v85NYVP5gPs", "outputId": "53f53864-420a-41fd-f9ae-4a5c9fa10bf4" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Python List Summation Time: 0.011117935180664062\n", "NumPy Array Summation Time: 0.0011012554168701172\n" ] } ], "source": [ "import time\n", "\n", "# Create a large Python list and a NumPy array\n", "size = 10**6\n", "python_list = list(range(size))\n", "numpy_array = np.arange(size)\n", "\n", "# Time the summation for Python list\n", "start = time.time()\n", "list_sum = sum(python_list)\n", "end = time.time()\n", "print(\"Python List Summation Time:\", end - start)\n", "\n", "# Time the summation for NumPy array\n", "start = time.time()\n", "array_sum = np.sum(numpy_array)\n", "end = time.time()\n", "print(\"NumPy Array Summation Time:\", end - start)" ] }, { "cell_type": "markdown", "metadata": { "id": "ldqUuUnglmZ3" }, "source": [ "Try changing the `size` and see how their performance changes." ] }, { "cell_type": "markdown", "metadata": { "id": "WDTz7XdjlmZ3" }, "source": [ "#### Side Note: Concatenation of list vs numpy array\n", "\n", "In data analysis, you sometimes need to extend a time series: for example, you loaded one month of precipitation and then you want to attach the next month. With Python lists, `+` means concatenation." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 71, "status": "ok", "timestamp": 1786168123850, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "GtvN3cDmlmZ3", "outputId": "422b603f-1ef2-48bf-bf80-6b558971b609" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Combined Week 1 and Week 2 TMAX list: [-17.8, -24.4, -19.4, -16.7, -13.3, -13.3, -15.0, -233.0, -233.0, -117.0, -67.0, -78.0, -17.0, 39.0]\n" ] } ], "source": [ "week_one_tmax_list = week_one_tmax.tolist()\n", "week_two_tmax_list = week_two_tmax.tolist()\n", "\n", "week_one_two_tmax_list = week_one_tmax_list + week_two_tmax_list\n", "print(\"Combined Week 1 and Week 2 TMAX list:\", week_one_two_tmax_list)" ] }, { "cell_type": "markdown", "metadata": { "id": "Lx-YhB1AlmZ3" }, "source": [ "With NumPy arrays, `+` means elementwise addition. Instead, NumPy allows concatenation using `np.concatenate()` function." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 24, "status": "ok", "timestamp": 1786168098454, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "sGFgKQg-lmZ3", "outputId": "b9365532-4176-4609-c6be-ba30fcd9b253" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Combined Week 1 and Week 2 TMAX array: [ -17.8 -24.4 -19.4 -16.7 -13.3 -13.3 -15. -233. -233. -117.\n", " -67. -78. -17. 39. ]\n" ] } ], "source": [ "week_one_two_tmax = np.concatenate((week_one_tmax, week_two_tmax))\n", "print(\"Combined Week 1 and Week 2 TMAX array:\", week_one_two_tmax)" ] }, { "cell_type": "markdown", "metadata": { "id": "kOvmGtTmzAZN" }, "source": [ "### " ] }, { "cell_type": "markdown", "metadata": { "id": "esZnke5hzCe5" }, "source": [ "(1) Create two one-dimensional `np.ndarray` arrays with a length of three, one with even numbers as elements, and one with odd numbers as elements. Then use the `type()` function to confirm that they are of type `np.ndarray`." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "FKiCrrqpzgHL" }, "outputs": [], "source": [ "# (1)\n", "# WRITE ME" ] }, { "cell_type": "markdown", "metadata": { "id": "DwF4j7KbzjvU" }, "source": [ "(2) Add the two arrays that you created in (1) and confirm that it results in element-wise addition of the two arrays." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "yXiRm45kz3tG" }, "outputs": [], "source": [ "# (2)\n", "# WRITE ME" ] }, { "cell_type": "markdown", "metadata": { "id": "E-YFpwsQ0ShF" }, "source": [ "(3) Create a function `normalize(a)` that takes a one-dimensional array as an argument and outputs a one-dimensional array where the input is normalized.\n", "\n", "Here, normalization of a vector means scaling the original vector so that the square root of the sum of the squares of all its elements, which is called the L2 norm, equals 1.\n", "\n", "In this task, please implement the function using only **NumPy's universal operations and functions**.\n", "\n", "Hint: Let's try and normalize the vector $v=(1,1,1)$ by hand. The L2 norm of $v$ ,denoted as $||v||_2$, is $||v||_2 = \\sqrt{1^2+1^2+1^2}=\\sqrt{3}$. If we scale the original vector $v$ by the reciprocal of the L2 norm $\\frac{1}{\\sqrt{3}}$, we get a new vector $v' = (\\frac{1}{\\sqrt{3}},\\frac{1}{\\sqrt{3}},\\frac{1}{\\sqrt{3}})$. We can confirm that the L2 norm of $v'$ is 1:\n", " $$||v'|| = \\sqrt{(\\frac{1}{\\sqrt{3}})^2+(\\frac{1}{\\sqrt{3}})^2+(\\frac{1}{\\sqrt{3}})^2} = \\sqrt{\\frac13+\\frac13+\\frac13}=1$$\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "LJBCCtFo0WUb" }, "outputs": [], "source": [ "def normalize(a):\n", " # WRITE ME\n", " return a" ] }, { "cell_type": "markdown", "metadata": { "id": "ALIEos7elmZ3" }, "source": [ "## 2.3 NumPy Indexing 1\n", "In this section, you will learn how to use indexing with `np.ndarray` in 1D arrays.\n", "\n", "We will continue working with the NOAA dataset. Using slicing (see Section 2.3.2), we will only use the data from January, 2010 (note: the data starts from January 1st, 2010)." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "lJQgwgY6lmZ4" }, "outputs": [], "source": [ "jan_tmax = raw[0:31, 0]\n", "jan_tmin = raw[0:31, 1]\n", "jan_prcp = raw[0:31, 2]\n", "\n", "jan_tmax = jan_tmax / 10\n", "jan_tmin = jan_tmin / 10\n", "jan_prcp = jan_prcp / 10" ] }, { "cell_type": "markdown", "metadata": { "id": "dOP2oAVFlmZ4" }, "source": [ "### 2.3.1 Single Element Indexing\n", "Just as for Python lists, you can retrieve values of NumPy's 1D arrays at any position using `[]`. The use of negative indices corresponds to counting from the end of the array.\n", "\n", "Note:\n", "- Indexing starts from 0\n", "- Indexing from the back starts from -1\n", "\n", "```python\n", "a = np.array([1, 2, 3, 4, 5])\n", "\n", "a[0]\n", "> 1\n", "a[1]\n", "> 2\n", "a[-1]\n", "> 5\n", "a[-2]\n", "> 4\n", "```" ] }, { "cell_type": "markdown", "metadata": { "id": "T1PMrbudlmZ4" }, "source": [ "For example, we can find out what was the maximum temperature (`TMAX`) on the first recorded day." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 23, "status": "ok", "timestamp": 1786168098498, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "sFLgY1wDlmZ4", "outputId": "1d8f3f84-6a15-4c23-8f5c-781fd49ef0c8" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "First day of January TMAX: -17.8\n" ] } ], "source": [ "print(\"First day of January TMAX:\", jan_tmax[0])" ] }, { "cell_type": "markdown", "metadata": { "id": "VKBr_wndlmZ4" }, "source": [ "Using negative indices, we can find out what the data looks like at the end of January, 2010." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 80, "status": "ok", "timestamp": 1786168098579, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "aNB0Q2kOlmZ4", "outputId": "eedaa343-ff4e-46b6-dbdc-4512f2efff67" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Last day of January TMAX: -15.0\n", "Last day of January TMIN: -27.2\n", "Last day of January PRCP: 0.0\n" ] } ], "source": [ "print(\"Last day of January TMAX:\", jan_tmax[-1])\n", "print(\"Last day of January TMIN:\", jan_tmin[-1])\n", "print(\"Last day of January PRCP:\", jan_prcp[-1])" ] }, { "cell_type": "markdown", "metadata": { "id": "yojAibbylmZ4" }, "source": [ "Contrary to Python list, you can specify multiple indices as a list to retrieve multiple values at once in NumPy." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 14, "status": "ok", "timestamp": 1786168098580, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "25vekP6QlmZ4", "outputId": "508024e6-90b4-4dd9-f1f5-af53772c7d4f" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "January TMAX every week (in order): [-17.8 -23.3 -6.7 -4.4 -18.9]\n", "January TMAX every week (in random order): [-23.3 -17.8 -6.7 -18.9 -4.4]\n" ] } ], "source": [ "print(\"January TMAX every week (in order):\", jan_tmax[[0, 7, 14, 21, 28]])\n", "print(\"January TMAX every week (in random order):\", jan_tmax[[7, 0, 14, 28, 21]])" ] }, { "cell_type": "markdown", "metadata": { "id": "2OZQRHtzlmZ4" }, "source": [ "### 2.3.2 Slicing\n", "Just as Python lists, slicing of NumPy array follows the format `start:end:step`. This means that the indices to be extracted from the list form an arithmetic sequence, starting at `start`, with a common difference of `step`, and ending with the largest number less than `end`.\n", "Here, `start`, `end`, and `step` can be omitted. When omitted, `start` defaults to 0, `end` defaults to the last element, and `step` defaults to 1. (If `step` is negative, values are retrieved in reverse order.)\n", "\n", "```python\n", "a = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])\n", "\n", "print(\"When start is omitted:\", end='\\t')\n", "print(a[:15:3])\n", "> When start is omitted: [ 0 3 6 9]\n", "\n", "print(\"When end is omitted:\", end='\\t')\n", "print(a[2::3])\n", "> When end is omitted: [ 2 5 8]\n", "\n", "print(\"When step is omitted (1):\", end='\\t')\n", "print(a[2:15:])\n", "> When step is omitted (1): [ 2 3 4 5 6 7 8 9]\n", "\n", "# The last \":\" can also be omitted\n", "print(\"When step is omitted (2):\", end='\\t')\n", "print(a[2:15])\n", "> When step is omitted (2): [ 2 3 4 5 6 7 8 9]\n", "\n", "print(\"When step and end are omitted:\", end='\\t')\n", "print(a[2:])\n", "> When step and end are omitted: [ 2 3 4 5 6 7 8 9]\n", "\n", "```\n" ] }, { "cell_type": "markdown", "metadata": { "id": "EhSVhvODlmZ4" }, "source": [ "For example, we can take the first 7 days and compute the average max temperature." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 26, "status": "ok", "timestamp": 1786168098607, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "HHBOYD2xlmZ4", "outputId": "450c9bd2-cb11-4160-f1bd-8cdbb8217e20" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Average TMAX in Week 1: -17.128571428571426\n" ] } ], "source": [ "tmax_week1 = jan_tmax[0:7] # [:7] also works\n", "print(\"Average TMAX in Week 1:\", np.mean(tmax_week1))" ] }, { "cell_type": "markdown", "metadata": { "id": "E6TDKKWelmZ4" }, "source": [ "We can also look at precipitation on Fridays (Jan 1st, 2010 is Friday). This is helpful for quick downsampling or periodic inspection." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 27, "status": "ok", "timestamp": 1786168098637, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "M_SA03o7lmZ4", "outputId": "812d1b61-9c9d-4ea8-885a-e91f8fb75561" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "January PRCP on Fridays: [0. 0. 0. 0. 0.]\n" ] } ], "source": [ "prcp_fri = jan_prcp[0::7] # [::7] also works\n", "print(\"January PRCP on Fridays:\", prcp_fri)" ] }, { "cell_type": "markdown", "metadata": { "id": "pqXuPzzBlmZ4" }, "source": [ "### 2.3.3 Boolean Indexing\n", "\n", "**Boolean indexing** is a powerful feature in NumPy that allows you to filter elements of an array based on a condition. It uses a boolean array (an array of `True` and `False` values) to select elements from another array. This makes it easy to perform conditional filtering and subsetting of data.\n", "\n", "```python\n", "a = np.array([1, 1, 2, 3, 5, 8, 13])\n", "\n", "# Create a list of boolean values\n", "idx = [True, False, False, True, False, True, True]\n", "\n", "# Boolean indexing\n", "print(a[idx])\n", "> [ 1 3 8 13]\n", "```\n", "\n", "Let's look at an actual example.\n", "\n", "For example, we can look at the `TMAX` and `TMIN` of days without rain." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 24, "status": "ok", "timestamp": 1786168098663, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "EHd2w5cHlmZ4", "outputId": "e83a59ed-a3fb-4720-b219-86ad98312ad5" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "TMAX on days with no rain (first 10): [-17.8 -24.4 -19.4 -15. -23.3 -23.3 -11.7 -6.7 -7.8 -1.7]\n", "TMIN on days with no rain (first 10): [-31.1 -32.2 -28.9 -27.8 -32.8 -32.2 -24.4 -12.8 -12.2 -8.9]\n" ] } ], "source": [ "no_rain = jan_prcp == 0\n", "print(\"TMAX on days with no rain (first 10):\", jan_tmax[no_rain][:10])\n", "print(\"TMIN on days with no rain (first 10):\", jan_tmin[no_rain][:10])" ] }, { "cell_type": "markdown", "metadata": { "id": "nSZu4SKblmZ4" }, "source": [ "If you look carefully at `PRCP`, you will notice that some data are extremely large (999.9), which represents that precipitation was not properly recorded on that day (**missing value**)." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 78, "status": "ok", "timestamp": 1786168098742, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "UkUpBPqZlmZ4", "outputId": "4e6743c9-59c4-4160-9e19-8b1045dc1080" }, "outputs": [ { "data": { "text/plain": [ "array([ 0. , 0. , 0. , 1.5, 999.9, 999.9, 0. ])" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "jan_prcp[:7]" ] }, { "cell_type": "markdown", "metadata": { "id": "QpltSYdLlmZ4" }, "source": [ "Therefore, when calculating the average precipitation, we should ignore these data." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 19, "status": "ok", "timestamp": 1786168098764, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "YCU2Lrk9lmZ4", "outputId": "3ec0697a-c2bc-4487-d206-bf168990d995" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Average January PRCP (including missing values): 64.63870967741936\n", "Average January PRCP (excluding missing values): 0.13793103448275862\n" ] } ], "source": [ "# This will lead to the wrong average\n", "print(\"Average January PRCP (including missing values):\", np.mean(jan_prcp))\n", "\n", "jan_prcp_no_missing = jan_prcp[jan_prcp < 999.9]\n", "print(\"Average January PRCP (excluding missing values):\", np.mean(jan_prcp_no_missing))" ] }, { "cell_type": "markdown", "metadata": { "id": "7K1Ml7DilmZ4" }, "source": [ "We can also combine multiple conditions using the following operators.\n", "\n", "- `&`: AND operator\n", "- `|`: OR operator\n", "- `~`: NOT operator\n", "\n", "For example, we can find how many days where `TMAX` was below -10 degrees Celsius **AND** not rainy." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 19, "status": "ok", "timestamp": 1786168098784, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "qxyFiU5DlmZ4", "outputId": "faa7f1e1-ec8a-4eda-ebf4-598646be7a00" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of days in January that are cold and not rainy: 13\n" ] } ], "source": [ "cold_and_not_rainy = (jan_tmax < -10) & (jan_prcp == 0)\n", "print(\"Number of days in January that are cold and not rainy:\", np.sum(cold_and_not_rainy))" ] }, { "cell_type": "markdown", "metadata": { "id": "b_kc6MCKLUho" }, "source": [ "### \n" ] }, { "cell_type": "markdown", "metadata": { "id": "5QYTmtWsJ7Xq" }, "source": [ "(1) Using the array `jan_tmax` that we built, create a new array `tmax_mon` that contains the max temperatures of all Mondays in January. As mentioned previously, January 1st is a Friday." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "HvkIT7-TLbbY" }, "outputs": [], "source": [ "# (1)\n", "# WRITE ME" ] }, { "cell_type": "markdown", "metadata": { "id": "K3lXFQQWMrks" }, "source": [ "(2) Calculate the average max temperature of all Mondays in January, then calculate the standard deviation of the max temperature of all Mondays in January.\n", "\n", "Hint: The formula for the standard deviation $\\sigma$ of a given data set is:\n", "$$\n", "\\sigma = \\sqrt{\\frac{\\sum (x_i - \\mu)^2}{N}}\n", "$$\n", "where $\\mu$ is the average value of the data, and $N$ is the size of the dataset.\n", "\n", "For example, let's calculate the standard deviation of the 2 datasets:\n", "$$\n", "D_1 = (-5,0,5),\\quad D_2 = (-100,0,100)\n", "$$\n", "You can tell that both datasets have the same average value of $0$, but $D_2$ is more \"spread out\" than $D_1$.The standard deviation of the 2 datasets $\\sigma_1$ and $\\sigma_2$ are:\n", "$$\n", "\\sigma_1 = \\sqrt{\\frac{(-5-0)^2+(0-0)^2+(5-0)^2}{3}} = 4.08 \\\\\n", "\\sigma_2 = \\sqrt{\\frac{(-100-0)^2+(0-0)^2+(100-0)^2}{3}} = 81.6\n", "$$\n", "As you can see, the more \"spread out\" dataset had a higher standard deviation. Therefore, one can say that standard deviation is a measure of how spread out the data points are within a dataset.\n", "\n", "\n", "You will never have to write out the code for this, as NumPy already has a function `np.std()` that does this for you (you are free to use it in this problem of course!)." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "Ihz2bJ2fPMzR" }, "outputs": [], "source": [ "# (2)\n", "# WRITE ME" ] }, { "cell_type": "markdown", "metadata": { "id": "fNDoGXW63ETI" }, "source": [ "## 2.4 NumPy 2D Arrays\n" ] }, { "cell_type": "markdown", "metadata": { "id": "tYmSqtexbXF9" }, "source": [ "In machine learning, we typically use 2D arrays where the vertical axis (**rows**) represents individual records, such as customers or products, and the horizontal axis (**columns**) represents their attributes.\n", "\n", "Since we mainly deal up to 2D arrays in machine learning and data science, we won't cover arrays with three or more dimensions in this notebook. However, if you understand the difference between 1D and 2D arrays, you can apply similar concepts to higher-dimensional arrays.\n", "\n", "In this section, we will continue using NOAA dataset." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "7sdiQ7IBlmZ5" }, "outputs": [], "source": [ "temp = raw[:, :2]" ] }, { "cell_type": "markdown", "metadata": { "id": "c2at43oY3ETJ" }, "source": [ "### 2.4.1 Creating 2D Arrays\n", "\n", "Let's actually create a 2D array. Just like 1D arrays, we use `np.array()`.\n", "\n", "**Note: Below, when we refer to an $n\\times m$ matrix or $(n,m)$ matrix, $n$ refers to the length along the vertical axis, and $m$ refers to the length along the horizontal axis.**\n", "\n", "One approach is converting a list of lists to a 2D array." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 136, "status": "ok", "timestamp": 1786168099022, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "zF_lWAuo3ETJ", "outputId": "c72f70a1-d910-4096-8ead-d9205367ec6a" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[1 2]\n", " [3 4]\n", " [5 6]]\n", "shape: (3, 2)\n" ] } ], "source": [ "# Create a 3*2 matrix from a 3*2 list\n", "a = np.array([\n", " [1, 2],\n", " [3, 4],\n", " [5, 6]\n", "])\n", "print(a)\n", "print(\"shape:\", a.shape) # Returns a tuple representing the shape of array a" ] }, { "cell_type": "markdown", "metadata": { "id": "TyIna1u73ETN" }, "source": [ "You can also reshape a 1D array into a 2D array using the `np.ndarray.reshape()` function. By passing the shape you want as an argument, you can reshape the array accordingly." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 118, "status": "ok", "timestamp": 1786168099024, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "ISasmyYq3ETN", "outputId": "3c3bd484-f265-41dc-9b97-25722d9900ac" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[1 2]\n", " [3 4]\n", " [5 6]]\n", "shape: (3, 2)\n" ] } ], "source": [ "a = np.array([1, 2, 3, 4, 5, 6])\n", "a = a.reshape(3, 2)\n", "print(a)\n", "print(\"shape:\", a.shape)" ] }, { "cell_type": "markdown", "metadata": { "id": "2edG_xje3ETP" }, "source": [ "Note that `reshape()` cannot change the number of elements. For example, if the following is attempted, an error will be returned.\n", "\n", "\n", "\n", "\n", "\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 164 }, "executionInfo": { "elapsed": 149, "status": "error", "timestamp": 1786168146147, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "AxtnzL1Z3ETQ", "outputId": "365210c8-c874-496c-851e-25d8e6b4a525" }, "outputs": [ { "ename": "ValueError", "evalue": "cannot reshape array of size 6 into shape (3,1)", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m/tmp/ipykernel_2627/108765450.py\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0ma\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0marray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m3\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m4\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m5\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m6\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0ma\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0ma\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreshape\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m3\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m# A 6-element array cannot be reshaped into a 3×1 array\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;31mValueError\u001b[0m: cannot reshape array of size 6 into shape (3,1)" ] } ], "source": [ "a = np.array([1, 2, 3, 4, 5, 6])\n", "a = a.reshape(3, 1) # A 6-element array cannot be reshaped into a 3×1 array" ] }, { "cell_type": "markdown", "metadata": { "id": "d9OqV5G-3ETS" }, "source": [ "Also, by specifying one of the dimensions as -1, it will automatically reshape to fit the data." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 33, "status": "ok", "timestamp": 1786168147518, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "w49-qNbf3ETS", "outputId": "b39ba7e2-f99b-4453-aa75-85a4dfb6056f" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[1 2]\n", " [3 4]\n", " [5 6]]\n", "shape: (3, 2)\n" ] } ], "source": [ "a = np.array([1, 2, 3, 4, 5, 6])\n", "a = a.reshape(3, -1)\n", "print(a)\n", "print(\"shape:\", a.shape)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 164 }, "executionInfo": { "elapsed": 36, "status": "error", "timestamp": 1786168148779, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "x4_37bE03ETV", "outputId": "574fdc95-13a5-4596-da0c-50c7692aa82a" }, "outputs": [ { "ename": "ValueError", "evalue": "cannot reshape array of size 6 into shape (4,newaxis)", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m/tmp/ipykernel_2627/1913689.py\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0ma\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0marray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m3\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m4\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m5\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m6\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0ma\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0ma\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreshape\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m4\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m# Since 6 is not divisible by 4, an error will occur.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;31mValueError\u001b[0m: cannot reshape array of size 6 into shape (4,newaxis)" ] } ], "source": [ "a = np.array([1, 2, 3, 4, 5, 6])\n", "a = a.reshape(4, -1) # Since 6 is not divisible by 4, an error will occur." ] }, { "cell_type": "markdown", "metadata": { "id": "I08pHsOO3ETa" }, "source": [ "### 2.4.2 Math Operations\n", "\n", "Math operations on 2D arrays is the same as 1D array, so it will be computed per element (**universal!**). Rules of broadcasting from Section 2.2.1 also apply here. As a result, multiplication and division are element-wise calculations, unlike actual matrix operations.\n", "\n", "```python\n", "a = np.array([\n", " [1, 2, 3],\n", " [4, 5, 6]\n", "])\n", "b = np.array([\n", " [1, 1, 2],\n", " [3, 5, 8]\n", "])\n", "\n", "print(\"Sum:\", a + b)\n", "> Sum: [[ 2 3]\n", "> [ 5 7]\n", "> [10 14]]\n", "print(\"Product:\", a * b) # This is the element-wise product (Hadamard product)\n", "> Product: [[ 1 2]\n", "> [ 6 12]\n", "> [25 48]]\n", "```\n", "\n", "For example, dividing each column (`TMAX`, `TMIN`, `PRCP`) by 10 to convert the units can be done as follows." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 27, "status": "ok", "timestamp": 1786168150981, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "OYVkm4ZJlmZ5", "outputId": "59ae00b9-feb5-4444-d324-a8bc456e0dba" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[-17.8 -31.1 0. ]\n", " [-24.4 -32.2 0. ]\n", " [-19.4 -28.9 0. ]\n", " [-16.7 -20. 1.5]\n", " [-13.3 -16.7 999.9]]\n" ] } ], "source": [ "X = raw / 10\n", "print(X[:5])" ] }, { "cell_type": "markdown", "metadata": { "id": "nr7gpYnqlmZ5" }, "source": [ "Other mathematical operations can also be computed for 2D arrays. The operations will be applied **element-wise**. For example, calculating the exponential, $y=\\exp(x)=e^x$ can be calculated as follows," ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 139, "status": "ok", "timestamp": 1786168152600, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "b-PATlp5lmZ5", "outputId": "743c2f38-9ff4-4216-bd7c-dbaaa956e791" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[1 1]\n", " [2 3]\n", " [5 8]]\n", "Calculating the exponential of each element: [[2.71828183e+00 2.71828183e+00]\n", " [7.38905610e+00 2.00855369e+01]\n", " [1.48413159e+02 2.98095799e+03]]\n" ] } ], "source": [ "a = np.array([1, 1, 2, 3, 5, 8])\n", "a = a.reshape(3, 2)\n", "\n", "print(a)\n", "print(\"Calculating the exponential of each element: \", np.exp(a))" ] }, { "cell_type": "markdown", "metadata": { "id": "Ik2zVl0m3ETh" }, "source": [ "### 2.4.3 Axis and Aggregation Functions\n", "\n", "In NumPy's 2D arrays, we previously referred to the rows and columns as the vertical and horizontal axes. However, as arrays become higher-dimensional, such naming conventions become impractical. Therefore, from now on, we will refer to axes as \"`axis`\" and assign numbers to them. For example, in a 2D array, the vertical axis is `axis 0`, and the horizontal axis is `axis 1`." ] }, { "cell_type": "markdown", "metadata": { "id": "SvLpRW-13ETh" }, "source": [ "Recall the functions such as the mean (`np.mean()`) and minimum (`np.min()`), which return a single value for multiple values (often called **aggregation functions**). When applied directly to a `X`, the 2D array representing NOAA dataset, these functions behave as follows:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 72, "status": "ok", "timestamp": 1786168153988, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "M_KIP_dMlmZ5", "outputId": "8a5a78c7-e747-4cf7-eaea-11efa3b18c08" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Shape of X: (31, 3)\n", "Min of X: -32.8\n" ] } ], "source": [ "print(\"Shape of X:\", X.shape)\n", "print(\"Min of X:\", np.min(X))" ] }, { "cell_type": "markdown", "metadata": { "id": "_86kEqv9lmZ5" }, "source": [ "We can see that these **aggregation functions return a single value for the entire array**. In this case, the minimum value is extracted from all 93 elements of the $31\\times3$ matrix. The result is the same regardless whether you reshape the array or not, so one can say that the operation leads to \"forgetting the shape\".\n", "\n", "However, this is not a very practical operation. When working with 2D arrays, it is often necessary to fix one axis and perform aggregation along that axis." ] }, { "cell_type": "markdown", "metadata": { "id": "QPTJtLW9lmZ5" }, "source": [ "If we want to find the lowest value for each column (`TMAX`, `TMIN`, `PRCP`), we take the minimum **along axis 0**." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "PRq-UDO6lmZ5" }, "outputs": [], "source": [ "print(\"Min along axis 0 (columns):\", np.min(X, axis=0))" ] }, { "cell_type": "markdown", "metadata": { "id": "DBjfT0ablmZ5" }, "source": [ "If we want to find the lowest value for each entry (which is not that informative in this case), we take the minimum **along axis 1**." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "4-llSdbXlmZ6" }, "outputs": [], "source": [ "print(\"Min along axis 1 (rows):\", np.min(X, axis=1))" ] }, { "cell_type": "markdown", "metadata": { "id": "btR6ghMJWm2Y" }, "source": [ "### " ] }, { "cell_type": "markdown", "metadata": { "id": "BjQEhRMmawoX" }, "source": [ "(1) Using the 2-dimensional array `X` we just built, find the mean value and standard deviation for each column (`TMAX`, `TMIN`, `PRCP`), resulting with 2 1-dimensional arrays of length 3." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "kMJ2rPvxfD6f" }, "outputs": [], "source": [ "# (1)\n", "# WRITE ME" ] }, { "cell_type": "markdown", "metadata": { "id": "d7FF1PLwfGWe" }, "source": [ "(2) **Standardize** all elements in `X` with respect to the mean and standard deviation that you calculated in (1), and store the new values in a new array `X_std`. This should result in a 2-dimensional array with a shape of (31,3).\n", "\n", "Hint: If a dataset has a mean of $\\mu$ and a standard deviation of $\\sigma$, to standardize a data point $x$ means to perform the transformation: \n", "$$\n", "z = \\frac{x - \\mu}{\\sigma}\n", "$$\n", "where $z$ is the standardized version of the original data point (or the \"**z-score**\"). Therefore, you are going to perform this transformation on all of the elements in `X` in this problem.\n", "\n", "For example, the data set $-5,0,5$ has a mean value of $0$ and a standard deviation of $4.08$, so performing this transformation would result in a data set of$-1.2,0,1.2$.\n", "\n", "**Standardization** is used very frequently in statistics and machine learning, and we will use it later in this course as well. Whenever you have multiple variables in a dataset (such as `TMAX`,`TMIN`,`PRCP`) with different scales or units, standardization forces them to have the exact same scale, making the data more consistent and easier to deal with.\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "ncaEnsZpd1Ix" }, "outputs": [], "source": [ "# (2)\n", "# WRITE ME" ] }, { "cell_type": "markdown", "metadata": { "id": "uH_SK4Jg3ET6" }, "source": [ "## 2.5 NumPy Indexing 2" ] }, { "cell_type": "markdown", "metadata": { "id": "MOq6SA8O3ET6" }, "source": [ "### 2.5.1 Indexing\n", "\n", "Essentially, both Python list and NumPy 2D arrays can be indexed in the same manner." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 219 }, "executionInfo": { "elapsed": 5, "status": "error", "timestamp": 1786168099425, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "udfzVjv6lmZ6", "outputId": "27e9dd18-3c10-495c-bfd1-6d70c9a961d6" }, "outputs": [ { "ename": "NameError", "evalue": "name 'X' is not defined", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m/tmp/ipykernel_2627/1700615393.py\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mX_list\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mX\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtolist\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;31m# Retrieve the 0th row\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"0th row of X_list:\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mX_list\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"0th row of X:\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mX\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mNameError\u001b[0m: name 'X' is not defined" ] } ], "source": [ "X_list = X.tolist()\n", "\n", "# Retrieve the 0th row\n", "print(\"0th row of X_list:\", X_list[0])\n", "print(\"0th row of X:\", X[0])\n", "\n", "# Retrieve the element at row 0, column 1\n", "print(\"Element at row 0, column 1 of X_list:\", X_list[0][1])\n", "print(\"Element at row 0, column 1 of X:\", X[0][1])" ] }, { "cell_type": "markdown", "metadata": { "id": "4Rn8GPYclmZ6" }, "source": [ "However, NumPy arrays allow more convenient indexing using a single `[]` in the form `[axis 0, axis 1]`. This indexing format allows indexing higher-dimensional arrays." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "it4NcPWglmZ6" }, "outputs": [], "source": [ "# [0][1] is the same as [0, 1] for 2D arrays\n", "print(\"Element at row 0, column 1 of X:\", X[0, 1])\n" ] }, { "cell_type": "markdown", "metadata": { "id": "LPOxMO32lmZ6" }, "source": [ "Additionally, you can use a list or a 1D array for indexing along a single axis." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "dd-ZnwxLlmZ6" }, "outputs": [], "source": [ "# Retrieve the 0th and 2nd rows along axis 0\n", "# (# This is different from X[0, 2])\n", "print(\"0th and 2nd rows of X:\", X[[0, 2]])" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "7UiL1nxclmZ6" }, "outputs": [], "source": [ "# Retrieve the 0th and 2nd columns along axis 1\n", "# Colon (:) is used to select all rows (see 2.5.2)\n", "print(\"0th and 2nd columns of X:\", X[:, [0, 2]])" ] }, { "cell_type": "markdown", "metadata": { "id": "UeCjVqpdlmZ6" }, "source": [ "### 2.5.2 Advanced Indexing\n", "\n", "Let's look at more variations of indexing using figures." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "UGOFvuSzlmZ6" }, "outputs": [], "source": [ "a = np.array([\n", " [1, 2, 3, 4],\n", " [5, 6, 7, 8],\n", " [9, 1, 2, 3]\n", "])" ] }, { "cell_type": "markdown", "metadata": { "id": "lUwiYZiylmZ6" }, "source": [ "#### Example 1: Multiple rows, single column" ] }, { "cell_type": "markdown", "metadata": { "id": "FhI_ztrx3EUF" }, "source": [ "![chap2-4-1.png](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARoAAAEFCAYAAAA8Myj0AAABPmlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGDiSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAysDFwM3AxyCXmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsgspiUSXV9cfxiu4Fu90lPNRhVTPQrgSkktTgbSf4A4IbmgqISBgTEGyFYuLykAsRuAbJEioKOA7CkgdjqEvQLEToKw94DVhAQ5A9kXgGyB5IzEFCD7AZCtk4Qkno7EhtoLAmxhEUYmFgQcSiooSa0oAdHO+QWVRZnpGSUKjsDQSVXwzEvW01EwMjAyYGAAhTVE9ecb4DBkFONAiGW7MzCYbWNgYFqCEEvRZGDYzgd0fiZCTD2NgUHImoHhgEJBYlEi3AGM31iK04yNIGzu7QwMrNP+//8czsDADjTj7/X//39v////7zIGBuZbQL3fAMhFWwYRcYONAAAAVmVYSWZNTQAqAAAACAABh2kABAAAAAEAAAAaAAAAAAADkoYABwAAABIAAABEoAIABAAAAAEAAAEaoAMABAAAAAEAAAEFAAAAAEFTQ0lJAAAAU2NyZWVuc2hvdDcJpIwAAAHWaVRYdFhNTDpjb20uYWRvYmUueG1wAAAAAAA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPS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998RqHhwee2+fnu0nOZjFwuGXzxDk4uGY2DX46/TQt/AmYTg248ZK6bWfjhU+ZN9VkMZbbzH3OnatekBwshGEhi1gKzAmj8QhkPejLYwpa7S/6+eefll4zGee9EtkgiEOUQkMLgKPdKZYckAs5DQDIa570T2SKJQJRDQDKaKPdKZYckAs5DQDIa570T2SKJQJRDQDKaKPdKZYckAs5DQDIa570T2SKJQJRDQDKaKPdKZYckAs5DQDIa570T2SKJQJRDQDKaKPdKZYckAs5D4P9E6uA/jZESlQAAAABJRU5ErkJggg==)" ] }, { "cell_type": "markdown", "metadata": { "id": "hII1uvxFlmZ7" }, "source": [ "Suppose we want to extract `a[0,1]` and `a[2,1]`. Then, since index along axis 1 is fixed at 1, we can write as follows:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "QDwh5mZsfHYX" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[2]\n", " [1]]\n", "[2 1]\n" ] } ], "source": [ "# The list or array specified for axis 0 should align with the direction of axis to be returned\n", "# This returns shape (1, 2)\n", "print(a[[[0], [2]], 1])\n", "\n", "# This returns shape (2,)\n", "print(a[[0, 2], 1])" ] }, { "cell_type": "markdown", "metadata": { "id": "z6e62XhylmZ7" }, "source": [ "#### Example 2: Single row, multiple columns" ] }, { "cell_type": "markdown", "metadata": { "id": "nY2Q3GAb4TOz" }, "source": [ "![chap2-4-2.png](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARQAAAD0CAYAAABaQ9lPAAABPmlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGDiSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAysDFwM3AxyCXmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsgspiUSXV9cfxiu4Fu90lPNRhVTPQrgSkktTgbSf4A4IbmgqISBgTEGyFYuLykAsRuAbJEioKOA7CkgdjqEvQLEToKw94DVhAQ5A9kXgGyB5IzEFCD7AZCtk4Qkno7EhtoLAmxhEUYmFgQcSiooSa0oAdHO+QW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JLnNInr1UroS7/WX8AfJavXTZ8k6+T9dfR1WykpEHRW21Jx1VL2iHkGByEiBJ8mk37QOcBxDYY3iOAk2BUbaFbC2xVNQQFDApRSIuAzFpeiLxgUFBAXMRAHBUMw0GgIXQQE3p4DjtzwmI4il3wiToacbnfU3JHlUFIL6GcyrPBnVxkLLtBMrFC1UEnkEBQQFNFFAMBRNZDJPJvN+rx1PI7P31ez4OXJEtPZVMBRHUt2AuqKH4SnLgKYNb8LsfTU7fo4cMK19FQzFkVQ3oK4YWj8VBuDi7CbM3lez4+fI8dHaV8FQHEl1A+qKFS3qCGXN3lez4+fI6ai1r4KhOJLqBtQVx/jbJQ3olfUmzN5Xs+Nnnar2pWrtq2Ao9tHXZaUSxow6ex6z99Xs+Dlykmrtq2AojqS6AXUli2NAIyZpwux9NTt+jhxGrX39P/pjrEdH1zNfAAAAAElFTkSuQmCC)" ] }, { "cell_type": "markdown", "metadata": { "id": "zM8JDNIjlmZ7" }, "source": [ "Suppose we want to extract `a[2,1]` and `a[2,3]`. Then, since index along axis 0 is fixed at 2, we can write as follows:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "i1KiL4cJ3EUF" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[1 3]]\n", "[1 3]\n" ] } ], "source": [ "# The list or array specified for axis 1 should align with the direction of axis to be returned\n", "# This returns shape (1, 2)\n", "print(a[2, [[1, 3]]])\n", "\n", "# This returns shape (2,)\n", "print(a[2, [1, 3]])" ] }, { "cell_type": "markdown", "metadata": { "id": "ds-ftn8g3EUH" }, "source": [ "#### Example 3: Multiple rows, multiple columns\n", "\n", "Now, how would you write it if you want to take multiple elements from each axis (i.e., extract a submatrix)?" ] }, { "cell_type": "markdown", "metadata": { "id": "r1ZFbdRh3EUH" }, "source": [ "![chap2-4-3.png](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARQAAADyCAYAAACMGjpSAAABPmlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGDiSSwoyG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IOeJ2G/cfzWVVLkFEsgtZjqL0Gb79VLlU3ybBwBjoDREXgb351eJvamT7GtT3PkfYmcQEFNmFel8CXmNovo9St2JN6b0PAnZrX65SuzTv6mq6/BSlnOoL3Cppqz9qqX18MRiIoIPPViv2kbKPICRWwU20mwKXCmXYHYNr9yBDgChkDA9jUUQ7DPmeAIcASMhAAXKEZ6GpwXjoCLI2C/KY/BgDD1G2Ew9jSzs+4mW4+KRlQ3nXGVJ6Pbs9Dy2vERiha0dMxr3J+X/UGJTn21P3r61sgFir74q249phXHNqorcoGMRu9rdBJ4WvvKBYoL/MDAYiytT9ZF+mWOTaP31egCzxymtqZp7SsXKLYi7eRycWJEnzUUo/fV6ALPnq+m1r5ygWJP9B1YVzytT9aBvDi66nj6HXynqmtGF3iqOqEyk9a+coGiEli9s7lF2f248Mi6xTb2/M7oAi88oranaO0rFyi2Y+3Ukl7xnNqcro0Zva9GF3j2fHha+8oFij3Rd2Bdvgmjh2E3/Pigr0Ymows8e2Knta//B0nCPzO+szVxAAAAAElFTkSuQmCC)" ] }, { "cell_type": "markdown", "metadata": { "id": "1JD8L9LP3EUI" }, "source": [ "You can do the same as before by specifying a list or a 1D array for each axis." ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "id": "pvYSUrzv3EUL" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[2 4]\n", " [1 3]]\n" ] } ], "source": [ "print(a[[[0], [2]], [[1, 3]]])" ] }, { "cell_type": "markdown", "metadata": { "id": "5mOHifYplmZ7" }, "source": [ "Note that the following will not result as the intended submatrix, as the list specifying axis 1 is not in the correct shape." ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 146 }, "executionInfo": { "elapsed": 5, "status": "error", "timestamp": 1786168099446, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "lFgLX2fk3EUN", "outputId": "70e6b9d2-83d5-422a-f1b9-9e8a2583ee79" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[2 3]\n" ] } ], "source": [ "print(a[[0, 2], [1, 3]]) # By doing this, a[0, 1] and a[2, 3] will be selected." ] }, { "cell_type": "markdown", "metadata": { "id": "KvNc3rvR3EUV" }, "source": [ "Here, the index `[[[0], [2]], [[1, 3]]]` is very difficult to read and hard to type. There is a function `np.ix_()` that returns `[[[0], [2]], [[1, 3]]]` when you provide `[0, 2], [1, 3]` as arguments." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "CWBXdAUR3EUW" }, "outputs": [], "source": [ "# The following two are the same\n", "idx = np.ix_([0, 2], [1, 3])\n", "print(a[idx])\n", "print(a[[[0], [2]], [1, 3]])" ] }, { "cell_type": "markdown", "metadata": { "id": "a0QFwBC13EUc" }, "source": [ "### 2.5.2 Slicing\n", "\n", "You can also use slices on each axis of a 2D array. A slice can be expressed as `start:end(:step)`, and to select all axes, you can use the slice `:`.\n", "\n", "For example, we can retrieve the first 5 rows of `X` as follows." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "cR5mQoe3lmZ7" }, "outputs": [], "source": [ "print(\"First 5 rows of X:\", X[:5])" ] }, { "cell_type": "markdown", "metadata": { "id": "J3g-jwr7lmZ8" }, "source": [ "We can retrieve the first two columns (`TMAX`, `TMIN`) on a 3-day span as follows." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "wp1KTeoTlmZ8" }, "outputs": [], "source": [ "print(\"TMAX and TMIN (3-day span):\", X[::3, :2])" ] }, { "cell_type": "markdown", "metadata": { "id": "tL45GpAFlmZ8" }, "source": [ "We can also retrieve `TMIN` and `PRCP` (last two columns) as follows." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "BJb2YjbnlmZ8" }, "outputs": [], "source": [ "print(\"TMIN and PRCP (last 7 days):\", X[:, -2:])" ] }, { "cell_type": "markdown", "metadata": { "id": "41t1azEV3EUj" }, "source": [ "### 2.5.3 Boolean Indexing\n", "\n", "Similar to 1D arrays, you can extract values where the corresponding index has a `True` value by specifying a 2D array with boolean values. In this case, the index must have the **same shape**.\n", "\n", "For example, we can find the rows where `PRCP` is equal to 9999 (**missing value**)." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "cBwcMEX-lmZ8" }, "outputs": [], "source": [ "print(\"X (first 5 rows):\", X[:5])\n", "\n", "idx = (X == 999.9)\n", "print(\"Boolean array of missing values (first 5 rows):\", idx[:5])" ] }, { "cell_type": "markdown", "metadata": { "id": "1ICh0fHPlmZ8" }, "source": [ "You can also specify a boolean index to extract only specific axes." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "g0EQ_pC_lmZ8" }, "outputs": [], "source": [ "print(\"Only TMAX and PRCP:\", X[:5, [True, False, True]])" ] }, { "cell_type": "markdown", "metadata": { "id": "NnUQwBM_lmZ8" }, "source": [ "Additionally, you can combine boolean indices with the `np.ix_()` function (see 2.5.1) to extract the intersecting parts." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "LiXmAiA5lmZ8" }, "outputs": [], "source": [ "X_extracted = X[:5]\n", "print(X_extracted)\n", "\n", "print(X[np.ix_([True, True, False, False, False], [True, False, True])])" ] }, { "cell_type": "markdown", "metadata": { "id": "Ugf1pJK_MAN1" }, "source": [ "### " ] }, { "cell_type": "markdown", "metadata": { "id": "xuVqP-4DSUJ1" }, "source": [ "(1) Implement a function `get_data_zscore(date)` that takes an integer `date` (from 4 to 28) representing a day in January.\n", "\n", "The function should:\n", "\n", "1. Retrieve the `TMAX`,`TMIN`,`PCRP` of the days within 3 days of `date` (e.g., for January 5th, retrieve January 2nd through January 8th).\n", "2. Calculate and return the z-score (exactly like you did in Practice Question 2-3!) of the target day's `TMAX`,`TMIN`,`PCRP` relative to that 7-day window. This should result in a 1-dimensional array with a length of 3." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "_Z14r6chNb13" }, "outputs": [], "source": [ "# (1)\n", "def get_temp_zscore(date):\n", " # WRITE ME\n", " return answer" ] }, { "cell_type": "markdown", "metadata": { "id": "UG-eIu4QTyQk" }, "source": [ "(2) Using boolean indexing that you just learned, calculate the average max temperature of all days with no rain, and of all days with rain (make sure to exclude days with a missing value `PCRP` value)." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "iDU5d6LVMBxa" }, "outputs": [], "source": [ "# (2)" ] }, { "cell_type": "markdown", "metadata": { "id": "IW6igPny3EUv" }, "source": [ "## 2.6 NumPy Advanced" ] }, { "cell_type": "markdown", "metadata": { "id": "RJAyO5er3EUw" }, "source": [ "### 2.6.1 Constants\n", "NumPy includes several constants:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 42, "status": "ok", "timestamp": 1786168099624, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "pFqZaJTo3EUw", "outputId": "cb90af07-55e5-4a4e-ef32-9784662d4c2b" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Pi: 3.141592653589793\n", "Euler's number: 2.718281828459045\n" ] } ], "source": [ "print(\"Pi:\", np.pi)\n", "print(\"Euler's number:\", np.e)" ] }, { "cell_type": "markdown", "metadata": { "id": "XzSZNao6gfnM" }, "source": [ "`np.inf` which corresponds to $\\infty$." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 29, "status": "ok", "timestamp": 1786168099716, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "ydtTxwA83EUy", "outputId": "23ec1a94-f304-4c66-e022-c3739520df57" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Positive infinity: inf\n", "Negative infinity: -inf\n" ] } ], "source": [ "print(\"Positive infinity:\", np.inf)\n", "print(\"Negative infinity:\", - np.inf)" ] }, { "cell_type": "markdown", "metadata": { "id": "Zr-MFPl53EUz" }, "source": [ "`np.inf` has the following properties in arithmetic operations." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 145, "status": "ok", "timestamp": 1786168099863, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "ucX-4RIc3EU0", "outputId": "57f14d94-69e3-4923-d3c3-3bf6c6c7d9bc" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "inf\n", "-inf\n", "inf\n", "0.0\n" ] } ], "source": [ "print(1 + np.inf)\n", "print(1 - np.inf)\n", "print(2 * np.inf)\n", "print(2 / np.inf)" ] }, { "cell_type": "markdown", "metadata": { "id": "Ztx1_T6_3EU1" }, "source": [ "In addition, in conditional operations, it has the following properties regardless of the value of `a`." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 45, "status": "ok", "timestamp": 1786168099910, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "Hno77AQ53EU2", "outputId": "d1074ef4-89c7-487c-e265-3e417ce45222" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "True\n", "True\n" ] } ], "source": [ "a = 10000000\n", "print(a < np.inf)\n", "print(-np.inf < a)" ] }, { "cell_type": "markdown", "metadata": { "id": "-ZHNscPc3EU3" }, "source": [ "### 2.6.2 NumPy Arrays with Random Values\n", "\n", "`numpy.random` module handles random numbers, allowing you to create arrays with random values. In this notebook, we have imported the module separately, so that we can use it more conveniently.\n", "\n", "```python\n", "from numpy import random\n", "```" ] }, { "cell_type": "markdown", "metadata": { "id": "M1r4gTjZlmZ9" }, "source": [ "#### Uniform Distribution\n", "\n", "To generate from a unifrom distribution, you can use `rand()` function." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 149, "status": "ok", "timestamp": 1786168100061, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "jtpz4XYS3EU6", "outputId": "1f79a028-1656-4c87-c4f4-de6d4e567544" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0.14587606124238983\n", "[0.28658883 0.95443037 0.65159024 0.84111867 0.47918562]\n", "[[0.73990972 0.6558256 0.64351493 0.46864839 0.76240903]\n", " [0.33168428 0.25565685 0.66604799 0.3298725 0.94099533]\n", " [0.44709325 0.54816464 0.20026687 0.96085423 0.83463551]\n", " [0.14377585 0.18966721 0.65874203 0.56623912 0.90522591]\n", " [0.93568339 0.07619134 0.17868532 0.65364684 0.89026028]]\n" ] } ], "source": [ "# Generate a uniform random number between [0, 1). 0 is included, but 1 is not.\n", "print(random.rand())\n", "\n", "# If a shape is provided as an argument, a uniform random array with that shape is generated\n", "print(random.rand(5)) # A 1-dimensional array with length 5 (= shape (5, ))\n", "print(random.rand(5, 5)) # A 2-dimensional array with shape (5, 5)" ] }, { "cell_type": "markdown", "metadata": { "id": "qB2EVdCG3EU9" }, "source": [ "#### Normal Distribution\n", "\n", "By using `randn()` instead of `rand()`, you can sample from a normal distribution." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 29, "status": "ok", "timestamp": 1786168100084, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "YkCkXSmg3EU9", "outputId": "768be428-715c-49fc-97cd-b81424c7c604" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "-0.8441668285199488\n", "[ 0.44091842 2.08242652 0.04440216 -1.39151933 1.00490846]\n", "[[-3.00963770e-01 5.95593581e-01 -2.50321239e-01 1.07486697e-01\n", " 6.65592900e-01]\n", " [-6.83646975e-02 4.56576075e-01 -8.32795224e-01 -1.99527170e+00\n", " -8.19016516e-02]\n", " [-6.47872589e-01 -2.70702184e-01 -2.91735784e-01 -2.25248015e-01\n", " 1.31164570e+00]\n", " [ 1.16234844e+00 -1.18215189e+00 5.23318735e-02 -1.75239412e-03\n", " -1.59100576e+00]\n", " [ 1.14360971e+00 7.29464463e-02 -1.40991378e+00 5.54185503e-01\n", " 4.60998550e-01]]\n" ] } ], "source": [ "# Generate a random number following the standard normal distribution (mean 0, variance 1)\n", "print(random.randn())\n", "\n", "# If a shape is provided as an argument, random numbers with that shape are generated\n", "print(random.randn(5)) # A 1-dimensional array with length 5 (=shape (5, ))\n", "print(random.randn(5, 5)) # A 2-dimensional array with shape (5,5)" ] }, { "cell_type": "markdown", "metadata": { "id": "CLS2F7fg3EU-" }, "source": [ "Also, if you want to specify the mean and standard deviation, you can use `normal(mean, std, shape)`." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 142, "status": "ok", "timestamp": 1786168100227, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "0HdZASR-3EU_", "outputId": "52c6b95a-cbac-4b58-aa80-5e4f64a686cc" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "91.38816304746172\n", "[121.11434691 93.89576012 99.4152949 104.57231809 106.9098537 ]\n", "[[101.42618392 117.99168166 95.81594053 112.58070544 107.79423194]\n", " [111.35410675 107.13971785 75.68992133 107.8498549 119.09269265]\n", " [ 88.26500934 101.44731283 119.87838487 93.77268737 83.82895581]\n", " [ 95.45398891 110.21271911 103.92973751 91.80412938 103.57434174]\n", " [100.86336554 100.41321559 75.9848911 112.49151512 89.73556127]]\n" ] } ], "source": [ "print(random.normal(100, 10)) # A random number from a normal distributionmean 100 and standard deviation 10\n", "print(random.normal(100, 10, 5)) # A 1-dimensional array with 5 random numbers from a normal distribution with mean 100 and standard deviation 10\n", "print(random.normal(100, 10, (5, 5)))\n", "# A 2-dimensional array with shape (5,5) containing random numbers from a normal distribution with mean 100 and standard deviation 10" ] }, { "cell_type": "markdown", "metadata": { "id": "W_EGTcMW3EVA" }, "source": [ "#### Random Integers\n", "\n", "There is a function called `randint()` that generates random integers." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 21, "status": "ok", "timestamp": 1786168100252, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "rio2j6pt3EVA", "outputId": "4e7839ae-4ea4-4810-96c6-746e1e025b73" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1\n", "[[5 7 3]\n", " [5 7 7]\n", " [7 9 6]]\n" ] } ], "source": [ "print(random.randint(4)) # Generate a random integer between 0 and 3\n", "print(random.randint(2, 10, (3, 3))) # Generate a 2-dimensional array with shape (3, 3) containing random integers between 2 and 9" ] }, { "cell_type": "markdown", "metadata": { "id": "1Gm7OWwU3EVD" }, "source": [ "#### Seed\n", "\n", "The random number generation above produces different results each time it is executed. However, there are cases where you may want to fix the generated random numbers for reproducibility.\n", "\n", "By setting a **seed** (the random number seed), you can ensure that the same random numbers are generated if the seed is the same." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 132, "status": "ok", "timestamp": 1786168100388, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "eYAZV5GB3EVE", "outputId": "d476fe29-e8b0-4899-e2da-59d57ab1f37d" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[0.85888927 0.37271115 0.55512878 0.95565655 0.7366696 ]\n", "[0.81620514 0.10108656 0.92848807 0.60910917 0.59655344]\n", "[[3 4 5]\n", " [2 4 4]\n", " [4 6 4]]\n" ] } ], "source": [ "random.seed(seed=32) # The seed can be any integer\n", "\n", "# The values will be the same no matter how many times you execute\n", "print(random.rand(5))\n", "print(random.rand(5))\n", "print(random.randint(2, 10, (3, 3)))" ] }, { "cell_type": "markdown", "metadata": { "id": "RgAwVkib3EVF" }, "source": [ "### 2.6.3 Matrix Calculation\n", "\n", "One of the highlights of NumPy is linear algebra calculations. Let's use the following arrays as an example." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 105, "status": "ok", "timestamp": 1786168100390, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "1JCSxDq63EVG", "outputId": "49bc0177-6cd4-4521-a773-e11886cb34c2" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "x: [1 2 3]\n", "y: [6 7 8]\n", "A: [[1 2 3]\n", " [4 5 6]\n", " [7 8 9]]\n", "B: [[5 5 6]\n", " [7 9 5]\n", " [1 7 5]]\n" ] } ], "source": [ "x = np.arange(1, 4)\n", "y = np.arange(6, 9)\n", "A = np.arange(1, 10).reshape(3, 3)\n", "B = random.randint(1, 10, (3, 3))\n", "\n", "print(\"x:\", x)\n", "print(\"y:\", y)\n", "print(\"A:\", A)\n", "print(\"B:\", B)" ] }, { "cell_type": "markdown", "metadata": { "id": "lnZMfYQB3EVK" }, "source": [ "#### Transpose\n", "\n", "The transpose is an operation defined for two-dimensional arrays, and can be performed using `np.transpose()` or `np.ndarray.T`." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 69, "status": "ok", "timestamp": 1786168100391, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "2cMdrZX83EVK", "outputId": "d8839100-c622-4d2e-b7d6-e03ff58b2d6f" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[1 4 7]\n", " [2 5 8]\n", " [3 6 9]]\n", "[[1 4 7]\n", " [2 5 8]\n", " [3 6 9]]\n" ] } ], "source": [ "# The following two are the same\n", "print(np.transpose(A))\n", "print(A.T)" ] }, { "cell_type": "markdown", "metadata": { "id": "tVPWfGl-3EVP" }, "source": [ "#### Dot Product and Matrix Multiplication\n", "\n", "The dot product and matrix multiplication can be performed using `np.dot()`, `np.matmul()`, or `@`. The differences between these methods are quite advanced and will be skipped here. For the level of this course, you can treat them as the same.\n", "\n", "However, the `@` operator is not specific to NumPy; it was introduced in Python 3.5 as a built-in operator." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 44, "status": "ok", "timestamp": 1786168100436, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "Uk7XdcnQ3EVQ", "outputId": "bf17d153-7cac-4b5b-aea5-847411b73493" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Dot product of x and y\n", "44\n", "44\n", "44\n", "Matrix multiplication of A and B\n", "[[ 22 44 31]\n", " [ 61 107 79]\n", " [100 170 127]]\n", "[[ 22 44 31]\n", " [ 61 107 79]\n", " [100 170 127]]\n", "[[ 22 44 31]\n", " [ 61 107 79]\n", " [100 170 127]]\n" ] } ], "source": [ "print(\"Dot product of x and y\")\n", "print(np.dot(x, y))\n", "print(np.matmul(x, y))\n", "print(x @ y)\n", "\n", "print(\"Matrix multiplication of A and B\")\n", "print(np.dot(A, B))\n", "print(np.matmul(A, B))\n", "print(A @ B)" ] }, { "cell_type": "markdown", "metadata": { "id": "q3Md7no23EVR" }, "source": [ "In the following, we will use `np.matmul()`." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 33, "status": "ok", "timestamp": 1786168100472, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "r9aaHXBV3EVR", "outputId": "d6e94368-e75a-4ea8-ba97-0e46d8f5370b" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[ 22 44 31]\n", " [ 61 107 79]\n", " [100 170 127]]\n", "[[ 67 83 99]\n", " [ 78 99 120]\n", " [ 64 77 90]]\n" ] } ], "source": [ "# Since there are matrices, changing the order of multiplication does not guarantee the same result.\n", "print(np.matmul(A, B))\n", "print(np.matmul(B, A))" ] }, { "cell_type": "markdown", "metadata": { "id": "Xxtj0rJM3EVU" }, "source": [ "#### Side Note: Broadcasting\n", "Broadcasting also occurs in matrix calculations. Let's look at the following example of calculating, $y=Ax$," ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 75, "status": "ok", "timestamp": 1786168100548, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "leU__C1D3EVU", "outputId": "a0727d85-c50c-43c7-85ad-b1fd17bbed28" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[14 32 50]\n", "[30 36 42]\n" ] } ], "source": [ "# A simple example of broadcasting\n", "print(np.matmul(A, x)) # x is interpreted as a column vector\n", "print(np.matmul(x, A)) # x is interpreted as a row vector" ] }, { "cell_type": "markdown", "metadata": { "id": "ez7LH5vm3EVW" }, "source": [ "#### Side Note: Row vectors vs. Column vectors\n", "In many cases, when dealing with vectors (1-dimensional arrays), it is useful to distinguish between column vectors and row vectors. Therefore, it is often convenient to treat them as 2-dimensional arrays rather than 1-dimensional arrays. For example, when working with a 5-dimensional vector, using a 2-dimensional array with shape (5, 1) instead of a 1-dimensional array with shape (5,) allows operations like transposition to be performed." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 11, "status": "ok", "timestamp": 1786168100561, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "gQEbHYkp3EVX", "outputId": "ff5d083b-7b76-42e4-8f40-91fda3e18a56" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Before transpose: [1 0 1 0 1]\n", "After transpose: [1 0 1 0 1]\n", "Before transpose: [[1 0 1 0 1]]\n", "After transpose:\n", " [[1]\n", " [0]\n", " [1]\n", " [0]\n", " [1]]\n" ] } ], "source": [ "a = np.array([1, 0, 1, 0, 1]) # A 5-dimensional vector represented as a 1-dimensional array\n", "\n", "# The transpose doesn't change anything (since there is only one axis)\n", "print(\"Before transpose:\", a)\n", "print(\"After transpose:\", a.T)\n", "\n", "# By converting it into a 2-dimensional array, column and row vectors can be distinguished\n", "\n", "# Convert a into a row vector as a 2-dimensional array\n", "a = a.reshape(1, -1) # Using -1 for the axis automatically calculates the number of elements\n", "print(\"Before transpose:\", a)\n", "print(\"After transpose:\\n\", a.T)" ] }, { "cell_type": "markdown", "metadata": { "id": "KZpia2ml3EVY" }, "source": [ "#### Linear Algebra Computation\n", "\n", "NumPy includes a module called `linalg` that allows various linear algebra calculations.\n", "\n", "```python\n", "from numpy import linalg as LA\n", "```" ] }, { "cell_type": "markdown", "metadata": { "id": "YlFl8Uc73EVb" }, "source": [ "Here are some basic functions available in `linalg`." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 35, "status": "ok", "timestamp": 1786168100597, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "8gdrtO7X3EVc", "outputId": "fa7a5c4f-2cc8-42f2-ef61-c24341402c9e" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0.0\n", "139.99999999999994\n", "[[ 0.07142857 0.12142857 -0.20714286]\n", " [-0.21428571 0.13571429 0.12142857]\n", " [ 0.28571429 -0.21428571 0.07142857]]\n" ] } ], "source": [ "# Calculate the determinant\n", "print(LA.det(A))\n", "print(LA.det(B))\n", "\n", "# Calculate the inverse matrix\n", "print(LA.inv(B)) # Since B is a singular matrix, trying to compute its inverse will result in an error" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 37, "status": "ok", "timestamp": 1786168100635, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "HN_tFRxz3EVf", "outputId": "2842b67c-4fb4-4c03-cb5a-e3ce098abeb4" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "3.7416573867739413\n", "12.206555615733702\n", "6.0\n", "8.0\n" ] } ], "source": [ "# Calculate the norm\n", "# By default, it calculates the L2 norm\n", "print(LA.norm(x))\n", "print(LA.norm(y))\n", "\n", "# By specifying the `ord` argument, it corresponds to the Lp norm\n", "print(LA.norm(x, ord=1))\n", "print(LA.norm(y, ord=np.inf)) # When `ord` is set to np.inf, it correctlycalculates the L∞ norm" ] }, { "cell_type": "markdown", "metadata": { "id": "p3MjocDf3EVg" }, "source": [ "Additionally, the `LA.norm()` function is an aggregation function, and when a multidimensional array is specified, you can use the `axis` argument. If `keepdims` is set to True, it will preserve the shape." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 19, "status": "ok", "timestamp": 1786168100700, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "5eF2_GPS3EVh", "outputId": "5dbb73ed-5979-4521-ed5f-6d3605c9018f" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "A:\n", "[[1 2 3]\n", " [4 5 6]\n", " [7 8 9]]\n", "\n", "keepdims=False (default)\n", "axis=0 [ 8.1240384 9.64365076 11.22497216]\n", "axis=1 [ 3.74165739 8.77496439 13.92838828]\n", "\n", "keepdims=True\n", "axis=0\n", "[[ 8.1240384 9.64365076 11.22497216]]\n", "axis=1\n", "[[ 3.74165739]\n", " [ 8.77496439]\n", " [13.92838828]]\n" ] } ], "source": [ "print(\"A:\")\n", "print(A)\n", "\n", "print()\n", "print(\"keepdims=False (default)\")\n", "print(\"axis=0\", LA.norm(A, axis=0))\n", "print(\"axis=1\", LA.norm(A, axis=1))\n", "\n", "print()\n", "print(\"keepdims=True\")\n", "print(\"axis=0\")\n", "print(LA.norm(A, axis=0, keepdims=True))\n", "print(\"axis=1\")\n", "print(LA.norm(A, axis=1, keepdims=True))" ] }, { "cell_type": "markdown", "metadata": { "id": "eQbadUFi3EVi" }, "source": [ "In addition, `linalg` can be used to compute eigenvalues and singular values, as well as various matrix factorizations such as singular value decomposition (SVD) and LU decomposition." ] }, { "cell_type": "markdown", "metadata": { "id": "XMTYEL6z3EVy" }, "source": [ "## 2.7 Comprehensive Questions" ] }, { "cell_type": "markdown", "metadata": { "id": "7qSZhFeK3EVy" }, "source": [ "Recently, in natural language processing using deep learning, models based on Google's Transformer have gained attention due to their human-level performance on several NLP tasks.\n", "\n", "In January 2020, Google introduced [Reformer](https://arxiv.org/abs/2001.04451), which improves the time and space complexity of the Transformer model. In this task, we will implement a part of the Reformer paper, which uses [*cross-polytope LSH*](https://arxiv.org/abs/1509.02897) to improve the time complexity of the Transformer, with guided instructions.\n" ] }, { "cell_type": "markdown", "metadata": { "id": "brJrgwqa3EVz" }, "source": [ "Consider the following question:\n", ">Given $n$ vectors, we want to assign the same integer value to \"similar\" vectors and different integer values to \"dissimilar\" vectors. In this context, \"similar\" vectors are those whose angle is close to 0.\n", "\n", "\n", "The challenges of this problem are as follows:\n", "- How small should the angle be for vectors to be considered \"similar\"?\n", "- Even if vectors $a$ and $b$, and $b$ and $c$ are \"similar\", $a$ and $c$ may not necessarily be considered \"similar.\"\n", "- To compute the angle $\\theta$, we can use their inner product and norms to calculate $\\cos \\theta$. We could then sort this value and assign integers accordingly, but sorting can become slow as $n$ increases (since the number of combinations of vectors is $_nC_2 = O(n^2)$)." ] }, { "cell_type": "markdown", "metadata": { "id": "x-SWQgmo3EVz" }, "source": [ "We consider the following probablistic approach:\n", "\n", "1. Rotate all vectors by the same random angle.\n", "\n", "2. Vectors that are \"similar\" will, with **high probability**, remain in the same quadrant after rotation, while vectors that are \"dissimilar\" will, with **high probability**, end up in different quadrants.\n", "\n", "3. Therefore, by assigning each vector an integer value corresponding to the quadrant it belongs to after the random rotation, the problem can be solved with **high probability**.\n", "\n", "Let's implement this approach.\n", "\n" ] }, { "cell_type": "markdown", "metadata": { "id": "RV4V3rta3EV0" }, "source": [ "This time, we consider 100 3D row vectors." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 18, "status": "ok", "timestamp": 1786168100720, "user": { "displayName": "木村進太郎", "userId": "02485141327510571181" }, "user_tz": -540 }, "id": "0obkueh43EV0", "outputId": "61477e12-d21b-41c3-95c9-b64db8f4cd5e" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[ 5.05645125e-01 -8.15271110e-01 3.89150951e-01]\n", " [-4.24962470e-01 3.96231519e-02 -5.27963922e-01]\n", " [-5.10303679e-01 -8.88285149e-01 1.08762473e+00]\n", " [ 6.73392264e-01 -1.06731704e+00 1.21804998e+00]\n", " [ 3.36371255e+00 -8.32253403e-01 -3.40348381e-01]\n", " [-1.85857154e+00 8.23065599e-04 3.51574483e-01]\n", " [ 1.52150885e+00 -6.80474137e-01 9.38057708e-01]\n", " [-6.81414713e-01 -2.01098083e-01 -1.74886440e-02]\n", " [-1.78791213e+00 -8.51740228e-01 -1.62830331e+00]\n", " [ 9.66997738e-01 5.31155943e-02 2.89712932e-01]\n", " [ 6.24443380e-02 -1.09812873e+00 1.30533064e-01]\n", " [-1.85337064e-01 -1.34073473e+00 -3.24019679e-01]\n", " [ 1.48436338e+00 1.31308828e+00 -6.32164014e-01]\n", " [-3.91573298e-01 -2.36849570e+00 -5.90683913e-01]\n", " [-1.71300152e+00 -1.31285141e+00 4.53779604e-01]\n", " [-1.78332529e+00 1.42551583e+00 -3.45698608e-01]\n", " [ 9.98657431e-01 7.25386344e-01 -9.28409701e-01]\n", " [-6.79982736e-01 -1.11262844e+00 1.24751610e-02]\n", " [-5.26311356e-01 -6.79530896e-01 1.45994761e+00]\n", " [ 1.36657358e+00 1.70810135e+00 2.39030424e-01]\n", " [-4.59934590e-01 1.15831171e+00 2.53673937e-01]\n", " [ 2.03742962e-01 1.77320156e+00 9.88609277e-01]\n", " [-8.11427183e-01 -1.52325949e+00 -3.00994480e-01]\n", " [-3.90611028e-01 4.68037148e-01 1.51354842e+00]\n", " [ 4.24640107e-01 1.22346219e-01 -1.38764712e+00]\n", " [-4.67041100e-01 1.27359663e+00 1.21721615e-01]\n", " [-1.21746422e+00 4.03288099e-01 -1.47309510e+00]\n", " [-8.07467933e-01 -1.03275598e+00 8.52844830e-01]\n", " [-7.95059186e-01 9.32159558e-01 1.70116487e+00]\n", " [ 1.14539813e-01 -2.80694677e-01 -1.15979720e+00]\n", " [ 2.00774251e+00 -7.12391299e-03 5.94402862e-01]\n", " [ 8.67775449e-02 -3.10212284e-01 3.87108572e-01]\n", " [-1.31167128e+00 1.86822114e+00 -5.83791859e-01]\n", " [-6.36603416e-02 3.95498630e-03 -2.33572407e-01]\n", " [ 1.31482178e+00 -1.86523499e+00 3.89151511e-01]\n", " [ 1.45978026e+00 -3.60319268e-01 -4.52692409e-01]\n", " [ 1.37582864e+00 -1.45927342e-01 -1.49445307e+00]\n", " [ 1.74957541e+00 1.44917140e+00 -1.00682004e+00]\n", " [ 1.25856795e+00 5.29146917e-01 -5.14234727e-01]\n", " [-2.37874369e+00 3.57095567e-01 1.51335606e+00]\n", " [-5.86545200e-01 -6.91654789e-01 -2.99826964e-01]\n", " [-3.46988565e-01 5.90325266e-01 1.75955297e+00]\n", " [-8.03790864e-01 5.24631469e-01 1.21481569e+00]\n", " [-7.36959852e-02 1.04675257e+00 1.46183743e-01]\n", " [ 7.96793173e-01 -4.33942164e-01 -8.55803926e-01]\n", " [ 1.31263841e+00 1.20931899e+00 -2.60683247e-01]\n", " [ 4.83649078e-01 -1.73901126e+00 -4.52153415e-01]\n", " [-4.94039685e-01 2.73599167e+00 -1.94405851e-01]\n", " [ 6.08723784e-01 1.49200215e+00 9.46660450e-02]\n", " [ 9.15413597e-02 2.18312681e-01 8.39430444e-01]\n", " [ 3.91332586e-01 -3.89246466e-01 -8.95986779e-01]\n", " [-1.07191903e+00 -3.45933486e-01 -5.08736808e-01]\n", " [-1.54969041e+00 5.58031479e-01 1.78488371e-01]\n", " [-1.32528692e-01 1.08922572e+00 9.78081502e-01]\n", " [ 6.30599785e-01 9.13780102e-02 8.78557215e-02]\n", " [ 3.01407934e-01 2.57280960e+00 -3.87429373e-01]\n", " [ 3.31685276e-01 -2.75520492e-03 2.46347474e-01]\n", " [ 1.15480260e+00 3.16328315e-01 2.86953208e-01]\n", " [-7.86582002e-01 -7.79752410e-01 2.48113036e-01]\n", " [ 3.07956447e-01 1.10878961e+00 -1.41335419e+00]\n", " [ 6.87739071e-01 7.37344174e-01 -1.12083240e+00]\n", " [ 5.50023375e-02 2.56842503e+00 -3.58570363e-01]\n", " [-1.70702862e+00 8.45077645e-02 -1.75480025e+00]\n", " [-6.33106861e-02 1.14938586e-01 3.94446468e-01]\n", " [ 9.81625886e-01 4.21518905e-01 2.88670214e-01]\n", " [-1.26423371e-01 -8.87990852e-01 8.84693812e-01]\n", " [-2.55348644e-01 -9.50409202e-01 1.75754042e+00]\n", " [-1.33025412e-01 -1.23304062e+00 9.16728416e-01]\n", " [-1.39227912e-01 -4.58172011e-01 1.64085405e+00]\n", " [ 1.18602198e+00 4.51708231e-01 6.42908592e-01]\n", " [-4.55217169e-01 -4.58747897e-01 1.38477594e+00]\n", " [ 1.03745311e+00 1.45179778e+00 7.25046382e-02]\n", " [ 1.33610706e+00 5.09711653e-01 1.33632253e+00]\n", " [-4.95822719e-01 3.84599562e-01 -1.06537199e+00]\n", " [-2.46867370e-02 -1.73677168e+00 1.10220003e+00]\n", " [-5.03151264e-01 -1.16009352e+00 -7.42587397e-02]\n", " [ 3.86716391e-01 9.66509560e-01 -2.03752062e+00]\n", " [ 1.80080926e+00 -9.05255354e-01 -7.84555319e-02]\n", " [-1.17494690e+00 2.89655945e+00 -1.97709288e-01]\n", " [-1.09833442e+00 -9.32406300e-01 -1.23181397e+00]\n", " [ 7.90010132e-01 7.55901172e-01 -9.58302548e-01]\n", " [-2.21272125e+00 -1.34931935e-01 -4.39708562e-01]\n", " [ 8.13941083e-01 -5.11092716e-01 -6.19509233e-02]\n", " [ 2.07589853e-02 -6.32395987e-01 1.06978679e+00]\n", " [ 8.09502594e-01 2.03806758e-01 -1.35941143e-01]\n", " [ 8.11002548e-01 -1.18196060e-01 3.30362050e-01]\n", " [ 1.47709136e+00 -6.08384586e-02 -9.98159144e-01]\n", " [-3.53933331e-01 -6.71681737e-02 -1.78856639e+00]\n", " [-1.41111963e+00 -7.47087780e-01 1.54447538e-01]\n", " [-9.13747808e-01 7.46500110e-01 4.91695280e-01]\n", " [-1.28467055e+00 -8.54011004e-01 -1.72534868e-01]\n", " [ 3.46017457e-01 2.06362316e-01 4.93984891e-01]\n", " [ 1.07715848e+00 3.72204294e-03 1.22622028e+00]\n", " [ 1.12603039e-01 -1.42076995e+00 -3.83678580e-01]\n", " [-1.18489847e-01 -9.12843515e-03 -2.37108123e+00]\n", " [-6.05960884e-01 -5.07925247e-02 -1.89406476e-01]\n", " [-7.35225166e-01 -9.51422035e-01 2.04450460e+00]\n", " [-7.43107859e-01 -5.85608751e-01 -8.75191844e-02]\n", " [ 8.18358065e-02 7.20832260e-01 1.31398771e+00]\n", " [ 2.75934606e-01 1.98043208e+00 -5.92095548e-02]]\n" ] } ], "source": [ "A = random.randn(100, 3) # A matrix stacked with 100 3D row vectors\n", "print(A)" ] }, { "cell_type": "markdown", "metadata": { "id": "up78erKX3EV2" }, "source": [ "(1) Generate a rotation matrix $R$ that rotates 100 vectors, and compute the matrix of rotated vectors stacked vertically into a shape of (100, 3). Here, the 3D rotation matrix $R$ for a random rotation is generated by passing a 1D array of three randomly generated angle parameters to the `gen_R_3d` function." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "s6LyrA6t3EV2" }, "outputs": [], "source": [ "# (1)\n", "def gen_R_3d(p):\n", " px, py, pz = p\n", " Rx = np.array([\n", " [1, 0, 0],\n", " [0, np.cos(px), np.sin(px)],\n", " [0, -np.sin(px), np.cos(px)]\n", " ])\n", " Ry = np.array([\n", " [np.cos(py), 0, -np.sin(py)],\n", " [0, 1, 0],\n", " [np.sin(py), 0, np.cos(py)]\n", " ])\n", " Rz = np.array([\n", " [np.cos(pz), np.sin(pz), 0],\n", " [-np.sin(pz), np.cos(pz), 0],\n", " [0, 0, 1]\n", " ])\n", "\n", " return Rz @ Ry @ Rx" ] }, { "cell_type": "markdown", "metadata": { "id": "3NSBUYdt3EV4" }, "source": [ "\n", "(2) To normalize each vector obtained in (1) so that the L2 norm equals 1 and then stack them vertically to form a (100, 3) matrix, you would follow these steps:\n", "\n", "Compute the L2 norm for each vector.\n", "Normalize each vector by dividing by its L2 norm.\n", "Stack the normalized vectors without changing their order." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "rS_Jg6RF3EV4" }, "outputs": [], "source": [ "# (2)" ] }, { "cell_type": "markdown", "metadata": { "id": "_mJq1aUc3EV7" }, "source": [ "(3) For the 100 vectors with a norm of 1 obtained in (2), compute a matrix of shape (100, 6) by stacking the original 100 vectors and their -1 multiplied counterparts **horizontally**, without changing the order of the vectors." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "W11yVX0w3EV7" }, "outputs": [], "source": [ "# (3)" ] }, { "cell_type": "markdown", "metadata": { "id": "r4Z_oSPm3EV8" }, "source": [ "(4) (Somewhat Difficult)\n", "Currently, in a 3D space, there are 8 quadrants numbered from 0 to 7. Instead of directly finding the quadrant, we will use 6 standard basis vectors and their inverse (6 vectors in total). The task is to find the \"most similar\" vector from this set.\n", "\n", "After rotating the vectors, find the corresponding vector number and store it in a (100, 1) matrix.\n", "(Hint: Think about how to assign the vector number using the normalized vectors. You can avoid using the inner product for efficiency. If you're unsure, try considering the case in 2D and then apply the same idea to 3D. You can utilize the normalization step from part (2).)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "1x7oyKTH3EV8" }, "outputs": [], "source": [ "# (4)" ] }, { "cell_type": "markdown", "metadata": { "id": "GX5uZrtC3EV9" }, "source": [ "(5) (For those with extra time)\n", "For the 100 vectors, calculate the cosine of the angle $\\theta$ between every pair of vectors. Verify that vectors that are \"similar\" (i.e., have a small angle between them) are likely to have been assigned the same integer value, while vectors that are \"dissimilar\" (i.e., have a large angle between them) are likely to have been assigned different integer values." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "Vecz2afZ3EV9" }, "outputs": [], "source": [ "# (5)" ] } ], "metadata": { "colab": { "provenance": [] }, "kernelspec": { "display_name": "base", "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.13.11" } }, "nbformat": 4, "nbformat_minor": 0 }