tanh(hyperbolic tangent)

  • activation 중 하나로 대표적으로 많이 사용됨.
  • range:
  • anti-symmetric
  • zero-centered

Problems

  • Saturation “kills” gradient : 입력 값의 절댓값이 커질수록 기울기 소실
    • 특히나 layer가 깊어질수록, chain-rule에 의해 곱해지는 term들이 많아질텐데, 그러면 앞 쪽에 있는 layer 들일수록 learning되지 않을 수 있지.

다음과 같이 구현.

tanh

def tanh(x: float) -> float:
	return (np.exp(x) - np.exp(-x)) / (np.exp(x) + np.exp(-x))