diff --git a/README.ipynb b/README.ipynb index 4ca6affcd6b1cea0c8f5c5d18811aa104a3ffb88..add4bf8656a75d43b45eed3a7e12e5788f3b0759 100644 --- a/README.ipynb +++ b/README.ipynb @@ -3,13 +3,13 @@ { "cell_type": "code", "execution_count": 1, - "id": "26e42746", + "id": "d32ade6b", "metadata": { "execution": { - "iopub.execute_input": "2022-10-12T14:41:38.853343Z", - "iopub.status.busy": "2022-10-12T14:41:38.852566Z", - "iopub.status.idle": "2022-10-12T14:41:38.864329Z", - "shell.execute_reply": "2022-10-12T14:41:38.863589Z" + "iopub.execute_input": "2022-10-12T22:58:07.403985Z", + "iopub.status.busy": "2022-10-12T22:58:07.403126Z", + "iopub.status.idle": "2022-10-12T22:58:07.414447Z", + "shell.execute_reply": "2022-10-12T22:58:07.413483Z" }, "jupyter": { "source_hidden": true @@ -52,7 +52,7 @@ "For more information, you can contact us at : \n", "[<img width=\"200px\" style=\"vertical-align:middle\" src=\"fidle/img/00-Mail_contact.svg\"></img>](#top)\n", "\n", - "Current Version : <!-- VERSION_BEGIN -->2.1b4<!-- VERSION_END -->\n", + "Current Version : <!-- VERSION_BEGIN -->2.1b5<!-- VERSION_END -->\n", "\n", "\n", "## Course materials\n", @@ -67,7 +67,7 @@ "## Jupyter notebooks\n", "\n", "<!-- TOC_BEGIN -->\n", - "<!-- Automatically generated on : 12/10/22 16:41:37 -->\n", + "<!-- Automatically generated on : 13/10/22 00:58:06 -->\n", "\n", "### Linear and logistic regression\n", "- **[LINR1](LinearReg/01-Linear-Regression.ipynb)** - [Linear regression with direct resolution](LinearReg/01-Linear-Regression.ipynb) \n", @@ -229,7 +229,7 @@ "from IPython.display import display,Markdown\n", "display(Markdown(open('README.md', 'r').read()))\n", "#\n", - "# This README is visible under Jupiter Lab ;-)# Automatically generated on : 12/10/22 16:41:37" + "# This README is visible under Jupiter Lab ;-)# Automatically generated on : 13/10/22 00:58:06" ] } ], diff --git a/README.md b/README.md index bb5a0c2f2e5223f23566bbac307a9c446aab3b6f..eb321978324b6d232bad94cde30ef7754d5b4b3d 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ For more information, see **https://fidle.cnrs.fr** : For more information, you can contact us at : [<img width="200px" style="vertical-align:middle" src="fidle/img/00-Mail_contact.svg"></img>](#top) -Current Version : <!-- VERSION_BEGIN -->2.1b4<!-- VERSION_END --> +Current Version : <!-- VERSION_BEGIN -->2.1b5<!-- VERSION_END --> ## Course materials @@ -46,7 +46,7 @@ Have a look about **[How to get and install](https://fidle.cnrs.fr/installation) ## Jupyter notebooks <!-- TOC_BEGIN --> -<!-- Automatically generated on : 12/10/22 16:41:37 --> +<!-- Automatically generated on : 13/10/22 00:58:06 --> ### Linear and logistic regression - **[LINR1](LinearReg/01-Linear-Regression.ipynb)** - [Linear regression with direct resolution](LinearReg/01-Linear-Regression.ipynb) diff --git a/VAE/02-VAE-with-MNIST.ipynb b/VAE/02-VAE-with-MNIST.ipynb index 813d4082c76093e036efc2032389134ce9d5a257..242c937f9f9e1130aff7256249040bd548165db0 100644 --- a/VAE/02-VAE-with-MNIST.ipynb +++ b/VAE/02-VAE-with-MNIST.ipynb @@ -426,29 +426,35 @@ "metadata": {}, "outputs": [], "source": [ - "grid_size = 18\n", - "grid_scale = 1\n", + "if latent_dim>2:\n", "\n", - "# ---- Draw a ppf grid\n", + " print('Sorry, This part can only work if the latent space is of dimension 2')\n", "\n", - "grid=[]\n", - "for y in scipy.stats.norm.ppf(np.linspace(0.99, 0.01, grid_size),scale=grid_scale):\n", - " for x in scipy.stats.norm.ppf(np.linspace(0.01, 0.99, grid_size),scale=grid_scale):\n", - " grid.append( (x,y) )\n", - "grid=np.array(grid)\n", + "else:\n", + " \n", + " grid_size = 18\n", + " grid_scale = 1\n", "\n", - "# ---- Draw latentspoints and grid\n", + " # ---- Draw a ppf grid\n", "\n", - "fig = plt.figure(figsize=(10, 8))\n", - "plt.scatter(z[:, 0] , z[:, 1], c=y_show, cmap= 'tab10', alpha=0.5, s=20)\n", - "plt.scatter(grid[:, 0] , grid[:, 1], c = 'black', s=60, linewidth=2, marker='+', alpha=1)\n", - "fidle.scrawler.save_fig('08-Latent-grid')\n", - "plt.show()\n", + " grid=[]\n", + " for y in scipy.stats.norm.ppf(np.linspace(0.99, 0.01, grid_size),scale=grid_scale):\n", + " for x in scipy.stats.norm.ppf(np.linspace(0.01, 0.99, grid_size),scale=grid_scale):\n", + " grid.append( (x,y) )\n", + " grid=np.array(grid)\n", "\n", - "# ---- Plot grid corresponding images\n", + " # ---- Draw latentspoints and grid\n", "\n", - "x_reconst = vae.decoder.predict([grid])\n", - "fidle.scrawler.images(x_reconst, indices='all', columns=grid_size, x_size=0.5,y_size=0.5, y_padding=0,spines_alpha=0.1, save_as='09-Latent-morphing')\n", + " fig = plt.figure(figsize=(10, 8))\n", + " plt.scatter(z[:, 0] , z[:, 1], c=y_show, cmap= 'tab10', alpha=0.5, s=20)\n", + " plt.scatter(grid[:, 0] , grid[:, 1], c = 'black', s=60, linewidth=2, marker='+', alpha=1)\n", + " fidle.scrawler.save_fig('08-Latent-grid')\n", + " plt.show()\n", + "\n", + " # ---- Plot grid corresponding images\n", + "\n", + " x_reconst = vae.decoder.predict([grid])\n", + " fidle.scrawler.images(x_reconst, indices='all', columns=grid_size, x_size=0.5,y_size=0.5, y_padding=0,spines_alpha=0.1, save_as='09-Latent-morphing')\n", "\n" ] }, diff --git a/VAE/03-VAE-with-MNIST-post.ipynb b/VAE/03-VAE-with-MNIST-post.ipynb index cca90efe40889c04ae0bc67ee939d84f54109c24..730d530035897ea33439a57b51749609d6c56ef5 100644 --- a/VAE/03-VAE-with-MNIST-post.ipynb +++ b/VAE/03-VAE-with-MNIST-post.ipynb @@ -222,23 +222,29 @@ "metadata": {}, "outputs": [], "source": [ - "# ---- Softmax rescale\n", - "#\n", - "zs = np.exp(z)/np.sum(np.exp(z),axis=1,keepdims=True)\n", - "# zc = zs * 1/np.max(zs)\n", - "\n", - "# ---- Create collection\n", - "#\n", - "c = Collection(zs, colors=y_show, labels=y_show)\n", - "c.attrs.markers_colormap = {'colorscale':'Rainbow','cmin':0,'cmax':latent_dim}\n", - "c.attrs.markers_size = 4\n", - "c.attrs.markers_border_width = 0\n", - "c.attrs.markers_opacity = 0.7\n", - "\n", - "s = Simplex.build(latent_dim)\n", - "s.attrs.width = 1000\n", - "s.attrs.height = 1000\n", - "s.plot(c)" + "if latent_dim<4:\n", + "\n", + " print('Sorry, This part can only work if the latent space is greater than 3')\n", + "\n", + "else:\n", + "\n", + " # ---- Softmax rescale\n", + " #\n", + " zs = np.exp(z)/np.sum(np.exp(z),axis=1,keepdims=True)\n", + " # zc = zs * 1/np.max(zs)\n", + "\n", + " # ---- Create collection\n", + " #\n", + " c = Collection(zs, colors=y_show, labels=y_show)\n", + " c.attrs.markers_colormap = {'colorscale':'Rainbow','cmin':0,'cmax':latent_dim}\n", + " c.attrs.markers_size = 4\n", + " c.attrs.markers_border_width = 0\n", + " c.attrs.markers_opacity = 0.7\n", + "\n", + " s = Simplex.build(latent_dim)\n", + " s.attrs.width = 1000\n", + " s.attrs.height = 1000\n", + " s.plot(c)" ] }, { diff --git a/fidle/about.yml b/fidle/about.yml index 00946f5929ce8cec053c50578474884ae239859c..0780ad5cb536428d5fb20039a0406e91c6fe95c1 100644 --- a/fidle/about.yml +++ b/fidle/about.yml @@ -13,7 +13,7 @@ # # This file describes the notebooks used by the Fidle training. -version: 2.1b4 +version: 2.1b5 content: notebooks name: Notebooks Fidle description: All notebooks used by the Fidle training diff --git a/fidle/ci/default.yml b/fidle/ci/default.yml index 2f23ed0d8311f8fab43be46f42806a18e577853f..eb09f39865ad0b4392c4d21f685ad9d57b31c938 100644 --- a/fidle/ci/default.yml +++ b/fidle/ci/default.yml @@ -1,6 +1,6 @@ campain: version: '1.0' - description: Automatically generated ci profile (12/10/22 16:41:37) + description: Automatically generated ci profile (13/10/22 00:58:06) directory: ./campains/default existing_notebook: 'remove # remove|skip' report_template: 'fidle # fidle|default' diff --git a/fidle/ci/cpu-native.yml b/fidle/ci/default_settings.yml similarity index 98% rename from fidle/ci/cpu-native.yml rename to fidle/ci/default_settings.yml index 2841536853a8b6df2084ef38c09f655abf5ef8c0..69df1d9e20bb1d027ad3a921b12e2b16a0c17de4 100644 --- a/fidle/ci/cpu-native.yml +++ b/fidle/ci/default_settings.yml @@ -1,7 +1,7 @@ campain: version: 1.0 - description: Full validation on CPU (fast) - directory: ./campains/cpu_small + description: Complete validation of notebooks with default settings + directory: ./campains/default_settings existing_notebook: skip report_template: fidle timeout: 6000 @@ -199,7 +199,7 @@ SYNOP2: sequence_len: default batch_size: default epochs: default - fit_verbosity: default + fit_verbosity: 2 SYNOP3: notebook: SYNOP/SYNOP3-12h-predictions.ipynb diff --git a/fidle/ci/scale1_settings.yml b/fidle/ci/scale1_settings.yml new file mode 100644 index 0000000000000000000000000000000000000000..f7d275b6e6398a2de5f3c27d9ee15957817129ca --- /dev/null +++ b/fidle/ci/scale1_settings.yml @@ -0,0 +1,464 @@ +campain: + version: 1.0 + description: Full validation of notebooks with scale parameters set to 1 + directory: ./campains/cpu_small + existing_notebook: skip + report_template: fidle + timeout: 6000 + environment_vars: + FIDLE_SAVE_FIGS: true + TF_CPP_MIN_LOG_LEVEL: 2 + + +# +# ------------ LinearReg +# +LINR1: + notebook: LinearReg/01-Linear-Regression.ipynb +GRAD1: + notebook: LinearReg/02-Gradient-descent.ipynb +POLR1: + notebook: LinearReg/03-Polynomial-Regression.ipynb +LOGR1: + notebook: LinearReg/04-Logistic-Regression.ipynb + +# +# ------------ IRIS +# +PER57: + notebook: IRIS/01-Simple-Perceptron.ipynb + +# +# ------------ BHPD +# +BHPD1: + notebook: BHPD/01-DNN-Regression.ipynb + overrides: + fit_verbosity: 2 +BHPD2: + notebook: BHPD/02-DNN-Regression-Premium.ipynb + overrides: + fit_verbosity: 2 + +# +# ------------ MNIST +# +MNIST1: + notebook: MNIST/01-DNN-MNIST.ipynb + overrides: + fit_verbosity: 2 + +MNIST2: + notebook: MNIST/02-CNN-MNIST.ipynb + overrides: + fit_verbosity: 2 + +# +# ------------ GTSRB +# +GTSRB1: + notebook: GTSRB/01-Preparation-of-data.ipynb + overrides: + scale: .05 + output_dir: ./data + progress_verbosity: 2 + +GTSRB2: + notebook: GTSRB/02-First-convolutions.ipynb + after: GTSRB1 + overrides: + enhanced_dir: '{datasets_dir}/GTSRB/enhanced' + dataset_name: set-24x24-L + batch_size: 64 + epochs: 5 + scale: 1 + fit_verbosity: 2 + +GTSRB3: + notebook: GTSRB/03-Tracking-and-visualizing.ipynb + after: GTSRB1 + overrides: + enhanced_dir: '{datasets_dir}/GTSRB/enhanced' + dataset_name: set-24x24-L + batch_size: 64 + epochs: 5 + scale: 1 + fit_verbosity: 2 + +GTSRB4: + notebook: GTSRB/04-Data-augmentation.ipynb + after: GTSRB1 + overrides: + enhanced_dir: '{datasets_dir}/GTSRB/enhanced' + dataset_name: set-24x24-L + batch_size: 64 + epochs: 5 + scale: 1 + fit_verbosity: 2 + +GTSRB5_1: + notebook: GTSRB/05-Full-convolutions.ipynb + after: GTSRB1 + overrides: + run_dir: ./run/GTSRB5 + enhanced_dir: '{datasets_dir}/GTSRB/enhanced' + datasets: "['set-24x24-L', 'set-24x24-RGB', 'set-48x48-L', 'set-48x48-RGB', 'set-24x24-L-LHE', 'set-24x24-RGB-HE', 'set-48x48-L-LHE', 'set-48x48-RGB-HE']" + models: "{'v1':'get_model_v1', 'v2':'get_model_v2', 'v3':'get_model_v3'}" + batch_size: 64 + epochs: 16 + scale: 1 + with_datagen: False + fit_verbosity: 2 + +GTSRB5_2: + notebook: GTSRB/05-Full-convolutions.ipynb + after: GTSRB1 + overrides: + run_dir: ./run/GTSRB5 + enhanced_dir: '{datasets_dir}/GTSRB/enhanced' + datasets: "['set-24x24-L', 'set-24x24-RGB', 'set-48x48-L', 'set-48x48-RGB', 'set-24x24-L-LHE', 'set-24x24-RGB-HE', 'set-48x48-L-LHE', 'set-48x48-RGB-HE']" + models: "{'v1':'get_model_v1', 'v2':'get_model_v2', 'v3':'get_model_v3'}" + batch_size: 64 + epochs: 16 + scale: 1 + with_datagen: False + fit_verbosity: 2 + +GTSRB5_3: + notebook: GTSRB/05-Full-convolutions.ipynb + after: GTSRB1 + overrides: + run_dir: ./run/GTSRB5 + enhanced_dir: '{datasets_dir}/GTSRB/enhanced' + datasets: "['set-48x48-L', 'set-48x48-RGB']" + models: "{'v2':'get_model_v2', 'v3':'get_model_v3'}" + batch_size: 64 + epochs: 16 + scale: 1 + with_datagen: True + fit_verbosity: 2 + +GTSRB6: + notebook: GTSRB/06-Notebook-as-a-batch.ipynb + +GTSRB7: + notebook: GTSRB/07-Show-report.ipynb + after: GTSRB5 + overrides: + report_dir: ./run/GTSRB5 + +# +# ------------ IMDB +# +IMDB1: + notebook: IMDB/01-One-hot-encoding.ipynb + overrides: + vocab_size: 8000 + hide_most_frequently: 0 + batch_size: 512 + epochs: 10 + fit_verbosity: 2 + +IMDB2: + notebook: IMDB/02-Keras-embedding.ipynb + overrides: + vocab_size: 8000 + hide_most_frequently: 0 + review_len: 256 + dense_vector_size: 32 + batch_size: 512 + epochs: 30 + output_dir: default + fit_verbosity: 2 + +IMDB3: + notebook: IMDB/03-Prediction.ipynb + after: IMDB2 + overrides: + vocab_size: 8000 + review_len: 256 + saved_models: default + dictionaries_dir: default + +IMDB4: + notebook: IMDB/04-Show-vectors.ipynb + after: IMDB2 + overrides: + vocab_size: 8000 + review_len: 256 + saved_models: default + dictionaries_dir: default + +IMDB5: + notebook: IMDB/05-LSTM-Keras.ipynb + overrides: + vocab_size: 8000 + hide_most_frequently: 0 + review_len: 256 + dense_vector_size: 32 + batch_size: 512 + epochs: 10 + scale: 1 + fit_verbosity: 2 + +# +# ------------ SYNOP +# +LADYB1: + notebook: SYNOP/LADYB1-Ladybug.ipynb + overrides: + scale: 1 + train_prop: 0.8 + sequence_len: 20 + predict_len: 5 + batch_size: 32 + epochs: 10 + +SYNOP1: + notebook: SYNOP/SYNOP1-Preparation-of-data.ipynb + overrides: + output_dir: default + +SYNOP2: + notebook: SYNOP/SYNOP2-First-predictions.ipynb + after: SYNOP1 + overrides: + scale: 1 + train_prop: 0.8 + sequence_len: 16 + batch_size: 32 + epochs: 10 + fit_verbosity: 2 + +SYNOP3: + notebook: SYNOP/SYNOP3-12h-predictions.ipynb + after: SYNOP2 + overrides: + iterations: 4 + scale: 1 + train_prop: 0.8 + sequence_len: 16 + +# +# ------------ Transformers +# +# TRANS1: +# notebook: Transformers/01-Distilbert.ipynb +# +# TRANS2: +# notebook: Transformers/02-distilbert_colab.ipynb + +# +# ------------ AE +# +AE1: + notebook: AE/01-Prepare-MNIST-dataset.ipynb + overrides: + prepared_dataset: default + scale: 1 + progress_verbosity: 2 + +AE2: + notebook: AE/02-AE-with-MNIST.ipynb + after: AE1 + overrides: + prepared_dataset: default + dataset_seed: 123 + scale: 1 + latent_dim: 10 + train_prop: 0.8 + batch_size: 128 + epochs: 30 + fit_verbosity: 2 + +AE3: + notebook: AE/03-AE-with-MNIST-post.ipynb + after: AE2 + overrides: + prepared_dataset: default + dataset_seed: 123 + scale: 1 + train_prop: 0.8 + +AE4: + notebook: AE/04-ExtAE-with-MNIST.ipynb + after: AE1 + overrides: + prepared_dataset: default + dataset_seed: default + scale: 1 + latent_dim: 10 + train_prop: 0.8 + batch_size: 128 + epochs: 20 + fit_verbosity: 2 + +AE5: + notebook: AE/05-ExtAE-with-MNIST.ipynb + after: AE1 + overrides: + prepared_dataset: default + dataset_seed: default + scale: 1 + latent_dim: 10 + train_prop: 0.8 + batch_size: 128 + epochs: 30 + fit_verbosity: 2 + +# +# ------------ VAE +# +VAE1: + notebook: VAE/01-VAE-with-MNIST.ipynb + overrides: + latent_dim: 2 + loss_weights: default + scale: 1 + seed: default + batch_size: 64 + epochs: 10 + fit_verbosity: 2 + +VAE2: + notebook: VAE/02-VAE-with-MNIST.ipynb + overrides: + latent_dim: 6 + loss_weights: default + scale: 1 + seed: default + batch_size: 64 + epochs: 10 + fit_verbosity: 2 + +VAE3: + notebook: VAE/03-VAE-with-MNIST-post.ipynb + after: VAE2 + overrides: + scale: 1 + seed: default + models_dir: default + +VAE5: + notebook: VAE/05-About-CelebA.ipynb + overrides: + progress_verbosity: 2 + +VAE6.1: + notebook: VAE/06-Prepare-CelebA-datasets.ipynb + overrides: + scale: 0.02 + seed: default + cluster_size: 10000 + image_size: (128,128) + output_dir: ./data + exit_if_exist: False + progress_verbosity: 2 + +VAE6.2: + notebook: VAE/06-Prepare-CelebA-datasets.ipynb + overrides: + scale: 0.02 + seed: default + cluster_size: 10000 + image_size: (192,160) + output_dir: ./data + exit_if_exist: False + progress_verbosity: 2 + +VAE7: + notebook: VAE/07-Check-CelebA.ipynb + after: VAE6.1 + overrides: + image_size: (192,160) + enhanced_dir: ./data + progress_verbosity: 2 + +VAE8: + notebook: VAE/08-VAE-with-CelebA-128x128.ipynb + after: VAE6.1 + overrides: + scale: 1 + image_size: (128,128) + enhanced_dir: '{datasets_dir}/celeba/enhanced' + latent_dim: 300 + loss_weights: default + batch_size: 64 + epochs: 15 + fit_verbosity: 2 + +VAE9: + notebook: VAE/09-VAE-with-CelebA-192x160.ipynb + after: VAE6.2 + overrides: + scale: 1 + image_size: (192,160) + enhanced_dir: '{datasets_dir}/celeba/enhanced' + latent_dim: 300 + loss_weights: default + batch_size: 64 + epochs: 10 + fit_verbosity: 2 + +VAE10.1: + notebook: VAE/10-VAE-with-CelebA-post.ipynb + after: VAE8 + overrides: + image_size: (128,128) + enhanced_dir: '{datasets_dir}/celeba/enhanced' + models_dir: ./run/VAE8 + +VAE10.2: + notebook: VAE/10-VAE-with-CelebA-post.ipynb + after: VAE9 + overrides: + image_size: (192,160) + enhanced_dir: '{datasets_dir}/celeba/enhanced' + models_dir: ./run/VAE9 + +# +# ------------ DCGAN +# +SHEEP1: + notebook: DCGAN/01-DCGAN-Draw-me-a-sheep.ipynb + overrides: + scale: 1 + latent_dim: 128 + epochs: 8 + batch_size: 32 + num_img: 12 + fit_verbosity: 2 + +SHEEP2: + notebook: DCGAN/02-WGANGP-Draw-me-a-sheep.ipynb + overrides: + scale: 1 + latent_dim: 128 + epochs: 4 + batch_size: 64 + num_img: 12 + fit_verbosity: 2 + +# +# ------------ DRL +# +# DRL1: +# notebook: DRL/FIDLE_DQNfromScratch.ipynb + +# DRL2: +# notebook: DRL/FIDLE_rl_baselines_zoo.ipynb + +# +# ------------ Misc +# +ACTF1: + notebook: Misc/Activation-Functions.ipynb + +NP1: + notebook: Misc/Numpy.ipynb + +SCRATCH1: + notebook: Misc/Scratchbook.ipynb + +TSB1: + notebook: Misc/Using-Tensorboard.ipynb