---
type: learning
area: learning
status: learning
date: 2026-05-03
created: 2026-05-03
updated: 1980-01-01
tags:
  - learning
---
Used when we want our neural network to work with sequential data like predicting a stock market for a company X our NN should be based in a unspecified previous data.

For this example we will use rnn to predict tomorow price based on today and yesterday
![[img-20240927-013419-5d728f0a.png]]

![[img-20240927-013728-4cdaa657.png]]
Here we gave the network an input as the value of yesterday but we don't care about the prediction but we care about the feedbac loop that will be used when passing the value of today as our goal is to predict value of tomorrow 
![[img-20240927-014612-83fabaa8.png]]
 ![[img-20240927-014851-08ff3215.png]]
  Example for 3 days
  ![[img-20240927-015152-17d02c98.png]]
RNN have some problems like more we link more networks together more it's hard to train them because of vanishing / Exploding prob

### Note:
Tangh takes any x coordinate and turn it to any value between [-1,1]
and sigmoid turns and X coordinate into a value between [0,1]

![[img-20240927-021514-59be5d16.png]]

### LSTM
- Solution to vanishing / Exploding gradient problem
![[img-20240927-022339-ac8649af.png]]
green line reprsent the long term memory
pink line short term memory

![[img-20240927-021823-05448c87.png]]
Called forget gate

![[img-20240927-023054-1d1096eb.png]]
In this part yellow block decides if there is any potential memory LTM to save
Green block decides how much we will keep from this memory
![[img-20240927-023536-58d54b6a.png]]
In This block we will decides if there is any STM to keep in the pink block and in purple block decides how much to keep from it
This phase called Output Gate
Output is received from short term memory path

**Reference** : https://www.youtube.com/watch?v=YCzL96nL7j0 