Skip to content

Commit

Permalink
Fixed the broken link in multi_label_classification.py (#1870)
Browse files Browse the repository at this point in the history
* Fixed the broken link in multi_label_classification.py

* Fixed the broken link in multi_label_classification
  • Loading branch information
tilakrayal authored Aug 21, 2024
1 parent 1922870 commit 49737fc
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 34 deletions.
59 changes: 27 additions & 32 deletions examples/nlp/ipynb/multi_label_classification.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand Down Expand Up @@ -81,7 +81,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand All @@ -106,7 +106,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand All @@ -127,7 +127,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand All @@ -148,7 +148,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand Down Expand Up @@ -178,7 +178,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand All @@ -203,7 +203,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand Down Expand Up @@ -235,7 +235,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand Down Expand Up @@ -275,7 +275,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand All @@ -294,8 +294,7 @@
"\n",
"\n",
"print(\"Vocabulary:\\n\")\n",
"print(vocab)\n",
""
"print(vocab)\n"
]
},
{
Expand All @@ -311,7 +310,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand All @@ -338,7 +337,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand All @@ -362,7 +361,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand All @@ -381,8 +380,7 @@
" (dataframe[\"summaries\"].values, label_binarized)\n",
" )\n",
" dataset = dataset.shuffle(batch_size * 10) if is_train else dataset\n",
" return dataset.batch(batch_size)\n",
""
" return dataset.batch(batch_size)\n"
]
},
{
Expand All @@ -396,7 +394,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand All @@ -418,7 +416,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand Down Expand Up @@ -452,7 +450,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand All @@ -462,8 +460,7 @@
"vocabulary = set()\n",
"train_df[\"summaries\"].str.lower().str.split().apply(vocabulary.update)\n",
"vocabulary_size = len(vocabulary)\n",
"print(vocabulary_size)\n",
""
"print(vocabulary_size)\n"
]
},
{
Expand All @@ -478,7 +475,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand All @@ -501,8 +498,7 @@
").prefetch(auto)\n",
"test_dataset = test_dataset.map(\n",
" lambda text, label: (text_vectorizer(text), label), num_parallel_calls=auto\n",
").prefetch(auto)\n",
""
").prefetch(auto)\n"
]
},
{
Expand Down Expand Up @@ -539,7 +535,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand All @@ -554,8 +550,7 @@
" layers.Dense(lookup.vocabulary_size(), activation=\"sigmoid\"),\n",
" ] # More on why \"sigmoid\" has been used here in a moment.\n",
" )\n",
" return shallow_mlp_model\n",
""
" return shallow_mlp_model\n"
]
},
{
Expand Down Expand Up @@ -587,7 +582,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand Down Expand Up @@ -640,7 +635,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand Down Expand Up @@ -668,7 +663,7 @@
"## Inference\n",
"\n",
"An important feature of the\n",
"[preprocessing layers provided by Keras](https://keras.io/guides/preprocessing_layers/)\n",
"[preprocessing layers provided by Keras](https://keras.io/api/layers/preprocessing_layers/)\n",
"is that they can be included inside a `tf.keras.Model`. We will export an inference model\n",
"by including the `text_vectorization` layer on top of `shallow_mlp_model`. This will\n",
"allow our inference model to directly operate on raw strings.\n",
Expand All @@ -681,7 +676,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand Down Expand Up @@ -770,4 +765,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}
2 changes: 1 addition & 1 deletion examples/nlp/md/multi_label_classification.md
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ The trained model gives us an evaluation accuracy of ~99%.
## Inference

An important feature of the
[preprocessing layers provided by Keras](https://keras.io/guides/preprocessing_layers/)
[preprocessing layers provided by Keras](https://keras.io/api/layers/preprocessing_layers/)
is that they can be included inside a `tf.keras.Model`. We will export an inference model
by including the `text_vectorization` layer on top of `shallow_mlp_model`. This will
allow our inference model to directly operate on raw strings.
Expand Down
2 changes: 1 addition & 1 deletion examples/nlp/multi_label_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def plot_result(item):
## Inference
An important feature of the
[preprocessing layers provided by Keras](https://keras.io/guides/preprocessing_layers/)
[preprocessing layers provided by Keras](https://keras.io/api/layers/preprocessing_layers/)
is that they can be included inside a `tf.keras.Model`. We will export an inference model
by including the `text_vectorization` layer on top of `shallow_mlp_model`. This will
allow our inference model to directly operate on raw strings.
Expand Down

0 comments on commit 49737fc

Please sign in to comment.