エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
ここにツイート内容が記載されます https://b.hatena.ne.jp/URLはspanで囲んでください
Twitterで共有ONにすると、次回以降このダイアログを飛ばしてTwitterに遷移します
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
import numpy as np # x1,x2:入力 w1,w2:重み b:バイアス def perceptron(x1,x2,w1,w2,b): x = np.array... import numpy as np # x1,x2:入力 w1,w2:重み b:バイアス def perceptron(x1,x2,w1,w2,b): x = np.array([x1, x2]) w = np.array([w1, w2]) tmp = np.sum(w*x) + b return 0 if tmp <= 0 else 1 def AND(x1,x2): return perceptron(x1,x2,0.5,0.5,-0.7) def NAND(x1,x2): return perceptron(x1,x2,-0.5,-0.5,0.7) def OR(x1,x2): return perceptron(x1,x2,0.5,0.5,0.0) def XOR(x1,x2): # 多層パーセプトロン s1 = NAND(x1,x2) s2 = OR(x1,x2) y = A