Skip to content

Commit

Permalink
docs(notebook): update gan example
Browse files Browse the repository at this point in the history
  • Loading branch information
marcpinet committed Dec 10, 2024
1 parent d063b08 commit 51222ed
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"from keras.datasets import mnist\n",
"from IPython.display import Image as IPImage\n",
"\n",
"from neuralnetlib.preprocessing import one_hot_encode\n",
"from neuralnetlib.preprocessing import one_hot_encode, MinMaxScaler\n",
"from neuralnetlib.models import Sequential, GAN\n",
"from neuralnetlib.layers import Input, Dense, BatchNormalization, Dropout\n",
"from neuralnetlib.optimizers import Adam"
Expand All @@ -39,7 +39,8 @@
"X = X.reshape(X.shape[0], -1)\n",
"\n",
"# Normalize pixel values\n",
"X = X.astype('float32') / 255\n",
"scaler = MinMaxScaler(feature_range=(-1, 1))\n",
"X = scaler.fit_transform(X)\n",
"\n",
"# Labels to categorical \n",
"y = one_hot_encode(y, n_classes)"
Expand Down Expand Up @@ -84,7 +85,7 @@
"generator.add(BatchNormalization())\n",
"generator.add(Dense(1024, activation='leakyrelu'))\n",
"generator.add(BatchNormalization())\n",
"generator.add(Dense(784, activation='sigmoid'))"
"generator.add(Dense(784, activation='tanh'))"
]
},
{
Expand Down

0 comments on commit 51222ed

Please sign in to comment.