Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions examples/nlp/multi_label_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
## Imports
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update Last modified above and add yourself to the authors list?

"""

from tensorflow.keras import layers
from tensorflow import keras
import keras
from keras import layers

import tensorflow as tf

from sklearn.model_selection import train_test_split
Expand Down Expand Up @@ -145,7 +146,7 @@
"""

terms = tf.ragged.constant(train_df["terms"].values)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it work to use padding here instead of ragged tensors?
https://keras.io/api/ops/numpy/#pad-function

lookup = tf.keras.layers.StringLookup(output_mode="multi_hot")
lookup = layers.StringLookup(output_mode="multi_hot")
lookup.adapt(terms)
vocab = lookup.get_vocabulary()

Expand Down