One-hot encoding the labels

To carry out one-hot encoding on the labels, we will use the following code:

# OHE
trainy <- to_categorical(trainy, 50)
validy <- to_categorical(validy, 50)
testy <- to_categorical(testy, 50)

Here, we have used the to_categorical function to one-hot encode the response variable. We used 50 to indicate the presence of 50 classes since the articles have been written by 50 authors that we plan to classify, using articles that have been written by them as input.

Now, the data is ready for developing the convolutional recurrent network model for author classification based on the articles they have written.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset