Question: 3 . 3 Padding the labels In this section, you will pad the labels. TextVectorization already padded the sentences, so you must ensure that the

3.3 Padding the labels
In this section, you will pad the labels. TextVectorization already padded the sentences, so you must ensure that the labels are properly padded as well. This is
not a hard task for two main reasons:
Tensorflow has built-in functions for padding
Padding will be performed uniformly per dataset (train, validation and test) using the maximum sentence length in each dataset and the size of each
sentence is exactly the same as the size of their respective labels.
You will pad the vectorized labels with the value -1. You will not use 0 to simplify loss masking and evaluation in further steps. This is because to properly
classify one token, a log softmax transformation will be performed and the index with greater value will be the index label. Since index starts at 0, it is better to
keep the label 0 as a valid index, even though it is possible to also use 0 as a mask value for labels, but it would require some tweaks in the model architecture
or in the loss computation.
. An array with the labels.
padding : The position where padding will take place, the standard is pre, meaning the sequences will be padded at the beginning. You need to pass
the argument post .
value: Padding value. The default value is 0.
 3.3 Padding the labels In this section, you will pad the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!