ãAIã®èããããšã¯ããããããšããèšèãããããããã©ããç¥ããªããä»ãæãã€ããã
åã åããã®ïŒããšååããã®ïŒãã§ã°ã©ããæç»ããåŸã«ãã³ãããéã¿ W1ãW2 ãš ãã€ã¢ã¹ b1ãb2 ã®å€ããExcel ã·ãŒãã«ãŸãšããŠã¿ããExcel ã®è¡šã¯ããŒã ããŒãžãã«ããŒã«è²Œãã€ãããš html ã«èªåå€æããŠãããã®ã§ãããŒã ããŒãžãã«ããŒçµç±ã§ããã°ã«ã貌ãä»ããŠã¿ãã
ãŸãã¯ããã®ïŒãããªãã¡åæå€éã¿0.1ã®å Žåãäžžããªããšäžžã7ïœ3æ¡ã®ããŒã¿ãæ¡ã£ãããã¹ããŒã¹ã®éœåã§ä»åã®èšäºã«ã¯äžžã5æ¡ãŸã§ãèŒããã
 | äžžããªã | 7æ¡ | 6æ¡ | 5æ¡ |
W1[0][0] | 4.00632453 | 3.44539626 | -1.86501773 | 3.84608801 |
W1[0][1] | 0.74621904 | 0.73045915 | -4.61775425 | 0.18855283 |
W1[0][2] | -4.45154713 | -4.26451676 | 3.55631742 | -4.60571661 |
W1[1][0] | -4.41780543 | -4.25213382 | -1.88107736 | -4.37482109 |
W1[1][1] | 0.3158155 | 0.51924299 | -4.61879971 | 0.4782215 |
W1[1][2] | 4.06376368 | 3.47807515 | 3.55773063 | 3.94866908 |
b1[0] | 2.88515978 | 3.72557846 | -1.10349328 | 2.90711841 |
b1[1] | 3.49637772 | 4.69945879 | 1.53527639 | 3.87535165 |
b1[2] | 2.9176136 | 3.73723392 | -5.55997762 | 3.17658877 |
W2[0][0] | 7.52188442 | 11.62101214 | 1.26900181 | 7.4825227 |
W2[0][1] | -7.51900942 | -11.61813714 | -1.26612681 | -7.4796527 |
W2[1][0] | 5.85674287 | 11.18154668 | 4.25877394 | 6.49566576 |
W2[1][1] | -5.84908476 | -11.17388848 | -4.25111594 | -6.48800576 |
W2[2][0] | 7.60501813 | 11.66302433 | 4.42342661 | 7.59086115 |
W2[2][1] | -7.57634126 | -11.63434753 | -4.39474961 | -7.56218115 |
b2[0] | -17.24374337 | -30.40488191 | -2.23040188 | -17.8918042 |
b2[1] | 17.24374337 | 30.40488191 | 2.23040188 | 17.8918042 |
Â
次ã«ããã®ïŒãããªãã¡åæå€éã¿50ã®å Žåãããã¯ããšããšããŒã¿ãéåŒããŠèŒãããã ã£ãã
 | äžžããªã | 6æ¡ | 4æ¡ | 2æ¡ |
W1[0][0] | 3.10715279 | 3.10715289 | 3.10710145 | 3.09749693 |
W1[0][1] | -6.92996836 | -6.92996828 | -6.92997272 | -6.92642448 |
W1[0][2] | -8.0399468 | -8.03994567 | -8.04005328 | -8.03894874 |
W1[1][0] | -3.65469687 | -3.65469717 | -3.6547279 | -3.65772763 |
W1[1][1] | -2.36826359 | -2.36826367 | -2.36824909 | -2.36530438 |
W1[1][2] | 7.24733878 | 7.24733962 | 7.2472656 | 7.2475458 |
b1[0] | -2.79170761 | -2.79170755 | -2.79167077 | -2.78123196 |
b1[1] | 1.27328557 | 1.27328572 | 1.27327315 | 1.27206239 |
b1[2] | -4.31921463 | -4.3192158 | -4.31912361 | -4.32347713 |
W2[0][0] | -6.51184203 | -6.51184149 | -6.51186187 | -6.50319204 |
W2[0][1] | 7.94933953 | 7.94933949 | 7.94936187 | 7.94319204 |
W2[1][0] | 6.5981932 | 6.59819307 | 6.59822748 | 6.60072934 |
W2[1][1] | -2.7691377 | -2.76913807 | -2.76912748 | -2.77072934 |
W2[2][0] | 1.59700312 | 1.59700329 | 1.59701523 | 1.59685762 |
W2[2][1] | 12.74142788 | 12.74142871 | 12.74138477 | 12.74314238 |
b2[0] | 1.84055305 | 1.8405531 | 1.84053306 | 1.83860683 |
b2[1] | -1.84055305 | -1.8405531 | -1.84053306 | -1.83860683 |
  ããã®ïŒãã®çµè«éšåã§è¿°ã¹ãéãããŸãã¯ããã®ïŒãã®ã»ãã¯åæå€ãäžžããæ¡æ°ã®ç¯å²ãŸã§ W1ãW2ãb1ãb2 ã®çµæããããªãäžèŽããŠããããšã確èªãããã£ããããã®ïŒãã§ã¯ããã®ãããªçŸè±¡ã¯ãã£ããèŠãããªãã
