Skip to content

Commit

Permalink
Updated Large-scale multi-label text classification example for Keras v3
Browse files Browse the repository at this point in the history
  • Loading branch information
lpizzinidev committed Mar 5, 2024
1 parent a3f7572 commit 2d76b3c
Showing 1 changed file with 4 additions and 3 deletions.
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
"""

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)
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

0 comments on commit 2d76b3c

Please sign in to comment.