Bound example dependencies to avoid future warnings and issues (#997)

* Remove Kale default docker image tag

The default docker image tag can create a conflict with the notebook
image one uses for testing the example. This results in a warning dialog
that we can prevent from appearing.

Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>

* nlp: Bound requirements.txt

* nlp: Bound the version of the dependencies

Fix the version of the dependencies for the natural language processing
with disaster tweets example.

* nlp: Fix imports

Change any 'import keras.*' import to 'import tensorflow.keras.*' as the
example does not require the standalone keras library.

* nlp: Format inputs

* nlp: Compile the model before training

Move the 'model.compile' command right before 'model.fit' since Kale
needs these commands to run in the same step.

Signed-off-by: Dimitris Poulopoulos <dimpo@arrikto.com>

* house-prices: Bound requirements.txt

Fix the version number of the Python modules in 'requirements.txt'.

Signed-off-by: Dimitris Poulopoulos <dimpo@arrikto.com>

* digit-recognizer: Bound requirements.txt

Fix the version number of the Python modules in 'requirements.txt'.

Signed-off-by: Dimitris Poulopoulos <dimpo@arrikto.com>

Signed-off-by: Stefano Fioravanzo <stefano@arrikto.com>
Signed-off-by: Dimitris Poulopoulos <dimpo@arrikto.com>
Co-authored-by: Stefano Fioravanzo <stefano@arrikto.com>
This commit is contained in:
Dimitris Poulopoulos 2022-10-03 16:39:21 +00:00 committed by GitHub
parent 92989df736
commit f3ebcf0caa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 49 additions and 53 deletions

View File

@ -861,7 +861,7 @@
}, },
"kubeflow_notebook": { "kubeflow_notebook": {
"autosnapshot": true, "autosnapshot": true,
"docker_image": "gcr.io/arrikto/jupyter-kale-py36@sha256:dd3f92ca66b46d247e4b9b6a9d84ffbb368646263c2e3909473c3b851f3fe198", "docker_image": "",
"experiment": { "experiment": {
"id": "new", "id": "new",
"name": "digit-recognizer-kale" "name": "digit-recognizer-kale"

View File

@ -660,7 +660,7 @@
}, },
"kubeflow_notebook": { "kubeflow_notebook": {
"autosnapshot": true, "autosnapshot": true,
"docker_image": "gcr.io/arrikto/jupyter-kale-py36@sha256:dd3f92ca66b46d247e4b9b6a9d84ffbb368646263c2e3909473c3b851f3fe198", "docker_image": "",
"experiment": { "experiment": {
"id": "6f6c9b81-54e3-414b-974a-6fe8b445a59e", "id": "6f6c9b81-54e3-414b-974a-6fe8b445a59e",
"name": "digit_recognize_lightweight" "name": "digit_recognize_lightweight"

View File

@ -1,4 +1,4 @@
pandas pandas==1.1.5
seaborn seaborn==0.9.0
tensorflow==2.3.0 tensorflow==2.3.0
wget wget==3.2

View File

@ -1144,7 +1144,7 @@
}, },
"kubeflow_notebook": { "kubeflow_notebook": {
"autosnapshot": true, "autosnapshot": true,
"docker_image": "gcr.io/arrikto/jupyter-kale-py36@sha256:dd3f92ca66b46d247e4b9b6a9d84ffbb368646263c2e3909473c3b851f3fe198", "docker_image": "",
"experiment": { "experiment": {
"id": "new", "id": "new",
"name": "house-prices" "name": "house-prices"

View File

@ -748,7 +748,7 @@
}, },
"kubeflow_notebook": { "kubeflow_notebook": {
"autosnapshot": true, "autosnapshot": true,
"docker_image": "gcr.io/arrikto/jupyter-kale-py36@sha256:dd3f92ca66b46d247e4b9b6a9d84ffbb368646263c2e3909473c3b851f3fe198", "docker_image": "",
"experiment": { "experiment": {
"id": "", "id": "",
"name": "" "name": ""

View File

@ -1,7 +1,7 @@
numpy numpy==1.18.5
pandas pandas==1.1.5
matplotlib matplotlib==3.3.4
sklearn scikit-learn==0.23.2
seaborn seaborn==0.9.0
category_encoders category_encoders==2.5.0
xgboost xgboost==1.5.1

View File

@ -182,33 +182,37 @@
} }
], ],
"source": [ "source": [
"import pandas as pd\n", "import re\n",
"import matplotlib.pyplot as plt\n",
"import seaborn as sns\n",
"import numpy as np\n",
"import nltk\n", "import nltk\n",
"nltk.download('stopwords')\n", "import gensim\n",
"nltk.download('punkt')\n", "import string\n",
"import numpy as np\n",
"import pandas as pd\n",
"import seaborn as sns\n",
"import matplotlib.pyplot as plt\n",
"\n",
"from tqdm import tqdm\n",
"\n",
"from nltk.tokenize import word_tokenize\n",
"\n",
"from nltk.corpus import stopwords\n", "from nltk.corpus import stopwords\n",
"from nltk.util import ngrams\n", "from nltk.util import ngrams\n",
"from sklearn.model_selection import train_test_split\n",
"from sklearn.feature_extraction.text import CountVectorizer\n", "from sklearn.feature_extraction.text import CountVectorizer\n",
"from collections import defaultdict\n", "from collections import defaultdict\n",
"from collections import Counter\n", "from collections import Counter\n",
"plt.style.use('ggplot')\n", "\n",
"stop=set(stopwords.words('english'))\n", "from tensorflow.keras.preprocessing.text import Tokenizer\n",
"import re\n", "from tensorflow.keras.preprocessing.sequence import pad_sequences\n",
"from nltk.tokenize import word_tokenize\n", "from tensorflow.keras.models import Sequential\n",
"import gensim\n", "from tensorflow.keras.layers import Embedding,LSTM,Dense,SpatialDropout1D\n",
"import string\n", "from tensorflow.keras.initializers import Constant\n",
"from keras.preprocessing.text import Tokenizer\n",
"from keras.preprocessing.sequence import pad_sequences\n",
"from tqdm import tqdm\n",
"from keras.models import Sequential\n",
"from keras.layers import Embedding,LSTM,Dense,SpatialDropout1D\n",
"from keras.initializers import Constant\n",
"from sklearn.model_selection import train_test_split\n",
"from tensorflow.keras.optimizers import Adam\n", "from tensorflow.keras.optimizers import Adam\n",
"\n" "\n",
"nltk.download('stopwords')\n",
"nltk.download('punkt')\n",
"stop=set(stopwords.words('english'))\n",
"plt.style.use('ggplot')"
] ]
}, },
{ {
@ -1491,13 +1495,7 @@
"model.add(embedding)\n", "model.add(embedding)\n",
"model.add(SpatialDropout1D(0.2))\n", "model.add(SpatialDropout1D(0.2))\n",
"model.add(LSTM(64, dropout=0.2, recurrent_dropout=0.2))\n", "model.add(LSTM(64, dropout=0.2, recurrent_dropout=0.2))\n",
"model.add(Dense(1, activation='sigmoid'))\n", "model.add(Dense(1, activation='sigmoid'))"
"\n",
"\n",
"optimzer=Adam(learning_rate=1e-5)\n",
"\n",
"model.compile(loss='binary_crossentropy',optimizer=optimzer,metrics=['accuracy'])\n",
"\n"
] ]
}, },
{ {
@ -1621,6 +1619,7 @@
} }
], ],
"source": [ "source": [
"model.compile(loss='binary_crossentropy', optimizer=Adam(learning_rate=1e-5), metrics=['accuracy'])\n",
"history=model.fit(X_train,y_train,batch_size=4,epochs=5,validation_data=(X_test,y_test),verbose=2)" "history=model.fit(X_train,y_train,batch_size=4,epochs=5,validation_data=(X_test,y_test),verbose=2)"
] ]
}, },
@ -1765,7 +1764,7 @@
}, },
"kubeflow_notebook": { "kubeflow_notebook": {
"autosnapshot": true, "autosnapshot": true,
"docker_image": "gcr.io/arrikto/jupyter-kale-py36@sha256:dd3f92ca66b46d247e4b9b6a9d84ffbb368646263c2e3909473c3b851f3fe198", "docker_image": "",
"experiment": { "experiment": {
"id": "new", "id": "new",
"name": "trial-with-kale" "name": "trial-with-kale"

View File

@ -557,7 +557,7 @@
}, },
"kubeflow_notebook": { "kubeflow_notebook": {
"autosnapshot": true, "autosnapshot": true,
"docker_image": "gcr.io/arrikto/jupyter-kale-py36@sha256:dd3f92ca66b46d247e4b9b6a9d84ffbb368646263c2e3909473c3b851f3fe198", "docker_image": "",
"experiment": { "experiment": {
"id": "", "id": "",
"name": "" "name": ""

View File

@ -1,10 +1,7 @@
seaborn matplotlib==3.3.4
nltk seaborn==0.9.0
sklearn nltk==3.6.7
collection scikit-learn==0.23.2
gensim gensim==4.2.0
keras tensorflow==2.3.0
tensorflow wget==3.2
pyspellchecker
wget
zipfile36