{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# \u2705 NumPy Practice Exercise 2: Complete Solutions & Explanations\n", "\n", "Here are the complete, step-by-step solutions and explanations for the **15 advanced machine learning problems** in `04_numpy_exercise_2.ipynb`.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Problem 1: Vectorized Pairwise Euclidean Distance Matrix\n", "\n", "**Question:** Given two matrices $X$ of shape $(N, D)$ and $Y$ of shape $(M, D)$, compute the full pairwise distance matrix of shape $(N, M)$ without any Python loops using broadcasting.\n", "\n", "Test with:\n", "- $X$: 4 points in 3D\n", "- $Y$: 5 points in 3D\n" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Distance Matrix shape: (4, 5)\n", "Distance Matrix (4x5):\n", " [[ 5.8 9.72 2.24 6.78 4.62]\n", " [ 9.04 11.24 5.94 9.45 5.25]\n", " [ 3.38 5.85 6.52 8.86 6.82]\n", " [ 6.89 9.1 4.89 6.08 5.92]]\n" ] } ], "source": [ "import numpy as np\n", "\n", "def pairwise_distances(X, Y):\n", " # X: (N, 1, D), Y: (1, M, D) -> diff: (N, M, D)\n", " diff = X[:, np.newaxis, :] - Y[np.newaxis, :, :]\n", " return np.sqrt(np.sum(diff ** 2, axis=-1))\n", "\n", "rng = np.random.default_rng(42)\n", "X = rng.uniform(0, 10, size=(4, 3))\n", "Y = rng.uniform(0, 10, size=(5, 3))\n", "\n", "dist_mat = pairwise_distances(X, Y)\n", "print(\"Distance Matrix shape:\", dist_mat.shape)\n", "print(\"Distance Matrix (4x5):\\n\", np.round(dist_mat, 2))\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Problem 2: Numerically Stable Softmax Function\n", "\n", "**Question:** Write a function `softmax(logits, axis=-1)` that computes the softmax probabilities across any specified axis.\n", "Make sure it is **numerically stable** against large numbers (e.g. logits like 1000.0) by subtracting the maximum logit before computing exponents.\n" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Softmax Probabilities:\n", " [[0.2447 0.6652 0.09 ]\n", " [0.09 0.2447 0.6652]]\n", "Sum of probabilities along axis=-1: [1. 1.]\n" ] } ], "source": [ "def softmax(logits, axis=-1):\n", " # Subtract max along axis for numerical stability\n", " shifted = logits - np.max(logits, axis=axis, keepdims=True)\n", " exp_vals = np.exp(shifted)\n", " return exp_vals / np.sum(exp_vals, axis=axis, keepdims=True)\n", "\n", "# Test with potentially overflowing numbers\n", "logits = np.array([[1000.0, 1001.0, 999.0],\n", " [1.0, 2.0, 3.0]])\n", "probs = softmax(logits, axis=-1)\n", "print(\"Softmax Probabilities:\\n\", np.round(probs, 4))\n", "print(\"Sum of probabilities along axis=-1:\", np.sum(probs, axis=-1))\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Problem 3: Vectorized One-Hot Encoding\n", "\n", "**Question:** Write a function `one_hot_encode(labels, num_classes)` that converts a 1D vector of integer class labels into a 2D binary indicator matrix of shape $(N, num\\_classes)$ using NumPy indexing.\n" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Original labels: [2 0 1 3 2 1]\n", "One-hot encoded (shape): (6, 4)\n", "One-hot matrix:\n", " [[0. 0. 1. 0.]\n", " [1. 0. 0. 0.]\n", " [0. 1. 0. 0.]\n", " [0. 0. 0. 1.]\n", " [0. 0. 1. 0.]\n", " [0. 1. 0. 0.]]\n" ] } ], "source": [ "def one_hot_encode(labels, num_classes):\n", " return np.eye(num_classes)[labels]\n", "\n", "labels = np.array([2, 0, 1, 3, 2, 1])\n", "encoded = one_hot_encode(labels, num_classes=4)\n", "print(\"Original labels:\", labels)\n", "print(\"One-hot encoded (shape):\", encoded.shape)\n", "print(\"One-hot matrix:\\n\", encoded)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Problem 4: Z-Score Feature Standardization with `keepdims=True`\n", "\n", "**Question:** Write a function `standardize(X)` that takes a 2D dataset of shape $(N, D)$ and centers each column to mean 0 and scales each column to standard deviation 1. Use `keepdims=True` and guard against division by zero (if std is 0).\n" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Original mean: [49.18 93.62 1.87]\n", "Original std: [ 9.71 19.99 0.51]\n", "\n", "Scaled mean (should be ~0): [ 0. 0. -0.]\n", "Scaled std (should be ~1): [1. 1. 1.]\n" ] } ], "source": [ "def standardize(X, eps=1e-8):\n", " mean = np.mean(X, axis=0, keepdims=True)\n", " std = np.std(X, axis=0, keepdims=True)\n", " return (X - mean) / (std + eps)\n", "\n", "rng = np.random.default_rng(10)\n", "data = rng.normal(loc=[50, 100, 2], scale=[10, 25, 0.5], size=(100, 3))\n", "\n", "scaled_data = standardize(data)\n", "print(\"Original mean:\", np.round(np.mean(data, axis=0), 2))\n", "print(\"Original std: \", np.round(np.std(data, axis=0), 2))\n", "print(\"\\nScaled mean (should be ~0):\", np.round(np.mean(scaled_data, axis=0), 5))\n", "print(\"Scaled std (should be ~1):\", np.round(np.std(scaled_data, axis=0), 5))\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Problem 5: Linear Regression via the Normal Equation\n", "\n", "**Question:** Given feature matrix $X$ and target vector $y$, find the optimal weight vector $\\theta = [\\theta_0, \\theta_1, \\dots]^T$ using the closed-form Normal Equation:\n", "$$\\theta = (X_{b}^T X_b)^{-1} X_b^T y$$\n", "Where $X_b$ includes an initial bias column of ones.\n" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Learned Bias (True: 5.5): 5.4397\n", "Learned Weights (True: [ 4.2 -1.8]): 4.2010, -1.7911\n" ] } ], "source": [ "rng = np.random.default_rng(42)\n", "N = 100\n", "X = rng.uniform(0, 10, size=(N, 2))\n", "true_weights = np.array([4.2, -1.8])\n", "true_bias = 5.5\n", "y = X @ true_weights + true_bias + rng.normal(0, 0.2, size=N)\n", "\n", "# Add bias column\n", "X_b = np.hstack([np.ones((N, 1)), X])\n", "\n", "# Solve normal equation\n", "theta = np.linalg.inv(X_b.T @ X_b) @ X_b.T @ y\n", "\n", "print(f\"Learned Bias (True: {true_bias}): {theta[0]:.4f}\")\n", "print(f\"Learned Weights (True: {true_weights}): {theta[1]:.4f}, {theta[2]:.4f}\")\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Problem 6: 1D Moving Average Filter via Convolution\n", "\n", "**Question:** Given a noisy 1D signal, compute its moving average with a window size of $w=5$ using `np.convolve` in `'valid'` mode.\n" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Original signal length: 12\n", "Moving average length: 8\n", "Moving average result:\n", " [3.8 5. 5.6 7. 8. 8. 7.6 7. ]\n" ] } ], "source": [ "signal = np.array([1, 3, 2, 5, 8, 7, 6, 9, 10, 8, 5, 3])\n", "window_size = 5\n", "kernel = np.ones(window_size) / window_size\n", "\n", "moving_avg = np.convolve(signal, kernel, mode='valid')\n", "print(\"Original signal length:\", len(signal))\n", "print(\"Moving average length: \", len(moving_avg))\n", "print(\"Moving average result:\\n\", np.round(moving_avg, 2))\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Problem 7: Find Nearest Neighbor (k-NN core step)\n", "\n", "**Question:** Given a dataset of 50 2D points and a query point $q = [2.5, 3.5]$, find:\n", "1. The index of the nearest point.\n", "2. The coordinates of that nearest point.\n", "3. The exact Euclidean distance to that point.\n" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Nearest point index: 7\n", "Coordinates: [2.70271732 3.50014949]\n", "Euclidean distance: 0.2027\n" ] } ], "source": [ "rng = np.random.default_rng(99)\n", "points = rng.uniform(0, 10, size=(50, 2))\n", "query = np.array([2.5, 3.5])\n", "\n", "# Vectorized Euclidean distance from query to all points\n", "dists = np.linalg.norm(points - query, axis=1)\n", "\n", "nearest_idx = np.argmin(dists)\n", "print(f\"Nearest point index: {nearest_idx}\")\n", "print(f\"Coordinates: {points[nearest_idx]}\")\n", "print(f\"Euclidean distance: {dists[nearest_idx]:.4f}\")\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Problem 8: Binary Cross-Entropy Loss with Clipping\n", "\n", "**Question:** Write a function `binary_cross_entropy(y_true, y_pred, eps=1e-15)` that calculates binary cross-entropy loss:\n", "$$L = -\\frac{1}{N} \\sum [y \\log(p) + (1-y) \\log(1 - p)]$$\n", "Clip `y_pred` to `[eps, 1 - eps]` using `np.clip` to prevent `log(0)` returning `NaN` or `-inf`.\n" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "BCE Loss: 0.1181\n", "BCE Loss on extreme values (safe with clipping): 0.0\n" ] } ], "source": [ "def binary_cross_entropy(y_true, y_pred, eps=1e-15):\n", " p = np.clip(y_pred, eps, 1.0 - eps)\n", " loss = -np.mean(y_true * np.log(p) + (1 - y_true) * np.log(1 - p))\n", " return loss\n", "\n", "y_true = np.array([1, 0, 1, 1, 0])\n", "y_pred = np.array([0.99, 0.05, 0.85, 0.70, 0.01])\n", "print(\"BCE Loss:\", round(binary_cross_entropy(y_true, y_pred), 4))\n", "\n", "# Extreme edge case test (predictions equal to exactly 0 or 1)\n", "y_edge_pred = np.array([1.0, 0.0, 1.0, 1.0, 0.0])\n", "print(\"BCE Loss on extreme values (safe with clipping):\", round(binary_cross_entropy(y_true, y_edge_pred), 4))\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Problem 9: Efficient Top-K Extraction with `argpartition`\n", "\n", "**Question:** Given an array of 10,000 random floating numbers, find the indices and values of the **top 5 largest numbers** in $O(N)$ expected time using `np.argpartition` without performing a full $O(N \\log N)$ sort.\n" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Top 5 Indices: [7491 7398 2210 4889 6594]\n", "Top 5 Values: [0.99997702 0.99986085 0.99976534 0.99971485 0.99951811]\n" ] } ], "source": [ "rng = np.random.default_rng(42)\n", "arr = rng.random(10_000)\n", "\n", "k = 5\n", "# argpartition puts the k largest elements at the end\n", "top_k_unsorted_idx = np.argpartition(arr, -k)[-k:]\n", "\n", "# Sort only the top k elements\n", "top_k_sorted_idx = top_k_unsorted_idx[np.argsort(arr[top_k_unsorted_idx])[::-1]]\n", "\n", "print(\"Top 5 Indices:\", top_k_sorted_idx)\n", "print(\"Top 5 Values: \", arr[top_k_sorted_idx])\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Problem 10: Image Tensor Channel Transposition & Grayscale Conversion\n", "\n", "**Question:** Simulate a batch of 8 RGB images of size 64x64 with shape `(B, H, W, C) = (8, 64, 64, 3)` with random pixel intensities between 0 and 255.\n", "1. Transpose the tensor into PyTorch format `(B, C, H, W)`.\n", "2. Convert the original RGB batch to Grayscale with shape `(8, 64, 64)` using the standard luminance formula: $Y = 0.299 R + 0.587 G + 0.114 B$ using matrix dot product or broadcasting.\n" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Original batch shape (B, H, W, C): (8, 64, 64, 3)\n", "PyTorch batch shape (B, C, H, W): (8, 3, 64, 64)\n", "Grayscale batch shape (B, H, W): (8, 64, 64)\n" ] } ], "source": [ "rng = np.random.default_rng(7)\n", "images = rng.integers(0, 256, size=(8, 64, 64, 3), dtype=np.uint8)\n", "print(\"Original batch shape (B, H, W, C):\", images.shape)\n", "\n", "# 1. Transpose to PyTorch (B, C, H, W)\n", "pytorch_format = np.transpose(images, (0, 3, 1, 2))\n", "print(\"PyTorch batch shape (B, C, H, W): \", pytorch_format.shape)\n", "\n", "# 2. RGB to Grayscale\n", "weights = np.array([0.299, 0.587, 0.114]) # shape (3,)\n", "grayscale = np.dot(images.astype(np.float32), weights)\n", "print(\"Grayscale batch shape (B, H, W): \", grayscale.shape)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Problem 11: Vectorized Cosine Similarity Matrix\n", "\n", "**Question:** Given two matrices $A$ of shape $(N, D)$ and $B$ of shape $(M, D)$ containing embeddings, compute the full $N \\times M$ pairwise cosine similarity matrix without any Python loops:\n", "$$\\text{cosine\\_sim}(u, v) = \\frac{u \\cdot v}{\\|u\\|_2 \\|v\\|_2}$$\n" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Cosine Similarity Matrix shape: (3, 5)\n", "Similarity values (bounded between -1 and 1):\n", " [[ 0.134 -0.555 0.803 0.378 -0.487]\n", " [ 0.063 0.595 -0.463 0.149 -0.039]\n", " [-0.1 -0.296 -0.235 -0.581 0.803]]\n" ] } ], "source": [ "def cosine_similarity_matrix(A, B, eps=1e-8):\n", " dot_product = A @ B.T # Shape (N, M)\n", " norm_A = np.linalg.norm(A, axis=1, keepdims=True) # (N, 1)\n", " norm_B = np.linalg.norm(B, axis=1, keepdims=True) # (M, 1)\n", " return dot_product / (norm_A @ norm_B.T + eps)\n", "\n", "rng = np.random.default_rng(123)\n", "A = rng.standard_normal((3, 4))\n", "B = rng.standard_normal((5, 4))\n", "\n", "sim = cosine_similarity_matrix(A, B)\n", "print(\"Cosine Similarity Matrix shape:\", sim.shape)\n", "print(\"Similarity values (bounded between -1 and 1):\\n\", np.round(sim, 3))\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Problem 12: Polynomial Feature Expansion\n", "\n", "**Question:** Given a 1D input array $x$ of length $N$, generate the polynomial feature matrix up to degree $d=3$:\n", "$$[1, x, x^2, x^3]$$\n", "Do this two ways:\n", "1. Using column stacking with exponentiation.\n", "2. Using `np.vander(x, N=4, increasing=True)`.\n" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Method 1:\n", " [[ 1. 2. 4. 8.]\n", " [ 1. 3. 9. 27.]\n", " [ 1. 4. 16. 64.]\n", " [ 1. 5. 25. 125.]]\n", "Method 2:\n", " [[ 1. 2. 4. 8.]\n", " [ 1. 3. 9. 27.]\n", " [ 1. 4. 16. 64.]\n", " [ 1. 5. 25. 125.]]\n", "Are both methods equal? True\n" ] } ], "source": [ "x = np.array([2.0, 3.0, 4.0, 5.0])\n", "\n", "# Method 1: Column stack\n", "poly1 = np.column_stack([x**0, x**1, x**2, x**3])\n", "\n", "# Method 2: Vandermonde matrix\n", "poly2 = np.vander(x, N=4, increasing=True)\n", "\n", "print(\"Method 1:\\n\", poly1)\n", "print(\"Method 2:\\n\", poly2)\n", "print(\"Are both methods equal?\", np.allclose(poly1, poly2))\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Problem 13: Principal Component Analysis (PCA) From Scratch\n", "\n", "**Question:** Perform PCA on an $N \\times 4$ dataset from scratch:\n", "1. Center the features to zero mean.\n", "2. Compute the sample covariance matrix: $\\Sigma = \\frac{1}{N-1} X_c^T X_c$.\n", "3. Compute eigenvalues and eigenvectors using `np.linalg.eigh`.\n", "4. Sort the eigenvectors in descending order of eigenvalues.\n", "5. Project the data onto the first 2 principal components.\n" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Eigenvalues (variance explained): [50.1 22.58 3.8 0.94]\n", "Projected data shape: (100, 4) -> (100, 2)\n" ] } ], "source": [ "rng = np.random.default_rng(42)\n", "X = rng.normal(loc=[10, 20, 30, 40], scale=[1, 5, 2, 8], size=(100, 4))\n", "\n", "# 1. Center\n", "X_c = X - np.mean(X, axis=0)\n", "\n", "# 2. Covariance matrix\n", "N = X.shape[0]\n", "cov_matrix = (X_c.T @ X_c) / (N - 1)\n", "\n", "# 3. Eigendecomposition\n", "eigenvalues, eigenvectors = np.linalg.eigh(cov_matrix)\n", "\n", "# 4. Sort descending\n", "idx = np.argsort(eigenvalues)[::-1]\n", "eigenvalues = eigenvalues[idx]\n", "eigenvectors = eigenvectors[:, idx]\n", "\n", "# 5. Project onto top 2 components\n", "top_2_eigenvectors = eigenvectors[:, :2]\n", "X_projected = X_c @ top_2_eigenvectors\n", "\n", "print(\"Eigenvalues (variance explained):\", np.round(eigenvalues, 2))\n", "print(\"Projected data shape: (100, 4) ->\", X_projected.shape)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Problem 14: Mini-Batch Generator for Stochastic Gradient Descent\n", "\n", "**Question:** Write a Python generator function `get_batches(X, y, batch_size, shuffle=True)` that yields batches $(X_{batch}, y_{batch})$ of size `batch_size`. Ensure the indices are randomly permuted without copying the entire dataset up front.\n" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Batch 1: X shape (16, 2), y shape (16,)\n", "Batch 2: X shape (16, 2), y shape (16,)\n", "Batch 3: X shape (16, 2), y shape (16,)\n", "Batch 4: X shape (2, 2), y shape (2,)\n" ] } ], "source": [ "def get_batches(X, y, batch_size=32, shuffle=True, seed=None):\n", " N = len(X)\n", " indices = np.arange(N)\n", " if shuffle:\n", " rng = np.random.default_rng(seed)\n", " indices = rng.permutation(N)\n", " \n", " for start_idx in range(0, N, batch_size):\n", " batch_idx = indices[start_idx : start_idx + batch_size]\n", " yield X[batch_idx], y[batch_idx]\n", "\n", "# Test\n", "X = np.arange(100).reshape(50, 2)\n", "y = np.arange(50)\n", "\n", "batch_count = 0\n", "for X_b, y_b in get_batches(X, y, batch_size=16, shuffle=True, seed=42):\n", " batch_count += 1\n", " print(f\"Batch {batch_count}: X shape {X_b.shape}, y shape {y_b.shape}\")\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Problem 15: 2D Image Edge Detection (Convolution)\n", "\n", "**Question:** Given an $8 \\times 8$ grayscale image and a $3 \\times 3$ Laplacian edge-detection kernel:\n", "$$K = \\begin{pmatrix} 0 & 1 & 0 \\\\ 1 & -4 & 1 \\\\ 0 & 1 & 0 \\end{pmatrix}$$\n", "Compute the $6 \\times 6$ valid convolution output without external libraries using vectorization or a sliding window.\n" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Original image shape: (8, 8)\n", "Convolved edge map:\n", " [[ 0. 0. 40. -40. 0. 0.]\n", " [ 0. 0. 40. -40. 0. 0.]\n", " [ 0. 0. 40. -40. 0. 0.]\n", " [ 0. 0. 40. -40. 0. 0.]\n", " [ 0. 0. 40. -40. 0. 0.]\n", " [ 0. 0. 40. -40. 0. 0.]]\n" ] } ], "source": [ "image = np.array([\n", " [10, 10, 10, 10, 50, 50, 50, 50],\n", " [10, 10, 10, 10, 50, 50, 50, 50],\n", " [10, 10, 10, 10, 50, 50, 50, 50],\n", " [10, 10, 10, 10, 50, 50, 50, 50],\n", " [10, 10, 10, 10, 50, 50, 50, 50],\n", " [10, 10, 10, 10, 50, 50, 50, 50],\n", " [10, 10, 10, 10, 50, 50, 50, 50],\n", " [10, 10, 10, 10, 50, 50, 50, 50]\n", "], dtype=float)\n", "\n", "kernel = np.array([\n", " [0, 1, 0],\n", " [1, -4, 1],\n", " [0, 1, 0]\n", "], dtype=float)\n", "\n", "H, W = image.shape\n", "kH, kW = kernel.shape\n", "out_H, out_W = H - kH + 1, W - kW + 1\n", "\n", "output = np.zeros((out_H, out_W))\n", "\n", "# Convolve sliding window\n", "for r in range(out_H):\n", " for c in range(out_W):\n", " window = image[r:r+kH, c:c+kW]\n", " output[r, c] = np.sum(window * kernel)\n", "\n", "print(\"Original image shape:\", image.shape)\n", "print(\"Convolved edge map:\\n\", output)\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.11.0" } }, "nbformat": 4, "nbformat_minor": 4 }