EZI 기술 블로그 JU

LSTM Autoencoder에서 loss가 exploding 본문

Modeling/loss function

LSTM Autoencoder에서 loss가 exploding

eziju 2023. 3. 16. 10:38

1) 활성화 함수가 relu계열일 때 다른 활성화 함수로 변경

 

 

2) clipnorm / clipvalue 사용해보기

One way to fix the exploding gradient is to use clipnorm or clipvalue for the optimizer

Try something like this for the last two lines

 

For clipnorm:

opt = tf.keras.optimizers.Adam(clipnorm=1.0)

For clipvalue:

opt = tf.keras.optimizers.Adam(clipvalue=0.5)

> Gradient clipping을 하는 이유 : gradient가 일정 threshold를 넘어가면 clipping을 적용하여 exploding 방지

 

 

https://stackoverflow.com/questions/60776782/explosion-in-loss-function-lstm-autoencoder

 

Explosion in loss function, LSTM autoencoder

I am training a LSTM autoencoder, but the loss function randomly shoots up as in the picture below: I tried multiple to things to prevent this, adjusting the batch size, adjusting the number of ne...

stackoverflow.com

 

https://sanghyu.tistory.com/87

 

[PyTorch] Gradient clipping (그래디언트 클리핑)

Gradient clipping을 하는 이유 주로 RNN계열에서 gradient vanishing이나 gradient exploding이 많이 발생하는데, gradient exploding을 방지하여 학습의 안정화를 도모하기 위해 사용하는 방법이다. Gradient clipping과 L

sanghyu.tistory.com

 

반응형

'Modeling > loss function' 카테고리의 다른 글

Custom loss function  (0) 2023.03.15