- Related Questions & Answers
- How can Tensorflow be used with Estimators to evaluate the model using Python?
- How can Tensorflow be used to evaluate a CNN model using Python?
- How can Tensorflow be used to visualize the data using Python?
- How can Tensorflow be used to standardize the data using Python?
- How can Tensorflow be used with Illiad dataset to check how well the test data performs using Python?
- How can Keras be used to evaluate the model using Python?
- How can Tensorflow Hub be used to fine-tune learning models?
- How can Tensorflow be used to train and evaluate the titanic dataset?
- How can Tensorflow be used to fit the data to the model using Python?
- How can Keras be used to evaluate the restored model using Python?
- How can Tensorflow be used to split the Illiad dataset into training and test data in Python?
- How can Tensorflow be used to compile the model using Python?
- How can Tensorflow be used to train the model using Python?
- How can Tensorflow be used to decode the predictions using Python?
- How can Tensorflow be used to check the predicrion using Python?

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Tensorflow is a machine learning framework that is provided by Google. It is an open-source framework used in conjunction with Python to implement algorithms, deep learning applications, and much more. It is used in research and for production purposes.

The ‘tensorflow’ package can be installed on Windows using the below line of code −

pip install tensorflow

Tensor is a data structure used in TensorFlow. It helps connect edges in a flow diagram. This flow diagram is known as the ‘Data flow graph’. Tensors are nothing but a multidimensional array or a list.

We are using Google Colaboratory to run the below code. Google Colab or Colaboratory helps run Python code over the browser and requires zero configuration and free access to GPUs (Graphical Processing Units). Colaboratory has been built on top of Jupyter Notebook.

Following is the code snippet −

print("The model is being evaluated") binary_loss, binary_accuracy = binary_model.evaluate(binary_test_ds) int_loss, int_accuracy = int_model.evaluate(int_test_ds) print("The accuracy of Binary model is: {:2.2%}".format(binary_accuracy)) print("The accuracy of Int model is: {:2.2%}".format(int_accuracy))

Code credit − https://www.tensorflow.org/tutorials/load_data/text

The model is being evaluated 250/250 [==============================] - 3s 12ms/step - loss: 0.5265 - accuracy: 0.8110 250/250 [==============================] - 4s 14ms/step - loss: 0.5394 - accuracy: 0.8014 The accuracy of Binary model is: 81.10% The accuracy of Int model is: 80.14%

The loss and accuracy associated with training for both the ‘binary’ and ‘int’ vectorized model is evaluated.

This data is displayed on the console.

Advertisements