What is TF Hub? How did you use it when creating your script for “text classification of movie reviews”?


What is TF Hub? How did you use it when creating your script for “text classification of movie reviews”?

TFhub is a transfer learning platform. This means that it holds modules with pieces of machine learning models that can be reused and applied to different problems. It’s good for generalizations and speeding up training.

What are the optimizer and loss functions? How good was your “text classification of movie reviews” model?

The loss function is a way to mathematically score how accurate the model is. Not by correct classifications, but by how close it is to the correct answer. The optimizer uses the loss function to try to minimize the models error. It attempts to minimize the loss functions output.

When I ran the model it got to 85% accuracy, with a loss of 0.352.

I couldn’t load the data into pycharm, so here’s an alternate dataset and its interpretation

Test Loss 0.45306462049484253, Test Accuracy 0.8484848737716675

Predicted survival: 4.28% Actual outcome: DIED
Predicted survival: 49.48% Actual outcome: DIED
Predicted survival: 10.12% Actual outcome: DIED
Predicted survival: 13.82% Actual outcome: DIED
Predicted survival: 99.80% Actual outcome: SURVIVED

The model was a neural network. It used 3 layers to predict survival. 2 dense layers with 128 neurons and one dense layer with 1 neuron for output, as it is predicting a binary result. Survival or death. The model used binary cross entropy for a loss function. It scores binary categorizations models and is capable of scoring multiple outputs at time. In this case it only scored the survival boolean. This model used a mix of categorical data: sex, class, deck, town embarked from and whether or not a passenger was alone. It also used continuous data such as: age, number of siblings, parch and fare. The continuous data was all standardized before the model trained on it.