エントリーの編集
エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
敢えてRubyで学ぶ「ゼロから作るDeep Learning」基本関数群 - Qiita
記事へのコメント0件
- 注目コメント
- 新着コメント
このエントリーにコメントしてみましょう。
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
敢えてRubyで学ぶ「ゼロから作るDeep Learning」基本関数群 - Qiita
require 'numo/narray' def identity_function(x) return x end def step_function(x) grad = Numo::Uin... require 'numo/narray' def identity_function(x) return x end def step_function(x) grad = Numo::Uint32.zeros(x.shape) grad[x>=0] = 1 grad end def sigmoid(x) 1 / (1 + Numo::DFloat::Math.exp(-x)) end def sigmoid_grad(x) (1.0 - sigmoid(x)) * sigmoid(x) end def relu(x) copy = x.copy copy[x < 0] = 0 copy end def relu_grad(x) grad = Numo::DFloat.zeros(x.shape) grad[x>=0] = 1 grad end def softmax(x) if x.n