0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

深層学習/ソフトマックス関数

Posted at

#1.はじめに
 今回は、ソフトマックス関数について簡単にまとめます。

#2.ソフトマックス関数とは?
 ニューラルネットワークの出力をトータル1の確率に変換します。
スクリーンショット 2020-03-28 16.31.12.png

#3.具体的な計算
 出力$y_1$〜$y_3$が以下の様な場合、

スクリーンショット 2020-03-28 16.32.54.png
 ソフトマックス関数を通した結果は、
スクリーンショット 2020-03-28 16.25.28.png

#4.コード

import numpy as np

def softmax(z):
    y = np.exp(z) / np.sum(np.exp(z))
    return y

z = np.array([1.2,  0.8,  0.3])
answer = softmax(z)
print(answer)

# 出力
# [0.48148922  0.32275187  0.19575891]

 

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?