How to install Theano:
pip install theano
Some of the symbols we need are in the tensor subpackage Theano. We often import such packages with a convenient name, say T.
from theano import * import theano.tensor as T
Why Theano Python Library:
Theano — a kind of hybrid between numy and sympy, an attempt is made to combine them into one powerful library. Some of the advantages of theano are as follows:
- Stability optimization: Theano can find some unstable expressions and can use more stable means to evaluate them.
- Execution speed optimization: As mentioned earlier, theano can use the latest GPUs and execute parts of expressions in your CPU or GPU, making it much faster than Python.
- Symbolic differentiation : Theano is smart enough to automatically generate symbolic graphics for calculating gradients
Theano — is a Python library that allows you to efficiently define, optimize, and evaluate mathematical expressions involving multidimensional arrays. Some Theano implementations are as follows.
Subtract two scalars:
It will not give any output since the statement of two numbers is the same as the given number, hence , it converts to the true value.
Adding two scalars:
| tr> |
arr ay (12.0)
Add two matrices:
array ([[90., 120.], [5., 7.]])
Logistic f function using theano:
Let’s try to calculate the logistic curve, which is defined as:
[[0.5 0.73105858 0.26894142 0.11920292]]
Theano — it is a core library mainly used for deep learning research and development and directly for creating deep learning models or in handy libraries like Keras. It supports both convolutional networks and recurrent networks, as well as combinations thereof.