ð§ââïžã¢ãããŒã¿ãŒã®ä»çµã¿ã¯æ±ºå®æšã®å¿çšã§ããïŒ
ãã¢ãããŒã¿ãŒãïŒAkinatorïŒã¯ããŠãŒã¶ãŒãèããŠãããã£ã©ã¯ã¿ãŒãæå人ã質åã«ãã£ãŠåœãŠããŠã§ãã²ãŒã ã§ããã¢ãããŒã¿ãŒã®èåŸã«ããäž»ãªæè¡ãšããŠã¯ã決å®æšã®æŠå¿µããã®æ¡åŒµã§ãããã€ããªæ€çŽ¢æšãé¢äžããŠãããšèããããŸãã
決å®æšã¯ã質åã®é£ç¶ã«åºã¥ããŠçµè«ãå°ãåºãããã®æš¹æšæ§é ã®ã¢ã«ãŽãªãºã ã§ããåããŒãã§è³ªåãè¡ããããã®åçã«åºã¥ããŠæ¬¡ã®ããŒãã«ç§»åããŸããã¢ãããŒã¿ãŒã¯ããŠãŒã¶ãŒã®åçã«åºã¥ããŠæ¬¡ã®è³ªåãéžæãããããç¹°ãè¿ãããšã§çµã蟌ã¿ãè¡ããæçµçã«ãã£ã©ã¯ã¿ãŒãæå人ãæšæž¬ããŸãã
ããããã¢ãããŒã¿ãŒã®ä»çµã¿ã¯åãªãéçãªæ±ºå®æšãããé²åããŠããŸãã
ãŠãŒã¶ãŒããã®ãã£ãŒãããã¯ã倧éã®ããŒã¿ãåŠç¿ããŠã質åã®é çªãå 容ãæé©åããŠããå¯èœæ§ãé«ãã§ãããã®ãããªåçãªåŠç¿ã»æé©åã®æ©èœã¯ãæ©æ¢°åŠç¿ã®æè¡ãã¢ã«ãŽãªãºã ãçµã¿åãããŠå®çŸãããŠãããšèããããŸãã
ç·ããŠãã¢ãããŒã¿ãŒã®èåŸã«ã¯æ±ºå®æšã®åçãåºç€ãšããŠååšãããšèšããŸãããããã«å ããŠä»ã®æè¡ãã¢ã«ãŽãªãºã ãçµã¿èŸŒãŸããŠããã§ãããã
ã¢ãããŒã¿ãŒã®ãããªè³ªåå¿çã²ãŒã ãããŒã¹ã«ãžãäžçŽåºŠã®æŠå¿µã説æããŸãã
æ³åããŠã¿ãŠãã ãããã¢ãããŒã¿ãŒããã¬ã€ã€ãŒããã®åçã«åºã¥ããŠèããŠãããã£ã©ã¯ã¿ãŒãæšæž¬ããããšããŠããŸããããã§ãã¢ãããŒã¿ãŒã䜿ã£ãŠãã決å®æšã®1ã€ã®ããŒããããã®ãã£ã©ã¯ã¿ãŒã¯ã¢ãã¡ã®ãã£ã©ã¯ã¿ãŒã§ããïŒããšãã質åãä¿æããŠãããšããŸãããã
ããŒã¿ã»ããå ã®ãã£ã©ã¯ã¿ãŒã¯ä»¥äžã®ããã«ãªã£ãŠãããšããŸãïŒ
ã¢ãã¡ãã£ã©ã¯ã¿ãŒ: 40人
éã¢ãã¡ãã£ã©ã¯ã¿ãŒ: 60人
ãã®è³ªåã䜿ã£ãŠããŒã¿ãåå²ãããšãäŸãã°ä»¥äžã®ããã«ãªããŸãïŒ
ãã¯ããã®åç: ã¢ãã¡ãã£ã©ã¯ã¿ãŒ30人, éã¢ãã¡ãã£ã©ã¯ã¿ãŒ10人
ãããããã®åç: ã¢ãã¡ãã£ã©ã¯ã¿ãŒ10人, éã¢ãã¡ãã£ã©ã¯ã¿ãŒ50人
ååããŒãã§ã®ãžãäžçŽåºŠãèšç®ããŸãã
ãã¯ããã®åçã®ãžãäžçŽåºŠïŒ
[ 1 - ( \frac{30}{40} )^2 - ( \frac{10}{40} )^2 = 0.375 ]ãããããã®åçã®ãžãäžçŽåºŠïŒ
[ 1 - ( \frac{10}{60} )^2 - ( \frac{50}{60} )^2 \approx 0.278 ]
ãããã®ãžãäžçŽåºŠã䜿ã£ãŠã質åã®å šäœçãªäžçŽåºŠãèšç®ããããšãã§ããŸãããã®èšç®ãä»ã®å¯èœãªè³ªåãšæ¯èŒããŠãæãäžçŽåºŠãäœããªã質åãéžæããŸãã
ãã®æ¹æ³ã§ãã¢ãããŒã¿ãŒã®ãããªã·ã¹ãã ã¯ãå¹ççã«ãã£ã©ã¯ã¿ãŒãç¹å®ãã質åãéžã¶æå©ããšããŠãžãäžçŽåºŠã䜿çšããããšãã§ããŸãã
äŸãã°æ¬ãåé¡ããæã«é ç®ã足ããŠããããã®ä»ãç¡ããªãããã«ããããšããžãäžçŽåºŠããŒãã«ããããšã§ããããïŒ
ã¯ãããã®è§£éã¯æ£ããã§ãããžãäžçŽåºŠããŒãã«ãªããšããããšã¯ãããéåãå®å šã«äžã€ã®ã¯ã©ã¹ïŒãŸãã¯ã«ããŽãªïŒã«å±ããããšãæå³ããŸãã
äŸãšããŠæ¬ã®åé¡ãèããå Žåããžã£ã³ã«ãã«ããŽãªã§æ¬ãåé¡ããéã«ãååé¡ã«ããŽãªå ã§äžã€ã®ãžã£ã³ã«ã®æ¬ã ããååšããããã«ãããšããã®ã«ããŽãªã®ãžãäžçŽåºŠã¯0ã«ãªããŸããããªãã¡ãåã«ããŽãªãçŽç²ã«ãªããŸãã
ããã®ä»ããšããã«ããŽãªãååšããªããªãããšã¯ãå šãŠã®æ¬ãæ確ãªãžã£ã³ã«ãã«ããŽãªã«åé¡ãããã©ã®ã«ããŽãªãäžã€ã®ãžã£ã³ã«ã®æ¬ã ãã§æ§æãããŠããç¶æ ãæå³ããŸãããã®ç¶æ ã§ã¯ãå šãŠã®ã«ããŽãªã®ãžãäžçŽåºŠã0ã«ãªããŸãã
ãã ããå®éã®åé¡äœæ¥ã«ãããŠãå šãŠã®ã¢ã€ãã ãæ確ãªã«ããŽãªã«åããããšãé£ããå Žé¢ãå€ããããããçšåºŠã®äžçŽåºŠïŒææ§ãïŒã蚱容ããããšãçŸå®çã§ãã
決å®æšã®åã蟌ã¿ïŒpruningïŒã¯ãéåŠç¿ãé²ãããã«ãããéšåã®æãåãé€ãéçšãæããŸããéåŠç¿ãšã¯ãåŠç¿ããŒã¿ã«é床ã«é©åããŠããŸããæ°ããããŒã¿ã«å¯Ÿããäºæž¬æ§èœãäœäžããçŸè±¡ãæå³ããŸãã
ã¢ãããŒã¿ãŒãäŸã«åããšããã®ã²ãŒã ã¯è³ªåã«çããããšã§ãŠãŒã¶ãŒãèããŠãããã£ã©ã¯ã¿ãŒãåœãŠãã²ãŒã ã§ãã決å®æšã®åããŒãã質åã«çžåœããæã¯ãã¯ããããããããã®çãã«åºã¥ãåå²ãšãªããŸãã
åã蟌ã¿ã®äŸ
éåŠç¿ã®åå : ã¢ãããŒã¿ãŒãéåžžã«ãã€ããŒãªãã£ã©ã¯ã¿ãŒããäžè¬çã§ãªãç¹åŸŽã«åºã¥ã質åãç¹°ãè¿ããŠããå ŽåãäŸ:ãããªãã®ãã£ã©ã¯ã¿ãŒã¯ã1992幎ã®ãããšããœãŒãã§ç·è²ã®åžœåããã¶ã£ãŠããŸãããïŒã
åã蟌ã¿ã®éçš: ãã®ãããªçŽ°ãããã質åïŒæïŒãåãé€ããããäžè¬çãªè³ªåã«éäžãããããªæãæ®ãã
çµæ: ããæ±çšæ§ã®ãã質åã®ã¿ã䜿çšããããšã§ãã¢ãããŒã¿ãŒã¯å€ãã®ãã£ã©ã¯ã¿ãŒã«é©çšã§ãã質åãç¹°ãè¿ãããã«ãªãã
åã蟌ã¿ã®ç®çã¯ãæšã®æ·±ããè€éããæžå°ãããããšã§ãã¢ãã«ã®æ±åæ§èœãåäžãããããšã§ããéåŠç¿ãé¿ããæ°ããããŒã¿ïŒãã®å Žåãæ°ãããŠãŒã¶ãŒãäºæž¬ãããŠããªããã£ã©ã¯ã¿ãŒïŒã«å¯Ÿããäºæž¬æ§èœãåäžãããããã«è¡ãããŸãã
ã¢ãããŒã¿ãŒã®ãããªããã°ã©ã ã¯ããŠãŒã¶ãŒãèããŠãããã£ã©ã¯ã¿ãŒããªããžã§ã¯ãã質åã«ãã£ãŠåœãŠãã²ãŒã ã§ãããã¬ã€ã€ãŒã®çãã«åºã¥ããŠè³ªåãæŽç·ŽãããŠããããšã«ãããæçµçã«çããæšæž¬ããŸããããã§ã¯ããã®ãããªããã°ã©ã ãäœãããã®æ¬äŒŒã³ãŒãã瀺ããŸãã
æ¬äŒŒã³ãŒã
åæå:
ãã£ã©ã¯ã¿ãŒããŒã¿ããŒã¹ãèªã¿èŸŒãïŒåãã£ã©ã¯ã¿ãŒã¯å±æ§ã§è¡šãããïŒ
ã²ãŒã ã®ç¶æ
ã管çããå€æ°ãèšå®
ã¡ã€ã³ã«ãŒã:
while ã²ãŒã ãçµäºããŠããªã:
æé©ãªè³ªåãéžã¶ïŒæ
å ±ã²ã€ã³ãæ倧ã®ãã®ïŒ
ãŠãŒã¶ãŒã«è³ªåããã
ãŠãŒã¶ãŒã®åçãååŸïŒã¯ããããããããããªãïŒ
if ãŠãŒã¶ãŒã®åçãããããªã:
次ã®è³ªåãéžã¶
else:
åçã«åºã¥ããŠãã£ã©ã¯ã¿ãŒãªã¹ãããã£ã«ã¿ãªã³ã°
if ãã£ã«ã¿ãªã³ã°åŸã®ãã£ã©ã¯ã¿ãŒãªã¹ãã1ã€ã«çµã蟌ãŸãã:
æšæž¬ããŠãŒã¶ãŒã«æ瀺
ãŠãŒã¶ãŒãæ£ããã確èª
if æ£ãã:
ã²ãŒã ãçµäº
else:
ã²ãŒã ãç¶ãã
if ãã£ã©ã¯ã¿ãŒãªã¹ãã空ã«ãªã£ã or 質åããªããªã£ã:
ãŠãŒã¶ãŒã«ãçããåœãŠãããšãã§ããŸããã§ããããšäŒãã
ã²ãŒã ãçµäº
ã²ãŒã çµäºåŸã®åŠç:
ãŠãŒã¶ãŒã«å床ãã¬ã€ãããã©ããå°ãã
if åãã¬ã€ãåžæ:
ã²ãŒã ã®ç¶æ
ããªã»ããããŠã¡ã€ã³ã«ãŒãã«æ»ã
else:
çµäº
解説
ããŒã¿ããŒã¹ã®æ§é : ãã£ã©ã¯ã¿ãŒã¯å±æ§ïŒäŸ: æ§å¥ã髪ã®è²ãè¶ èœåã®æç¡ãªã©ïŒã«ãã£ãŠèšè¿°ãããŸãããããã®å±æ§ã«ãã£ãŠãã£ã©ã¯ã¿ãŒãèå¥ãããé©åãªè³ªåãçæãããããã«ããŸãã
質åã®éžæ: æãæ å ±ãåŸããã質åïŒã€ãŸããæ®ãããéžæè¢ãæãåçã«åå²ãã質åïŒãéžã¶ããã«ãæ å ±ã²ã€ã³ãªã©ã®åºæºã䜿çšããŸãã
ãã£ã«ã¿ãªã³ã°: ãŠãŒã¶ãŒã®åçã«åºã¥ããŠãåè£ã®ãã£ã©ã¯ã¿ãŒãçµã蟌ãã§ãããŸããããã«ããã次第ã«æ£ç¢ºãªæšæž¬ãå¯èœã«ãªããŸãã
ãã®æ¬äŒŒã³ãŒããå ã«å ·äœçãªããã°ã©ãã³ã°èšèªã§å®è£ ããéã¯ãããŒã¿ããŒã¹ã®èšèšããŠãŒã¶ãŒã€ã³ã¿ãã§ãŒã¹ã®è©³çŽ°ãªã©ãããã«è©³çŽ°ãªèšèšãå¿ èŠã«ãªããŸãã
ãªãŒãã³ãœãŒã¹ã®ã¢ãããŒã¿ãŒ
ã¯ããã¢ãããŒã¿ãŒã®ãªãŒãã³ãœãŒã¹ããŒãžã§ã³ã¯ããã€ãååšããŸãã
OpenAkinator:
ããã¯ç¡æã§ãªãŒãã³ãœãŒã¹ã®ã¢ãããŒã¿ãŒã®ã¯ããŒã³ã§ããCèšèªã§æžãããŠãããGitHubã§å ¬éãããŠããŸãããã«ãæ¹æ³ã䜿ãæ¹ã«ã€ããŠã®è©³çŽ°ãæäŸãããŠããŸã [â]ã
Pythonåãã®ã©ã€ãã©ãªã§ãã¢ãããŒã¿ãŒã®ã²ãŒã ãç°¡åã«å®è£ ã§ããAPIãæäŸããŠããŸããéåæããŒãžã§ã³ããããè€æ°ã®èšèªã«å¯Ÿå¿ããŠããŸã [â]ã
ã¢ãããŒã¿ãŒã®åæš
ã¢ãããŒã¿ãŒã¯åæšãšããŠç»é²ãããŠããŸãããã®åæšã¯ããã©ã³ã¹ã®äŒæ¥ELOKENCEã«ãã£ãŠææãããŠããŸããã¢ãããŒã¿ãŒã®åæšã¯ãã²ãŒã ããšã³ã¿ãŒãã€ã³ã¡ã³ããµãŒãã¹ã«é¢é£ããã¯ã©ã¹ã§ç»é²ãããŠããŸã [â] [â]ããã ããäžéšã®ç»é²ã¯åãæ¶ãããŠããå ŽåããããŸã [â]ã
ãããã£ãŠãã¢ãããŒã¿ãŒãšããååã䜿çšããéã«ã¯ãåæšæš©ã«æ³šæããå¿ èŠããããŸãããªãŒãã³ãœãŒã¹ã®ãããžã§ã¯ããäœæããå Žåã¯ãåæšæš©ã«è§Šããªãããã«ç°ãªãååã䜿çšããããšãæšå¥šãããŸãã