diff --git a/Notebooks/Notebook-3b.ipynb b/Notebooks/Notebook-3b.ipynb index 0b895c3..ab64ef0 100644 --- a/Notebooks/Notebook-3b.ipynb +++ b/Notebooks/Notebook-3b.ipynb @@ -51,58 +51,11 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "859cbc0f", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Training set shape: (60000, 28, 28)\n", - "Test set shape: (10000, 28, 28)\n", - "Classes: [0 1 2 3 4 5 6 7 8 9]\n" - ] - } - ], - "source": [ - "# 2. Load Dataset\n", - "# Fashion MNIST is built into Keras, downloads automatically on first run\n", - "(X_train, y_train), (X_test, y_test) = tf.keras.datasets.fashion_mnist.load_data()\n", - "\n", - "'''\n", - "import numpy as np\n", - "import gzip\n", - "import os\n", - "\n", - "def load_fashion_mnist(path):\n", - " \"\"\"Load Fashion MNIST from local .gz files (Kaggle Zalando format).\"\"\"\n", - " files = {\n", - " 'X_train': 'train-images-idx3-ubyte.gz',\n", - " 'y_train': 'train-labels-idx1-ubyte.gz',\n", - " 'X_test': 't10k-images-idx3-ubyte.gz',\n", - " 'y_test': 't10k-labels-idx1-ubyte.gz',\n", - " }\n", - "\n", - " with gzip.open(os.path.join(path, files['X_train'])) as f:\n", - " X_train = np.frombuffer(f.read(), np.uint8, offset=16).reshape(-1, 28, 28)\n", - " with gzip.open(os.path.join(path, files['y_train'])) as f:\n", - " y_train = np.frombuffer(f.read(), np.uint8, offset=8)\n", - " with gzip.open(os.path.join(path, files['X_test'])) as f:\n", - " X_test = np.frombuffer(f.read(), np.uint8, offset=16).reshape(-1, 28, 28)\n", - " with gzip.open(os.path.join(path, files['y_test'])) as f:\n", - " y_test = np.frombuffer(f.read(), np.uint8, offset=8)\n", - "\n", - " return (X_train, y_train), (X_test, y_test)\n", - "\n", - "# Replace the Keras load line with:\n", - "(X_train, y_train), (X_test, y_test) = load_fashion_mnist('./fashion-mnist/')\n", - "'''\n", - "\n", - "print(\"Training set shape:\", X_train.shape) # (60000, 28, 28)\n", - "print(\"Test set shape: \", X_test.shape) # (10000, 28, 28)\n", - "print(\"Classes:\", np.unique(y_train))" - ] + "outputs": [], + "source": "# 2. Load Dataset\n# Fashion MNIST is built into Keras — downloads automatically on first run\n(X_train, y_train), (X_test, y_test) = tf.keras.datasets.fashion_mnist.load_data()\n\n# --- Offline alternative (comment out tf.keras line above and use this instead) ---\n# import pandas as pd\n# train_df = pd.read_csv('fashion-mnist_train.csv')\n# test_df = pd.read_csv('fashion-mnist_test.csv')\n# y_train = train_df['label'].values\n# y_test = test_df['label'].values\n# X_train = train_df.drop('label', axis=1).values.reshape(-1, 28, 28) # unflatten pixels to 28x28\n# X_test = test_df.drop('label', axis=1).values.reshape(-1, 28, 28)\n\nprint(\"Training set shape:\", X_train.shape) # (60000, 28, 28)\nprint(\"Test set shape: \", X_test.shape) # (10000, 28, 28)\nprint(\"Classes:\", np.unique(y_train))" }, { "cell_type": "code", @@ -597,4 +550,4 @@ }, "nbformat": 4, "nbformat_minor": 5 -} +} \ No newline at end of file