> For the complete documentation index, see [llms.txt](https://smartpredict.gitbook.io/smartpredict-ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://smartpredict.gitbook.io/smartpredict-ai/module-reference/core-modules/13.-tensorflow-api/lstm-layer.md).

# LSTM Layer

This module belongs to the category " LSTM Layer" .

## Description

**LSTM** layers or **Long Short Term Memory** , are similar to RNN , except that they can be used to keep track of relevant far past sequence. It is <br>

## Parameters

The LSTM is mainly based on the [TensorFlow - Keras API.](https://www.tensorflow.org/api_docs/python/tf/keras)  To set the type to use, we can select between: **automatic, sequential** and **functional.**

![We can choose between : Automatic, Sequential and Functional API.](https://1833277725-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lyc1OXsKqB2S62LxsOR%2F-M1VO6XDVhKDWalJ_qu4%2F-M1VOGpNBQzCYlRh9T8y%2Fimage.png?alt=media\&token=c95a06d0-ccfb-4f61-b25e-5427481deffd)

### Activation function

We may choose one from the several types of activation function included in the LSTM module's  parameters:&#x20;

* **Softmax Exponential Linear Unit (ELU)**&#x20;
* **Scaled Exponential Linear Unit (SELU)**&#x20;
* **Softplus**&#x20;
* **Softsign**&#x20;
* **Rectified Linear Unit (RELU)**&#x20;
* **Hyperbolic tangent**&#x20;
* **Sigmoid**&#x20;
* **Hard Sigmoid**&#x20;
* **Exponential (base e)**
* &#x20;**Identity function (Linear)**

### Dropout function

![The Dropout function is well-known for mitigating overfitting. ](https://1833277725-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lyc1OXsKqB2S62LxsOR%2F-M1VJ6ztWmI6VgoYhqxW%2F-M1VKWKbHl0IvxVsG-iL%2Fimage.png?alt=media\&token=dd0db468-29cc-4148-b763-1bab750c84ce)

{% hint style="warning" %}
The **dropout function** should be used carefully. As [this article ](https://www.kdnuggets.com/2018/09/dropout-convolutional-networks.html)states , it should only be reserved for certain circumstances : "Generally, we only need to implement regularization when our network is at risk of over fitting. This can happen if a network is too big, if you train for too long, or if you don’t have enough data."

The [TensorFlow documentation ](https://www.tensorflow.org/tutorials/keras/overfit_and_underfit#strategies_to_prevent_overfitting)describes other strategies to use for preventing under or over fitting.
{% endhint %}
