mirror of
https://github.com/ArthurDanjou/ArtStudies.git
synced 2026-01-29 01:57:03 +01:00
Refactor code for improved readability and consistency across multiple Jupyter notebooks
- Added missing commas in various print statements and function calls for better syntax. - Reformatted code to enhance clarity, including breaking long lines and aligning parameters. - Updated function signatures to use float type for sigma parameters instead of int for better precision. - Cleaned up comments and documentation strings for clarity and consistency. - Ensured consistent formatting in plotting functions and data handling.
This commit is contained in:
@@ -18,15 +18,12 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import numpy as np\n",
|
||||
"import pandas as pd\n",
|
||||
"\n",
|
||||
"%matplotlib inline\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"import seaborn as sns\n",
|
||||
"\n",
|
||||
"sns.set(style=\"whitegrid\")\n",
|
||||
"\n",
|
||||
"import tensorflow as tf\n",
|
||||
"from sklearn.model_selection import train_test_split\n",
|
||||
"from sklearn.preprocessing import StandardScaler\n",
|
||||
"from tensorflow import keras\n",
|
||||
@@ -35,18 +32,29 @@
|
||||
" keras.datasets.fashion_mnist.load_data()\n",
|
||||
")\n",
|
||||
"X_train, X_valid, y_train, y_valid = train_test_split(\n",
|
||||
" X_train_full, y_train_full, train_size=0.8\n",
|
||||
" X_train_full,\n",
|
||||
" y_train_full,\n",
|
||||
" train_size=0.8,\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"scaler = StandardScaler()\n",
|
||||
"X_train = scaler.fit_transform(X_train.astype(np.float32).reshape(-1, 28 * 28)).reshape(\n",
|
||||
" -1, 28, 28, 1\n",
|
||||
" -1,\n",
|
||||
" 28,\n",
|
||||
" 28,\n",
|
||||
" 1,\n",
|
||||
")\n",
|
||||
"X_valid = scaler.transform(X_valid.astype(np.float32).reshape(-1, 28 * 28)).reshape(\n",
|
||||
" -1, 28, 28, 1\n",
|
||||
" -1,\n",
|
||||
" 28,\n",
|
||||
" 28,\n",
|
||||
" 1,\n",
|
||||
")\n",
|
||||
"X_test = scaler.transform(X_test.astype(np.float32).reshape(-1, 28 * 28)).reshape(\n",
|
||||
" -1, 28, 28, 1\n",
|
||||
" -1,\n",
|
||||
" 28,\n",
|
||||
" 28,\n",
|
||||
" 1,\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user