Sequential groups a linear stack of layers into a tf.keras.Model. Keras is an open source deep learning framework for python. It has been developed by an artificial intelligence researcher at Google named Francois Chollet. Leading organizations like Google, Square, Netflix, Huawei and Uber are currently using Keras.
- Keras Tutorial
- Keras Useful Resources
Keras is an open-source software library that provides a Python interface for artificial neural networks. Keras acts as an interface for the TensorFlow library. Up until version 2.3 Keras supported multiple backends, including TensorFlow, Microsoft Cognitive Toolkit, Theano, and PlaidML. As of version 2.4, only TensorFlow is supported.
- Selected Reading
This chapter deals with the model evaluation and model prediction in Keras.
Let us begin by understanding the model evaluation.
Evaluation is a process during development of the model to check whether the model is best fit for the given problem and corresponding data. Keras model provides a function, evaluate which does the evaluation of the model. It has three main arguments,
- Test data
- Test data label
- verbose - true or false
Let us evaluate the model, which we created in the previous chapter using test data.
Executing the above code will output the below information.
The test accuracy is 98.28%. We have created a best model to identify the handwriting digits. On the positive side, we can still scope to improve our model.
Prediction is the final step and our expected outcome of the model generation. Keras provides a method, predict to get the prediction of the trained model. The signature of the predict method is as follows,
Here, all arguments are optional except the first argument, which refers the unknown input data. The shape should be maintained to get the proper prediction.
Let us do prediction for our MPL model created in previous chapter using below code −
Line 1 call the predict function using test data.
Line 2 gets the first five prediction
Line 3 gets the first five labels of the test data.
Line 5 - 6 prints the prediction and actual label.
The output of the above application is as follows −
The output of both array is identical and it indicate that our model predicts correctly the first five images.Latest version
Deep Learning for humans
Keras is a high-level neural networks API for Python.
Read the documentation at: https://keras.io/
Keras is compatible with Python 3.6+and is distributed under the MIT license.
Release historyRelease notifications RSS feed
Keras Python Model
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size Keras-2.4.3-py2.py3-none-any.whl (36.3 kB)||File type Wheel||Python version py2.py3||Upload date||Hashes|
|Filename, size Keras-2.4.3.tar.gz (291.0 kB)||File type Source||Python version None||Upload date||Hashes|
Keras Python Library
Hashes for Keras-2.4.3-py2.py3-none-any.whl
Hashes for Keras-2.4.3.tar.gz
Keras Python 2.7