C3W2_Assignment (fit_label_encoder)

Hello,

I have problems with Exercise 3 where we need to complete the function fit_label_encoder.

Where I run:

train_labels_only = train_dataset.map(lambda text, label: label)
validation_labels_only = validation_dataset.map(lambda text, label: label)

label_encoder = fit_label_encoder(train_labels_only,validation_labels_only)

print(f’Unique labels: {label_encoder.get_vocabulary()}')

The OUTPUT is: Unique labels: [None, ‘sport’, ‘business’, ‘politics’, ‘tech’, ‘entertainment’].

I want to remove ‘None’, even putting “oov_token=None “

Can you help?

Grade function codes removed by moderator as posting any codes that grades your assignment is considered violation of code of conduct. if a mentor wants to look at your code, they will ask you to send them by personal message. So kindly avoid posting any grade function codes in future

Please checkout num_oov_indices parameter.

Yap, I already verified. Solved.

Thanks

Do not post any grade function codes, it is violation of code of.conduct.

1 Like