ãŒãããäœãDeep Learning âPythonã§åŠã¶ãã£ãŒãã©ãŒãã³ã°ã®çè«ãšå®è£
- äœè :æè€ åº·æ¯
- çºå£²æ¥: 2016/09/24
- ã¡ãã£ã¢: åè¡æ¬ïŒãœããã«ããŒïŒ
ãã£ãã Excel ã«è²Œãä»ããã®ã§ãããå°ãããã£ãŠã¿ãã
Excel ã§ã¯ã¯ãªãã¯ã§ç°¡åã«è¡šç€ºæ¡æ°ãå€æŽã§ãããããã®ïŒãã®è¡šã®å°æ°ç¹ä»¥äžã1æ¡è¡šç€ºã«ããŠã¿ããÂ
 | äžžããªã | 7æ¡ | 6æ¡ | 5æ¡ |
W1[0][0] | 4.0 | 3.4 | -1.9 | 3.8 |
W1[0][1] | 0.7 | 0.7 | -4.6 | 0.2 |
W1[0][2] | -4.5 | -4.3 | 3.6 | -4.6 |
W1[1][0] | -4.4 | -4.3 | -1.9 | -4.4 |
W1[1][1] | 0.3 | 0.5 | -4.6 | 0.5 |
W1[1][2] | 4.1 | 3.5 | 3.6 | 3.9 |
b1[0] | 2.9 | 3.7 | -1.1 | 2.9 |
b1[1] | 3.5 | 4.7 | 1.5 | 3.9 |
b1[2] | 2.9 | 3.7 | -5.6 | 3.2 |
W2[0][0] | 7.5 | 11.6 | 1.3 | 7.5 |
W2[0][1] | -7.5 | -11.6 | -1.3 | -7.5 |
W2[1][0] | 5.9 | 11.2 | 4.3 | 6.5 |
W2[1][1] | -5.8 | -11.2 | -4.3 | -6.5 |
W2[2][0] | 7.6 | 11.7 | 4.4 | 7.6 |
W2[2][1] | -7.6 | -11.6 | -4.4 | -7.6 |
b2[0] | -17.2 | -30.4 | -2.2 | -17.9 |
b2[1] | 17.2 | 30.4 | 2.2 | 17.9 |
Â
ããã«ä¹ ãã¶ãã« Microsoft Mathematics ã䜿ã£ãŠæ€ç®ããŠã¿ãããªã£ãã
Python ã§ãã§ããã GUI ã®èŠèŠçãªå¿«é©ãã¯ãã¯ãé åãªã®ã ã
æ£çŽã«èšããšãæåã¯æèšç®ã§æ€ç®ããããšãããèšç®ééããå€çºããŠåæŸãã€ããªããªã£ããããã«ã€ã«é Œãããšã«ããã®ã ããç§ã¯åŠçæ代ãããã£ãšãããªèª¿åã ã
Â
ããããšããŠããããšã¯ãäžæ²åè¡šã®æ°å€ããæä»çè«çå EOR ãå®çŸããŠããããšã®ç¢ºèªã§ããã
ãŸãã¯ããã®ïŒãçµæã®å°æ°ç¹ä»¥äž1æ¡è¡šç€ºã®è¡šãããäžžããªããããŒã¿ã䜿ã£ãŠãå ¥å x ãš1å±€éã¿ W1 ã®ç©ãèšç®ããããšãããäžæ²ã¹ã¯ãªãŒã³ã·ã§ããã®èšç®çµæãŠã€ã³ããŠã«è¡šç€ºãããŠãããã®ãšåãã§ããã
æ°åŒã§æžããšãxW1ãã§ãããMicosoft Matimatics ã®ã¹ã¯ã·ã§ãæ°åŒã ãã©ã
Â
äžæ²ã¹ã¯ã·ã§ã®çµæã«ãã€ã¢ã¹ b1 ãå ç®ãããšããã
æ°åŒã§æžããšãxW1+b1ãã§ããã
Python ã§ã¯ãããŒããã£ã¹ãæŒç®ïŒæè€åº·æ¯ ããŒãããäœãDeep Learning ã(O'LEILLY) P14 åç §ïŒãè¡ãã Microsoft Mathematics ã«ã¯ãããŒããã£ã¹ãæ©èœã¯ãªãã®ã§ãb1 ã¯1è¡ç®ã®å€ã2ïœ4è¡ç®ã«ã³ããããŠããã
Â
2å±€ãã¥ãŒã©ã«ãããã¯ãŒã¯ã·ã¹ãã ã§ã¯æŽ»æ§åé¢æ°ãšããŠ1å±€ç®ãš2å±€ç®ã®éã«ã·ã°ã¢ã€ãé¢æ°ïŒããŒãããäœãDeep Learning ãP45ïŒãåãŸããããããã¯ãã£ããè¡åèŠçŽ ãæ£ãªã 1ãè² ãªã 0 ã§è¿äŒŒããã
ãã®äžã§ãW2 ãšã®è¡åç©ãèšç®ãããÂ
äžæ²ã¹ã¯ã·ã§å ¥åæ¬ã®1é ç®ã¯ãxW1 + b1ãã®ã·ã°ã¢ã€ãé¢æ°åºåãåè¿°ã®æ¹æ³ã§è¿äŒŒãããã®ã§ãããããZ1ããšåŒç§°ããããããŸã§èŒãã Python ã³ãŒãã§ããåãå€æ°åã䜿çšããŠããã
Z1 ãçºããã ãã§ããäœãããããšããŠãããèŠåœã€ãã1åç®ãš3åç®ã® AND ããšãã°ç®çã®æä»çè«çåãåŸãããã¯ãã§ããã
ãããããš2åç®ã¯äœåã®ã¯ãã ããW1ãb1 ã®åæ°ã2ã«ãããšçµæãå®å®çã«åŸãããªãã£ãããšã¯ããã®ïŒãã§è¿°ã¹ãéãã3å以äžãå¿ èŠã ã£ãã®ã ïŒå®éã«è©Šããã®ã¯åŒããã°ã«æžãã3ã4å以äžã¯5åã ãã ãã5åã§ãçµæãåŸãããïŒã
ãèªç±åºŠã足ããªãããšãããã€ã ãããïŒ ãèªç±åºŠããšããçšèªãå®çŸ©ããããšã¯ä»ã®ç§ã«ã¯äžå¯èœã§ãæèŠçã«èšã£ãŠããã ããªã®ã ãã
Â
話ãé·ããªã£ããã²ãšã€äžã®ã¹ã¯ã·ã§ã§ãã£ãŠããããšãæ°åŒã§æžããšãZ1W2ãã§ããã
次ã®ã¹ã¯ã·ã§ã§ã¯ãZ1W2+b2ãã®æŒç®ãè¡ã£ãŠãããåºåã®çŽåã§ãããb2 㯠Python ã§ã¯ãããŒããã£ã¹ãã ãã1è¡ç®ãåè¡ã«ã³ããããŠããã®ã¯ b1 ã®ãšããšåãã
æçµåºåã¯ãœããããã¯ã¹é¢æ°ïŒããŒãããäœãDeep LearningãP66ïŒãåãŸããŠãããã1åç®ã EOR ã®åŠå®ãã2åç®ã EOR ãæ§æããŠããã®ã¯äžç®çç¶ã ã
è¿œèšïŒ
ãªãã§1è¡ç®ãEORã®åŠå®ã2è¡ç®ãEORã«ããããšãããšãã¿ãæ¬ããŒãããäœãDeep Learningããåºåã«ããäžæ®µ numpy ã® argmax() é¢æ°ãšããã®ãåãŸããŠããã®ãèžè¥²ããããïŒP80ïŒãã¡ãããšæå³ãããã®ã ãããã£ããå¿ããŠããŠèªåã§ã軜ãæ··ä¹±ããã
è¿œèšãããÂ
以äžã®çµæã¯ãããã§ãæ¯èŒçããããããéšé¡ã§ã¯ãªãããšæã£ãŠããã éã«èšããšãåŸã§ããã®ããããªãçµæãåºãŠãããÂ
ã«ãªã¹ãšãã©ã¯ã¿ã«âéç·åœ¢ã®äžæè° (ãã«ãŒããã¯ã¹)
- äœè :å±±å£ æå
- ã¡ãã£ã¢: æ°æž
ããã®ïŒãã«ã°ã©ããå¥åŠãªåããèŠãããšæžãã6æ¡äžžãïŒdecimals=6ïŒã®ã±ãŒã¹ã
ãã¯ã Excel ã§å°æ°ç¹ä»¥äž1æ¡è¡šç€ºãããå€ã䜿çšããŠããã
xW1 ã®èšç®çµæã
Â
xW1 + b1ã
Â
ä»åãã·ã°ã¢ã€ãé¢æ°ã®ãããã£ã±ãªè¿äŒŒãšããŠåèŠçŽ ãæ£ãªã 1ãè² ãªã 0 ãšçœ®ãæã㊠Z1 ãšããããã㊠W2 ãšã®ç©ããšã£ããÂ
äžžããªãïŒèšç®ã¯ç€ºããªãã£ãã7æ¡äžžãã5æ¡äžžããããïŒã§ã¯2åç®ãäœå°æ¬¡å ã ã£ãããä»åã®6æ¡äžžãã®å Žåãäœå°æ¬¡å ã1åç®ã«å€åããŠããããšãç®ãåŒããäœå°æ¬¡å ãšããèšèãå®çŸ©ãªãã§èªæã ãã§äœ¿ã£ãŠããŸããäœå°æ¬¡å ã«ã¡ãã£ãšã¯ã¿åºãããšãã§ãããšåæãããããªããã¿ãããªãçè«ç©çåŠã«ãããªåŠèª¬ããã®ããªïŒ å šãã®æãã€ãã§èšã£ãŠãŸãã
äžžããªãã®äœå°æ¬¡å ã¯1ã§åãŸã£ãŠããããä»åã¯0ã§åãŸã£ãŠããã
Â
念ã®ãã + b2 ã®èšç®çµæãã
Â
Â
ç§èªèº«ãããŸãããã£ãŠããªããããå æžãªå®çŸ©ã®çšèªãããäžã€æã¡åºããããã«ãªã¹çè«ã«ãã¢ãã©ã¯ã¿ãŒããšããæŠå¿µãããããåŒã£åŒµããã®ããšããæå³ã§ãææã®ãŸãããææãåœæãå°ææãåšåããã€ã¡ãŒãžãæãŠã°ããã®ã§ã¯ãªãã ããããã¢ãã©ã¯ã¿ãŒã®åšå²ã§èŠåæ£ããåšåéåããã倩äœãããã°ãå€å žçãªã«ãªã¹ãšããŠæåãªãäžäœåé¡ãã®çè«ã«åºã¥ã極ããŠäžèŠåãªåãããã倩äœãããã
æä»çè«çåãæ§æããåå€æ°ãå€æ¬¡å 空éã®åº§æšãšèŠããšããã®å€æ¬¡å 空éã«ã¯ã¢ãã©ã¯ã¿ãŒãè€æ°ååšããã¯ãã§ãããäŸãã°ããã«W1ã®1è¡ç®ã®äžæ¬¡å 座æšÂ (x, y, z) ãã¢ãã©ã¯ã¿ãŒã ã£ããšãããšãåŒã®å¯Ÿè±¡æ§ããé çªãå ¥ãæ¿ãã (y, z, x) ãš (z, x, y) ãã¢ãã©ã¯ã¿ãŒã«ãªãã¯ãã ïŒãã ã x â yãy â zãz â xïŒããã¡ããããã«å¿ããŠW1ã®äºè¡ç®ã b1ãW2ãb2 ãèŠçŽ ã®é çªãå ¥ãæ¿ãããÂ
Â
äžžã6æ¡ã®ã±ãŒã¹ã¯ãäžžããªãã®ã±ãŒã¹ãšç°ãªãã¢ãã©ã¯ã¿ãŒã«åŒãã€ããããŠããŸã£ããã®ããã«èŠããã
ãããäžžã7æ¡ã®ã±ãŒã¹ãäžžã5æ¡ã®ã±ãŒã¹âŠã ã£ãŠãäžžããªããšåãã¢ãã©ã¯ã¿ãŒãç®æããŠãããšããä¿èšŒã¯ã©ãã«ããªãã®ã ã
æ¯èŒã®ããããã®ïŒãããªãã¡åæå€éã¿ 50 ã® W1ãb1ãW2ãb2 ãã³ãè¡šãå°æ°ç¹ä»¥äž1æ¡è¡šç€ºãããšãåœç¶ãªããäžžããªãïœäžžã2æ¡ã®çµæã¯åºå¥ã€ããªããªãã
 | äžžããªã | 6æ¡ | 4æ¡ | 2æ¡ |
W1[0][0] | 3.1 | 3.1 | 3.1 | 3.1 |
W1[0][1] | -6.9 | -6.9 | -6.9 | -6.9 |
W1[0][2] | -8.0 | -8.0 | -8.0 | -8.0 |
W1[1][0] | -3.7 | -3.7 | -3.7 | -3.7 |
W1[1][1] | -2.4 | -2.4 | -2.4 | -2.4 |
W1[1][2] | 7.2 | 7.2 | 7.2 | 7.2 |
b1[0] | -2.8 | -2.8 | -2.8 | -2.8 |
b1[1] | 1.3 | 1.3 | 1.3 | 1.3 |
b1[2] | -4.3 | -4.3 | -4.3 | -4.3 |
W2[0][0] | -6.5 | -6.5 | -6.5 | -6.5 |
W2[0][1] | 7.9 | 7.9 | 7.9 | 7.9 |
W2[1][0] | 6.6 | 6.6 | 6.6 | 6.6 |
W2[1][1] | -2.8 | -2.8 | -2.8 | -2.8 |
W2[2][0] | 1.6 | 1.6 | 1.6 | 1.6 |
W2[2][1] | 12.7 | 12.7 | 12.7 | 12.7 |
b2[0] | 1.8 | 1.8 | 1.8 | 1.8 |
b2[1] | -1.8 | -1.8 | -1.8 | -1.8 |
Â
ãã®æ°å€ã«åºã¥ãæ€ç®çµæããããããããã®ã ã
ãŸãã¯å ¥å x ãš1å±€ç®éã¿ W1 ã®ç©ã
Â
1å±€ç®ãã€ã¢ã¹ b1ãšã®åããšããxW1 + b1 ã§ããã
äŸã«ãã£ãŠãããŒããã£ã¹ããã§ããªãããã1è¡ç®ã2ïœ4è¡ç®ã«ã³ããããŠããã
Â
ä»åã¯å ã®2ã€ã®æ€ç®ãšç°ãªãã1 or 0 ã®è¿äŒŒã§ã¯å·§ããããªãã£ãã
ããã§äžæ²ã¹ã¯ã·ã§ã®åºåã Python ã®ã·ã°ã¢ã€ãé¢æ°ã«å ¥åãããã®çµæãå°æ°ç¹ä»¥äž1æ¡ã§äžžãããã®ã Z1 ãšããã
ãããŸã§ãããªãæ€ç®ã Python ã§ãã£ãã»ããæ©ãã£ããšæã£ããããã£ãŠã¿ãªããã°ããããªãããšã¯ããã°ãã°ããã
Z1 ãš 2å±€ç®ã®éã¿ W2 ã®ç© Z1W2 ã®èšç®ã§ããã
Â
ããã«2å±€ç®ã®ãã€ã¢ã¹ b2 ãå ç®ããŠãããZ1W2 + b2 ã§ããã
ãªããªãã ããã¯ïŒ
1è¡ç®ïŒ1åç® ïŒ2åç®ã2è¡ç®ïŒ1åç® ïŒ 2åç®ã3è¡ç®ïŒ1åç® ïŒ 2åç®ã4è¡ç®ïŒ1åç® ïŒ2åç®ã ãããåºåã§ãœããããã¯ã¹é¢æ°ãåãŸããã°ç¢ºãã«ããã§ã 1åç®ïŒEORã®åŠå®ã2åç®ïŒEOR ã«ãªããã©ãå ã»ã©ã®åæå€éã¿ 0.1 ã®ãšãã®é®®ãããªå¯Ÿç§°æ§ãšã¯äŒŒãŠã䌌ã€ããªãã§ã¯ãªããïŒïŒ
ã ããã®å€ããããåæå€ã®å·®ãå°æ°ç¹ä»¥äžã®äžžãã®æ¡æ°çšåºŠã§ã¯ã³ããšãããªã匷åãªã¢ãã©ã¯ã¿ãŒã§ããã¯ããªã®ã ãããªãAIããã®ã¢ãã©ã¯ã¿ãŒãéžæããã®ãã人éã«ã¯èŠåœã€ããªããå°ãªããšãç§ã«ã¯èŠåœã€ããªãã
ãŸããšAIã®èããããšã¯ããããã
ã¹ãã³ãµãŒãªã³ã¯
Â