TensorFlow (TF) Hub is a library that contains parts of ML models that can be reused and used for training models. In the script for “text classification of movie reviews” I used TF Hub to process the text of the movie reviews and split up each review into seperate words based on spaces adn then each word was given a value for more streamlined processing.
In this case, the optimizer function was the binary_crossentropy loss function. This example was a binary classification problem (we were trying to see if the reviews were negative or positive) and this function is useful for binary problems and in dealing with probabilities which is useful here. The optimizer function in this case was ‘adam’. My “text classification of movie reviews” model was pretty good; it had a loss of 0.33 and an accuracy of neary 86% (the actual accuracy was 0.855), though it could stand to be improved.
This graph shows the traning and validation loss of the model that was trying to predict whether movie reviews were positive or negative. The x-axis shows the number of epochs the model has been through and the y-axis shows the loss score of the model, where lower values are more desirable as they indicate the model is getting better at guessing the correct answer more accurately. As the model ran through more epochs the training and validation losses decreased, meaning that the model was learning to more accurately predict the correct type of classification for movie reviews as the amount of epochs increased.
This graph shows the traning and validation accuracy of the model that was trying to predict whether movie reviews were positive or negative. The x-axis shows the number of epochs the model has iterated through and the y-axis shows the accuracy score of the model. As the model ran through more epochs it became more accurate at guessing whether a review was negative or positive as shown by the steadily increasing traning accuracy and validation accuracy (though there was a bit of a hiccup around epoch 4). The model’s traning accuracy is a bit higher than its validation accuracy which may indicate that the model is a bit over-fit.