PyBrainã®ãã¹ã
ã¡ãã£ã¨ãã¥ã¼ã©ã«ãããã¯ã¼ã¯ã§è©¦ããããã¨ãããã®ã§ï¼æåã®æ®µéã¨ãã¦ï¼PyBrainãç¨ãã¦ãã¥ã¼ã©ã«ãããã¯ã¼ã¯ã¨ãããã®ã使ç¨ãã¦ã¿ãï¼
é層åãã¥ã¼ã©ã«ãããã¯ã¼ã¯ã®ä¾é¡ã¨ãã¦XORæ¼ç®ãå¦ç¿ãããï¼
以ä¸ï¼ã³ã¼ã
from pybrain.datasets import SupervisedDataSet from pybrain.tools.shortcuts import buildNetwork from pybrain.supervised.trainers import BackpropTrainer # Set teaching signals target = SupervisedDataSet(2, 1) target.addSample([0, 0], [0]) target.addSample([0, 1], [1]) target.addSample([1, 0], [1]) target.addSample([1, 1], [0]) network = buildNetwork(2, 2, 1) trainer = BackpropTrainer(network, target) # Training for n in range(100000): error = trainer.train() print "%d %f" % (n, error) if error < 0.0001: break print "f(0, 0) = %f" % network.activate([0, 0]) print "f(0, 1) = %f" % network.activate([0, 1]) print "f(1, 0) = %f" % network.activate([1, 0]) print "f(1, 1) = %f" % network.activate([1, 1])
PyBrainã¯ã³ã¼ããç°¡åãªã®ã¯ããã§ããï¼
ä½åã試ãã¦è¦ããï¼éã¿é¢æ°ã®åææ¡ä»¶ãã£ã¦ã¯åæããªããã¨ãçµæ§ããããã ï¼æ¨ªè»¸ãå¦ç¿åæ°ã§ï¼ç¸¦è»¸ãã¨ã©ã¼ã§ããï¼
æåï¼æ¥ã«èª¤å·®ãæ¸ã£ã¦ãã¦ï¼æ¸ãæ¹ãç·©ããã«ãªã£ã¦ï¼åã³æ¥ã«ãªãã¨ããæ°æã¡æªãå¦ç¿ã®ä»æ¹ããã¦ããï¼
ã¨ã©ã¼ã0.0001ã®å ´åã®åºåå¤ã¯ä»¥ä¸ï¼
f(0, 0) = 0.020374 f(0, 1) = 0.987520 f(1, 0) = 0.987359 f(1, 1) = 0.007329
æã£ããã誤差ã大ããï¼
åæããªãã£ãå ´åã®åºåå¤ã¯
99999 0.064225 f(0, 0) = 0.002815 f(0, 1) = 0.499337 f(1, 0) = 0.996132 f(1, 1) = 0.502938
ã¨
99999 0.064870 f(0, 0) = 0.004271 f(0, 1) = 0.998503 f(1, 0) = 0.500618 f(1, 1) = 0.504393
ã©ã¡ããã¨ã©ã¼ã0.064ãããã§ï¼åºåã®ãã¡ï¼ã¤ã0.5ã¨ãªã£ã¦ããï¼ãªãã対称çãªç¹ã§ããããåã£ã¦ããï¼
ï¼è¿½è¨ãå¤åï¼ææ¥å¾é
æ³ã§è§£ãã¦ãããæ®éã«å¥ã®æ¥µå°ç¹æ¥µå¤ç¹ã«ããã£ãã ããï¼ï¼
å·®åæ³ã§æµä½ã®æ¹ç¨å¼ã¨è§£ãæã®ãã§ãã«ã¼ãã¼ãä¸å®å®æ§ã¨ãï¼æéè¦ç´ æ³ã§æ§é 解æããã¨ãã®ï¼ååå¿ãããã©ï¼æåã®å¤å½¢ã¢ã¼ããè¦ç´ ãã¨ã«äº¤äºã«èµ·ãã£ã¦ï¼ã¨ãã«ã®ã¼ãå¸åãããç¾è±¡ãé£æ³ããï¼
PyBrainãå¤ãã ããªã®ãï¼ã¾ã å®å®ãªè§£æ³ãè¦ã¤ãã£ã¦ããªãã ããªã®ãï¼
大è¦æ¨¡ã«ãªãã¨å¤§å¤ããã ãªï¼
追è¨ï¼ 2014-12-30
pybrainã®buildNetworkã§ä½ãããåºå層ãããã©ã«ãã ã¨LinearLayerã«ãªã£ã¦ããï¼ LinearLayerã¯æ´»æ§åé¢æ°ãf(x)=xã§ããï¼ã¤ã¾ãéã¿ã足ãåãããã ãã§ä½ãããªãï¼ ã¤ã¾ãå¤å±¤ãã¼ã»ãããã³ã§ãªãï¼ ãªãã§ããã§XORãå¦ç¿ã§ããã®ã ï¼ä»åº¦èããï¼
åè
Pybrainでsin関数を学習させるサンプル | anopara
ãã¿ã¼ã³èªèã¨æ©æ¢°å¦ç¿ ä¸
- ä½è : C.M.ãã·ã§ãã,å ç°æµ©,æ ç°å¤å夫,æ¨å£ç¥ä¹,æ¾æ¬è£æ²»,æç°æ
- åºç社/ã¡ã¼ã«ã¼: 丸ååºç
- çºå£²æ¥: 2012/04/05
- ã¡ãã£ã¢: åè¡æ¬ï¼ã½ããã«ãã¼ï¼
- è³¼å ¥: 6人 ã¯ãªãã¯: 33å
- ãã®ååãå«ãããã° (16件) ãè¦ã
C++ã¨Javaã§ã¤ãããã¥ã¼ã©ã«ãããã¯ã¼ã¯
- ä½è : å¹³é廣ç¾
- åºç社/ã¡ã¼ã«ã¼: ãã¼ã½ãã«ã¡ãã£ã¢
- çºå£²æ¥: 2008/06/10
- ã¡ãã£ã¢: åè¡æ¬
- ã¯ãªãã¯: 17å
- ãã®ååãå«ãããã° (4件) ãè¦ã