ãæ½çãã¶ã¤ã³ã®ããã®æ©æ¢°å¦ç¿å ¥éããå®å ¨ã«ç解ãããµãã·ããããã±ã¢ã³æç²ã¢ã«ã´ãªãºã ãå®è£ ãã話
- ãããã¼ã°
- ã¹ãã¼ãªã¼ç·¨
- 第1ç« æé
- 第2ç« çµ¶æ
- 第3ç« åç
- 第4ç« åèµ·
- step1ï¼åï¼ KPIã®è¨å®
- step2ï¼åï¼ ãã¼ã¿ã®è¦³æ¸¬æ§é ãã¢ãã«åãã
- step3ï¼åï¼ è§£ãã¹ãåé¡ãç¹å®ãã
- step4ï¼åï¼ è¦³æ¸¬ãã¼ã¿ã®ã¿ãç¨ãã¦åé¡ã解ãæ¹æ³ãèãã
- step5ï¼åï¼ æ©æ¢°å¦ç¿ã¢ãã«ãå¦ç¿ãã
- step6ï¼åï¼ æ½çãå°å ¥ãã
- 第5ç« ä¿ºãã¡ã®æ¦ãã¯ããããã ï¼
- å®è£ ç·¨
- ã¾ã¨ã
- ãã®è¨äºãèªãã æ¹ã¯ãããªè¨äºãèªãã§ãã¾ãï¼å¤åï¼
@tkanayama_ã§ããå æ¥ããæ½çãã¶ã¤ã³ã®ããã®æ©æ¢°å¦ç¿å ¥é*1ãããæµè´ããã ãã¾ããã
ããã§æ¬ã®å 容ãå¼ç¨ãã¤ã¤ãå¦ãã ãã¨ããã±ã¢ã³ãé¡æã«å®è·µãã*2ãã¨ã«ãããèªãã®ç解ãå®çãããã¨ã¨ãã«æ¬ã®è¯ãããä¼ãã§ããã°ã¨æãã¾ãã
ãããã¼ã°
ãµãã·ããã¯ãã¼ã¿ãµã¤ã¨ã³ã¹ã«å¼·ã¿ãæã£ããã±ã¢ã³ãã¬ã¼ãã¼ã§ãã
ãã®ä¸çã§ã¯ããã±ã¢ã³ãæç²ãããã¨ã«ããããããè¬ç¤¼éããã±ã¢ã³ãã¬ã¼ãã¼ã®éè¦ãªåå ¥æºã®ä¸ã¤ã¨ãªã£ã¦ãã¾ãããã±ã¢ã³ãæã¾ãã¦å士ã«éãã¨ããã±ã¢ã³ç 究ã¸ã®ååéã¨ãã¦è¬ç¤¼éãåãåããã¨ãã§ãã¾ã*3ã
ããªãã¡ã以ä¸ã®ãããªè¡¨ããã±ã¢ã³ãã¬ã¼ãã¼ã«ä¸ãããã¦ãããã®ã¨ãã¾ããï¼ãã¼ã¿ã®å ¨ä½ã¯GitHubãã確èªã§ãã¾ããï¼
å³éçªå· | åå | æç²é£åº¦ï¼æ°åã大ããã»ã©æç²ãé£ããï¼*4 | è¬ç¤¼éï¼ãã±åï¼*5 |
---|---|---|---|
1 | ãã·ã®ãã | 210 | 1,600 |
2 | ãã·ã®ã½ã¦ | 210 | 4,358 |
ã»ã»ã» | ã»ã»ã» | ã»ã»ã» | ã»ã»ã» |
25 | ãã«ãã¥ã¦ | 65 | 1,785 |
ã»ã»ã» | ã»ã»ã» | ã»ã»ã» | ã»ã»ã» |
150 | ãã¥ã¦ãã¼ | 252 | 47,333 |
151 | ãã¥ã¦ | 210 | 24,414 |
ãã±ã¢ã³ã®æç²ã«ä½¿ãããã¼ã«ã¯ã¢ã³ã¹ã¿ã¼ãã¼ã«ãããã¹ã¿ã¼ãã¼ã«ã¾ã§4種é¡ãããããããã®ãã¼ã«ã¯ä¾¡æ ¼ã¨æ§è½ãç°ãªã£ã¦ãã¾ãããã±ã¢ã³ãã¬ã¼ãã¼ã¯ããã±ã¢ã³ã«å¯¾ãã¦ãããããããã®ãã¼ã«ãæããããããã¯ä½ããããéãããã¨ããé¸æè¢ãåããã¨ãã§ãã¾ãã表ã«ã¾ã¨ããã¨ä»¥ä¸ã®ããã«ãªãã¾ãã
ã¢ã¯ã·ã§ã³å | ã³ã¹ãï¼ãã±åï¼ | æç²ãããã |
---|---|---|
éãã | 0 | å¿ ãæã¾ããããªã |
ã¢ã³ã¹ã¿ã¼ãã¼ã«ãæãã | 100 | æã¾ãã«ãã |
ã¹ã¼ãã¼ãã¼ã«ãæãã | 500 | ããæã¾ãããã |
ãã¤ãã¼ãã¼ã«ãæãã | 2,000 | ã¨ã¦ãæã¾ãããã |
ãã¹ã¿ã¼ãã¼ã«ãæãã | 10,000 | å¿ ãæã¾ãããã |
ãµãã·ããã¯ãããã®å®æ§çã»å®éçãªæ å ±ãé ¼ãã«ãåçãã§ããã ã大ããããå¿ è¦ãããã¾ãããããªãã°ããã±ã¢ã³ãã¬ã¼ãã¼ã¨ãã¦çè¨ãç«ã¦ã¦ããã®ã¯é£ããã§ãããã
以ä¸ã§ã¯ç°¡åã®ããããã±ã¢ã³ã¨ã®å¯¾é¢1åã«ã¤ãæç²ãã£ã³ã¹ã¯1åã®ã¿ã¨ãã¾ããæç²ã«å¤±æããããã¾ã次ã®ãã±ã¢ã³ã¨å¯¾é¢ãããã¨ã«ãªãã¾ãã次ã«ç¾ãããã±ã¢ã³ã¯ãåã種é¡ã®ãã±ã¢ã³ãããããªãããéã種é¡ããããã¾ãããï¼2021/09/15追è¨ï¼ã©ã®ãã±ã¢ã³ã¨å¯¾é¢ãããã¯é©å½ãªç¢ºçåå¸ã«ãã£ã¦æ±ºã¾ãã¾ããããã±ã¢ã³ãã¬ã¼ãã¼å´ã¯ãã®åå¸ãå¶å¾¡ã§ããªããã®ã¨ãã¾ããã¤ã¾ãããã«ãã¥ã¦ã¨ä¼ãããããã¨ãã£ã¦ãã«ãã¥ã¦ãããããªå ´æã ããã¦ãã¦ããããããªãã¨ã¯ã§ãã¾ãããï¼
ã¹ãã¼ãªã¼ç·¨
第1ç« æé
ãµãã·ããã¯ããã¾ã§ãã©ã®ãã±ã¢ã³ã«ã©ã®ãã¼ã«ã使ãããåã¨çµé¨ã«ãã£ã¦æ±ºãã¦ãã¾ããããããããæ½çãã¶ã¤ã³ã®ããã®æ©æ¢°å¦ç¿å ¥éãï¼ä»¥ä¸ãåæ¸ï¼ã«å¿ãæãããæ©æ¢°å¦ç¿ãå¹æçã«å©ç¨ãããã¨ã«ãã£ã¦åçå¢ãçãããã¨èãã¾ããã
åæ¸ã«ããã¨ããæ©æ¢°å¦ç¿å®è·µã®ããã®ãã¬ã¼ã ã¯ã¼ã¯ãã¨ãã¦ä»¥ä¸ã®6ã¤ã®ã¹ããããæè¨ããã¦ãã¾ãã
- KPIãè¨å®ãã
- ãã¼ã¿ã®è¦³æ¸¬æ§é ãã¢ãã«åãã
- 解ãã¹ãåé¡ãç¹å®ãã
- 観測ãã¼ã¿ã®ã¿ãç¨ãã¦åé¡ã解ãæ¹æ³ãèãã
- æ©æ¢°å¦ç¿ã¢ãã«ãå¦ç¿ãã
- æ½çãå°å ¥ãã
ããã§ããµãã·ããã¯ãã®ã¹ãããã«å¿ å®ã«å¾ã£ã¦æ©æ¢°å¦ç¿æ½çãå®è·µãã¦ãããã¨ã«ãã¾ããã
step1. KPIã®è¨å®
ãµãã·ããã¯ãåæ¸ã®ä¾ã¨ãã¦åºã¦ãããåºåã¯ãªãã¯åæ°æ大åãã®KPIãåèã«ãã¦ãä»åã®KPIãããã±ã¢ã³æç²åæ°æ大åãã¨ãããã¨ã«ãã¾ãããã¤ã¾ããä¸å®ã®åæ°ãã±ã¢ã³ã¨å¯¾é¢ããã¨ãããã±ã¢ã³ãã§ããã ãããããæã¾ãããã¨ãKPIã¨ãã¾ãã
step2. ãã¼ã¿ã®è¦³æ¸¬æ§é ãã¢ãã«åãã
ãã¼ã¿ã®è¦³æ¸¬æ§é ã¨ãã¦ä»å注æããªããã°ãªããªãç¹ã¯ãã1åã®å¯¾é¢ã«å¯¾ãã¦ã1ã¤ã®ã¢ã¯ã·ã§ã³ã«å¯¾ããçµæãã観測ãããã¨ãã§ããªããã¨ããç¹ã§ããä¾ãã°ãç®ã®åã«ãã«ãã¥ã¦ãç¾ããã¨ãã¦ãã¢ã³ã¹ã¿ã¼ãã¼ã«ãæããã¨ãã¾ãããã®çµæããæã¾ã£ããorãæã¾ããªãã£ããã®ãã¼ã¿ãå¾ããã¨ãã§ãã¾ãããããããã§ã¯ã¹ã¼ãã¼ãã¼ã«ãæãããã©ãããçµæã«ãªã£ãã®ãï¼ãã¨ãããã¼ã¿ã¯æ±ºãã¦å¾ããã¨ã¯ã§ãã¾ããã
ãã®ç¹ã«æ³¨æãã¦ããµãã·ããã¯ãã¼ã¿åéãè¡ããã¨ã«ãã¾ãããåæ¸ãå®å ¨ã«ç解ãã¦ãããµãã·ããã¯ãåæ¸ã«æ¸ãã¦ãã£ãä¸æã決å®çãªææ決å®ã¢ãã«ããå¾ããããã°ãã¼ã¿ã«å¯¾ãã¦IPSæ¨å®éã使ãå ´åãï¼ä¸ç¥ï¼ãã¤ã¢ã¹ã«å¯¾å¦ã§ãã¾ãããããæãåºãã¾ãããããã§ãµãã·ããã¯ä»¥ä¸ã®ããã«ããã±ã¢ã³ã®è¬ç¤¼éã«å¿ããã«ã¼ã«ãã¼ã¹ãã¤ç¢ºççãªã¢ã«ã´ãªãºã ã«åºã¥ããææ決å®ã¢ãã«ãå®ç¾©ãããããç¨ãã¦ãã¼ã¿ãåéãããã¨ã«ãã¾ããã
if è¬ç¤¼é > 10000å: # ãã¹ã¿ã¼ãã¼ã«ãæãããã {éãã: 10%, ã¢ã³ã¹ã¿ã¼: 10%, ã¹ã¼ãã¼: 10%, ãã¤ãã¼: 20%, ãã¹ã¿ã¼: 50%} elif è¬ç¤¼é > 2000å: # ãã¤ãã¼ãã¼ã«ãæãããã {éãã: 5%, ã¢ã³ã¹ã¿ã¼: 20%, ã¹ã¼ãã¼: 30%, ãã¤ãã¼: 40%, ãã¹ã¿ã¼: 5%} elif è¬ç¤¼é > 500å: # ã¹ã¼ãã¼ãã¼ã«ãæãããã {éãã: 10%, ã¢ã³ã¹ã¿ã¼: 30%, ã¹ã¼ãã¼: 50%, ãã¤ãã¼: 5%, ãã¹ã¿ã¼: 5%} elif è¬ç¤¼é > 100å: # ã¢ã³ã¹ã¿ã¼ãã¼ã«ãæãããã {éãã: 40%, ã¢ã³ã¹ã¿ã¼: 40%, ã¹ã¼ãã¼: 10%, ãã¤ãã¼: 5%, ãã¹ã¿ã¼: 5%} else: # éãããé¸æãããã {éãã: 80%, ã¢ã³ã¹ã¿ã¼: 5%, ã¹ã¼ãã¼: 5%, ãã¤ãã¼: 5%, ãã¹ã¿ã¼: 5%}
ããã«ããã
- å®å ¨ã«ã©ã³ãã ãªè¡åé¸æã§ã¯ãªãã®ã§ããã¼ã¿åé段éã§ãããç¨åº¦æ害ãæãããã
- 確ççãªã¢ã«ã´ãªãºã ãªã®ã§ããã¨ãã¨ææ決å®ã¢ãã«ãå¦ç¿ããéã«ãã¤ã¢ã¹ãåãé¤ãããã
ã®ä¸¡æ¹ãæºãããã¨ãçã£ã¦ãã¾ãã
çµæã¨ãã¦ã以ä¸ã®ãããªå½¢å¼ã®ãã°ãã¼ã¿ãåéã§ãã¾ããã
timestamp | ãã±ã¢ã³ | é¸ãã ã¢ã¯ã·ã§ã³ | æç²ã§ãããï¼ |
---|---|---|---|
2021-08-21T12:34:56+09:00 | ãã«ãã¥ã¦ | éãã | ã§ããªãã£ã |
ã»ã»ã» | ã»ã»ã» | ã»ã»ã» | ã»ã»ã» |
2021-08-28T00:55:21+09:00 | ã¤ã¼ã㤠| ã¢ã³ã¹ã¿ã¼ãã¼ã«ãæãã | ã§ãã |
step3. 解ãã¹ãåé¡ãç¹å®ãã
åæ¸ã®å 容ãå ¨ã¦é ã«å»ã¿è¾¼ãã§ãããµãã·ããã¯ãåæ¸ã§ç´¹ä»ããã¦ããææ決å®ã¢ãã«ã®å®å¼åããã®ã¾ã¾ä½¿ãããã ã¨èãã¾ãããããªãã¡ã以ä¸ãç®çé¢æ°ã¨ãã¦æ大åãã¾ãã
]
åæ¸ã§ã¯åºåã®ã¯ãªãã¯åæ°æ大åãä¾ã¨ãã¦ã ãã¦ã¼ã¶ã¼ã®ç¹å¾´éããã©ã®åºåãã¦ã¼ã¶ã¼ã«è¡¨ç¤ºãããã決ããææ決å®ã¢ãã«ããã¦ã¼ã¶ã¼ãåºåãã¯ãªãã¯ããããã©ããã表ã2å¤ç¢ºçå¤æ°ã¨ãã¦ãã¾ãããããä»åã®ä¾ã«å¿ç¨ããã¨ãããã±ã¢ã³ã®ç¹å¾´éãããã±ã¢ã³ã«å¯¾ãã¦ã©ã®ã¢ã¯ã·ã§ã³ãåãã決ããææ決å®ã¢ãã«ãããã±ã¢ã³ãæã¾ã£ããã©ããã表ã2å¤ç¢ºçå¤æ°ã¨è¦ãªãã°è¯ãããã§ãã
step4. 観測ãã¼ã¿ã®ã¿ãç¨ãã¦åé¡ã解ãæ¹æ³ãèãã
ãã¦ãæé©åãã¹ãç®çé¢æ°ã決ã¾ã£ãã¨ããã§ãæå ã«ãããã¼ã¿ãç¨ãã¦å®éã«ãã¼ã«ã®æãåããæé©åããæ¹æ³ãæ¤è¨ãã¦ããã¾ããstep2ã§ãèå¯ããéããä»åã®åé¡ã®é£ããç¹ã¯ããæ°ãã«å¦ç¿ãããã¨ãã¦ããææ決å®ã¢ãã«ã®åºåããã¼ã¿åéç¨ææ決å®ã¢ãã«ã®åºåã¨ç°ãªã£ã¦ããå ´åããããç´æ¥å¦ç¿ã«å©ç¨ãããã¨ãã§ããªããã¨ããç¹ã§ãã
ããã§ãåæ¸ãæ¯æ©æå ã«ç½®ãã¦å¯ã¦ãããµãã·ããã¯ãåæ¸ã§ç´¹ä»ããã¦ããIPSæ¨å®éãç¨ãã¦ãã¤ã¢ã¹ãåãé¤ããè¿ä¼¼ãè¡ããã¨ã«ãã¾ãããå ·ä½çã«ã¯ã以ä¸ã®ç®çé¢æ°ãæé©åãã¾ãã
ããã§ã ã¯ãã¼ã¿åéã«ç¨ããææ決å®ã¢ãã«ã§ããã¤ã¾ããåç´ã«æå ã®ãã¼ã¿ããæç²ç¢ºçãçµé¨ç¢ºçã¨ãã¦è¨ç®ãã¦ç®çé¢æ°ã¨ããã®ã§ã¯ãªãããã¼ã¿åéã«ç¨ããææ決å®ã¢ãã«ã®åºåã®éæ°ã§éã¿ä»ãããå¤ãç®çé¢æ°ã¨ããã¨ãããã¨ã§ã*6ã
step5. æ©æ¢°å¦ç¿ã¢ãã«ãå¦ç¿ãã
ããã¾ã§ããã°ããã¨ã¯ç®çé¢æ°ãæ大åããããã«ææ決å®ã¢ãã«ãå¦ç¿ããã ãã§ãããµãã·ããã¯ãææ決å®ã¢ãã« ããã¥ã¼ã©ã«ãããã¯ã¼ã¯ã§ã¢ãã«åãã¾ãããã¾ããç¹å¾´é ã¨ãã¦ãã±ã¢ã³ã®æç²é£æ度ã¨è¬ç¤¼éé¡ãç¨ãã¾ãããããã¦ãæå ã®ãã¼ã¿ãç¨ãã¦å¦ç¿ãè¡ãã¾ããã
step6. æ½çãå°å ¥ãã
ä¸å»ãæ©ãæ°ããã¢ã«ã´ãªãºã ã試ããããµãã·ããã¯æ©éãä»åå¦ç¿ããææ決å®ã¢ãã«ã«åºã¥ãã¦æç²ããã«åºããã¾ãããããã§ãå§åçã«åçãæ¹åããã¯ãã§ãã
ãµãã·ããã¯ããã±ã¢ã³ã¨1,000åã®å¯¾é¢ãçµããå¾ãã¯ã¯ã¯ã¯ããªããåçè¨ç®ãã¦ã¿ã¾ãããããã¨â¦
対é¢åæ° | éç®åç |
---|---|
1,000å | ãã¤ãã¹261ä¸ãã±å |
ãªãã¨ãããã¨ã§ãããã大赤åã§ãâ¦ï¼ãµãã·ããã¯èããå´©ãè½ã¡ã¾ããã
第2ç« çµ¶æ
ãªããããªãã¨ãèµ·ãã¦ãã¾ã£ãã®ã§ãããï¼ãµãã·ããã¯ãä»ã¾ã§ã®éç¨ãé¡ã£ã¦ãåå ãèãã¦ã¿ã¾ããã
- step5ã§ææ決å®ã¢ãã«ããã¥ã¼ã©ã«ãããã¯ã¼ã¯ã§ã¢ãã«åããã®ãæªãã£ãï¼LightGBMã使ã£ãã»ããããã£ãã®ãï¼
- step4ã§IPSæ¨å®éã§ãã¤ã¢ã¹ãåãé¤ãæ¹æ³ãééã£ã¦ããï¼
- step3ã§KPIãææ決å®ã¢ãã«ã®ç®çé¢æ°ã¨ãã¦å®å¼åããæ¹æ³ãééã£ã¦ããï¼
- step2ã§èæ ®ã§ãã¦ããªããã¼ã¿ã®è¦³æ¸¬æ§é ããã£ãï¼
æ§ã ãªå¯è½æ§ãèãããã¾ããããã§ãµãã·ããã¯åå ã究æããããã«ãå¦ç¿ããææ決å®ã¢ãã«ãã©ããªãã±ã¢ã³ã«å¯¾ãã¦ã©ã®ã¢ã¯ã·ã§ã³ãé¸æããããå¯è¦åããè¡æã®çµæãç®ã®å½ããã«ãã¾ããã
ãªãã¨ãå ¨ã¦ã®å¯¾é¢ã§ãã¹ã¿ã¼ãã¼ã«ãé¸æããã¦ããã®ã§ãï¼ï¼ï¼
ï¼ããã§ãåããããã¯ãã±ã¢ã³ã¨ã®å¯¾é¢ã表ãã¦ãããææ決å®ã¢ãã«ãé¸æããã¢ã¯ã·ã§ã³ãè²ã§è¡¨ç¾ãã¦ãã¾ããã¾ãã横軸ã¯ãã±ã¢ã³ã®æç²é£æ度ã縦軸ã¯ãã®ãã±ã¢ã³ãæã¾ããå ´åã®è¬ç¤¼éé¡ã表ãã¦ãã¾ããã¾ãããã¹ã¿ã¼ãã¼ã«ã®è²©å£²ä¾¡æ ¼ã§ãã10,000ãã±åã表ã横ç·ãå¼ãã¦ãã¾ããï¼
第3ç« åç
ãªããã®ãããªãã¨ãèµ·ãã¦ãã¾ã£ãã®ãããµãã·ããã¯ã¤ãã«æ°ã¥ãã¾ãããstep1ã§è¨å®ããKPIããããã誤ã£ã¦ããã®ã§ããstep1ã§ãµãã·ããã¯ãããã±ã¢ã³æç²åæ°ãæ大åãããã¨ããKPIã¨ãã¦æ²ãã¾ãããããµãã·ãããæ¬å½ã«æ大åãããã£ãã®ã¯ããã±ã¢ã³ãæç²ãããã¨ã«ããåçãæ大åãããã¨ãã§ãããã±ã¢ã³æç²åæ°ãæ大åããããããã«ã¢ãã«åãã¦å¦ç¿ããããå½ç¶ãéã«ç³¸ç®ãã¤ããã«ãã¹ã¿ã¼ãã¼ã«ãæãç¶ããææ決å®ã¢ãã«ãåºæ¥ä¸ãã£ã¦ãã¾ãã¾ãã
ãµãã·ããã¯ããããã解ãã¹ãåé¡è¨å®ã誤ãã¨ããã®å¾ã®å·¥ç¨ãããã«æ£ããã£ãã¨ãã¦ãæå³ããªãã¨ãããã¨ãçæããã¨åæã«ãæ¬ãä¸èªããã ãã§å®å ¨ã«ç解ããæ°ã«ãªã£ã¦ãããã¨ã«å¯¾ãã¦å¤§ãã«åçãã¾ããã
第4ç« åèµ·
ãã¦ãä»åã®å¤±æã§261ä¸ãã±åã失ã£ã¦ãã¾ã£ããµãã·ããã§ãããããã§ãããªãã®ããµãã·ããã®è¯ãã¨ããã§ãããµãã·ããã¯ä»åã®åçãè¸ã¾ãã¦ãæ¹ãã¦ææ決å®ã¢ãã«ãå¦ç¿ãããã¨ã«ãã¾ããã
step1ï¼åï¼ KPIã®è¨å®
ä»åã¯ãµãã·ããã®çã®é¢å¿ãã¨ãç´ ç´ã«KPIã«ãããã¨ã«ãã¾ãããå ·ä½çã«ã¯ããï¼ããããè¬ç¤¼éã®ç·é¡ï¼- ï¼ãã¼ã«ã®è³¼å ¥ã«ä½¿ã£ãç·é¡ï¼ãããªãã¡åçãæ大åãããã¨ãKPIã¨ãã¾ãã
step2ï¼åï¼ ãã¼ã¿ã®è¦³æ¸¬æ§é ãã¢ãã«åãã
ãã®stepã¯åè¿°ã®step2ã¨åãã§ããããªãã¡ãã1åã®å¯¾é¢ã«å¯¾ãã¦ã1ã¤ã®ã¢ã¯ã·ã§ã³ã«å¯¾ããçµæãã観測ãããã¨ãã§ããªããã¨ãããã¨ã«æ³¨æãã¤ã¤ã確ççãªææ決å®ã¢ãã«ãç¨ãã¦ãã¼ã¿ãåéãã¾ããã
step3ï¼åï¼ è§£ãã¹ãåé¡ãç¹å®ãã
ããã»ã©ã®step3ã§ã¯ã以ä¸ãç®çé¢æ°ã¨ãã¦æ大åãã¾ããã
]
ããã§ãã¯ãã±ã¢ã³ã®ç¹å¾´éãã¯ææ決å®ã¢ãã«ãã¯ãã±ã¢ã³ãæã¾ã£ããã©ããã表ã2å¤ç¢ºçå¤æ°ã§ãããããããä»ååè¨å®ããKPIã«æ²¿ãããã«æ¡å¼µãã¾ãã
ä»åæ大åãããã®ã¯æã¾ãããã±ã¢ã³æ°ã§ã¯ãªããåçã§ããããã§ã以ä¸ã®ããã«ç®çé¢æ°ã«å¤æ´ãå ãã¾ãã
]
ããã§ã
- ã¯ããã対é¢ã§ãã±ã¢ã³ãæã¾ãããã¨ãã§ããå ´åã«åãåããè¬ç¤¼éé¡
- ã¯ãããã¢ã¯ã·ã§ã³ãåã£ãå ´åã«ãããã³ã¹ã
ã§ãã
ã1ï¼ã¤ã¾ãæç²ã§ããï¼ã§ããå ´åã¯ãè¬ç¤¼éé¡ - ã³ã¹ãããåçã¨ãªãã ã0ï¼ã¤ã¾ãæç²ã§ããªãã£ãï¼ã§ããå ´åã¯ã³ã¹ãããã®ã¾ã¾æ失ã«ãªããã¨ã表ãã¦ãã¾ãã
ãããªããstep1ï¼åï¼ ã§è¨å®ããKPIãç´æ¥æé©åããç®çé¢æ°ã«ãªã£ã¦ããã®ã§ãè¯ãããã§ãã
step4ï¼åï¼ è¦³æ¸¬ãã¼ã¿ã®ã¿ãç¨ãã¦åé¡ã解ãæ¹æ³ãèãã
次ã«ããã®ç®çé¢æ°ãæå ã«ãããã¼ã¿ã§æé©åããæ¹æ³ãèãã¾ãããã®stepãå ã»ã©ã®step4ã¨åæ§ã«IPSæ¨å®éãç¨ããã¨ä»¥ä¸ã®ããã«è¡¨ç¾ã§ãã¾ãã
ã¯ãã¼ã¿åéã«ç¨ããææ決å®ã¢ãã«ã§ããå ã»ã©ã®step4ã¨ã®éãã¯ã ãã±ã¢ã³ãæã¾ã£ããã©ãã表ã確çå¤æ° ã«å¯¾ãã¦å ±é ¬éé¡ã¨ä¾¡æ ¼ãèæ ®ããããã«è£æ£ãè¡ã£ãã®ã¿ã§ãã
step5ï¼åï¼ æ©æ¢°å¦ç¿ã¢ãã«ãå¦ç¿ãã
次ã«ãç®çé¢æ°ãæ大åããããã«æ©æ¢°å¦ç¿ã¢ãã«ãå¦ç¿ãã¦ããã¾ãããµãã·ããã¯ãææ決å®ã¢ãã« ãå度ãã¥ã¼ã©ã«ãããã¯ã¼ã¯ã§ã¢ãã«åãã¾ããã
ãã®å¾ãå ã»ã©ã¨åã失æãç¹°ãè¿ããªããããä»åº¦ã¯å®æ¦æå ¥åã«ããªãã¼ã·ã§ã³ãã¼ã¿ãç¨ãã¦æ§è½è©ä¾¡ãè¡ããã¨ã«ãã¾ãããæ§è½è©ä¾¡ã«ããIPSæ¨å®éãç¨ãã¾ããã
æ¯è¼å¯¾è±¡ã¨ããã¢ãã«ã¨ãã¦ã以ä¸ã®ãããªãµãã·ãã渾身ã®æ±ºå®çãªã«ã¼ã«ãã¼ã¹ã¢ãã«ãç¨ãã¾ããã
if è¬ç¤¼é > 10000å: ãã¹ã¿ã¼ãã¼ã«ãæãã elif è¬ç¤¼é > 2000å: ãã¤ãã¼ãã¼ã«ãæãã elif è¬ç¤¼é > 500å: ã¹ã¼ãã¼ãã¼ã«ãæãã elif è¬ç¤¼é > 100å: ã¢ã³ã¹ã¿ã¼ãã¼ã«ãæãã else: éãã
ãã®çµæã以ä¸ã®ããã«æ°ãã«å¦ç¿ããææ決å®ã¢ãã«ã®æ§è½ãã«ã¼ã«ãã¼ã¹ã¢ãã«ã®æ§è½ãä¸åããã¨ã確èªã§ãã¾ããï¼IPWã¨æ¸ããã¦ããæ¹ãä»åæ°ãã«å¦ç¿ããã¢ãã«ã§ãï¼ã
ã¾ããèå¯ã®ããã«ãæ°ãã«å¦ç¿ããææ決å®ã¢ãã«ã®åºåãå¯è¦åãã¾ããã
å ã»ã©ã®å¯è¦åã¨åæ§ã«ãåããããã¯ãã±ã¢ã³ã¨ã®å¯¾é¢1åã表ãã¦ãããææ決å®ã¢ãã«ãé¸æããã¢ã¯ã·ã§ã³ãè²ã§è¡¨ç¾ãã¦ãã¾ããã¾ãã横軸ã¯ãã±ã¢ã³ã®æç²é£æ度ã縦軸ã¯ãã®ãã±ã¢ã³ãæã¾ããå ´åã®è¬ç¤¼éé¡ã表ãã¦ãã¾ããä¾ãã°ãå³ä¸ã®å¤ãå¤ã¯ãã¥ã¦ãã¼ã表ãã¦ãã¾ãã
ãããããä¾ãã°ä»¥ä¸ã®ãããªãã¨ãèªã¿åãã¾ãã
- æç²é£æ度ãé«ããã¤è¬ç¤¼éã10,000åãè¶ ãããã±ã¢ã³ã¯ããã¹ã¿ã¼ãã¼ã«ã使ã£ã¦ãå ãåããã®ã§ãã¹ã¿ã¼ãã¼ã«ã§ç¢ºå®ã«æã¾ããã®ãè¯ãï¼ä¸å³ã®èµ¤æ ï¼ã
- ä¸æ¹ã§ãæç²é£æ度ã¯é«ããè¬ç¤¼éã10,000åãä¸åããã±ã¢ã³ã¯ãã³ã¹ããæªãã®ã§ãéããããé¸æããã®ãè¯ãï¼ä¸å³ã®éæ ï¼ã
ãµãã·ããã®ä½ã£ãã«ã¼ã«ãã¼ã¹ã¢ãã«ã¨æ¯ã¹ãã¨ããã®ãéãããã®ä½¿ãæ¹ã®éãã大ããªå·®ãçãã§ããå¯è½æ§ã示åããã¾ããã
step6ï¼åï¼ æ½çãå°å ¥ãã
ãµãã·ããã¯ãä»åå¦ç¿ããææ決å®ã¢ãã«ãããã³æ¯è¼ã®ããã®ã«ã¼ã«ãã¼ã¹ã¢ãã«ã«åºã¥ãã¦å®éã®ãã£ã¼ã«ãã§A/Bãã¹ããè¡ã*7ãæ§è½ãè©ä¾¡ãã¾ããã
ã¢ãã« | 対é¢åæ° | 1対é¢ãããã®åç |
---|---|---|
ã«ã¼ã«ãã¼ã¹ | 1,000å | 2,249ãã±å |
ä»åå¦ç¿ããææ決å®ã¢ãã« | 1,000å | 3,609ãã±å |
çµæã1対é¢ããã1,000ãã±å以ä¸ã®åçæ¹åãè¡ããã¨ãã§ãã¾ããã
第5ç« ä¿ºãã¡ã®æ¦ãã¯ããããã ï¼
ãµãã·ããã¯ä»åã®çµé¨ããã解ãã¹ãåé¡ãæ£ããè¨å®ããéè¦ããå¦ã³ã¾ãããã¾ããã¢ã«ã´ãªãºã ãå®æ¦æå ¥ããåã«ããªãæ¹çè©ä¾¡ãæåãå¯è¦åãããã¨ã®éè¦ããåæã«å¦ã³ã¾ããã
ãµãã·ããã¯ãä»å¾ããæ½çãã¶ã¤ã³ã®ããã®æ©æ¢°å¦ç¿å ¥éãããã¤ãã«ã«ããªãããæ°ããå¦ç¿ããææ決å®ã¢ãã«ãç¨ãã¦ãã¼ã¿ãåéãããã®ãã¼ã¿ãç¨ãã¦ããã«é«æ§è½ãªææ決å®ã¢ãã«ãéçºãã¦ãããã¨ã§ãããã
TO BE CONTINUED...
å®è£ ç·¨
ããããã¯ãä¸è¨ã®ã¹ãã¼ãªã¼ç·¨ãä½æããã«ããã£ã¦å®è£ ããå 容ã解説ãã¦ããã¾ããå®è£ ã®å ¨è²ã¯GitHubã«ã¦å ¬éãã¦ãã¾ãã
å®è£ ã¯ãåæ¸ã§ãç´¹ä»ããã¦ãã Open Bandit Pipline ãç¨ãã¦è¡ãã¾ãããã·ãã¥ã¬ã¼ã·ã§ã³ãã¼ã¿ãçæãã¦å®é¨ãè¡ã£ãã®ã§ã以ä¸ã§ã¯ãµãã·ããç®ç·ã§ã¯ãªãç¥æ§ç®ç·ã§èªã£ã¦ãããã¨ã«æ³¨æãã¦ãã ããã
æºå
ã¾ããåã¢ã¯ã·ã§ã³ãå®ç¾©ãã¦ããã¾ããä»ååãããã¢ã¯ã·ã§ã³ã¯5種é¡ã§ãããããã« performance
ï¼æã¾ããããï¼ã¨ cost
ï¼ãã¼ã«ã®è²©å£²ä¾¡æ ¼ï¼ã¨ããå±æ§ãæããã¾ãã
@dataclass class Action: label: str performance: int cost: int ACTIONS: List[Action] = [ Action(label='éãã', performance=-math.inf, cost=0), Action(label='ã¢ã³ã¹ã¿ã¼ãã¼ã«ãæãã', performance=50, cost=100), Action(label='ã¹ã¼ãã¼ãã¼ã«ãæãã', performance=100, cost=500), Action(label='ãã¤ãã¼ãã¼ã«ãæãã', performance=200, cost=2000), Action(label='ãã¹ã¿ã¼ãã¼ã«ãæãã', performance=math.inf, cost=10000), ]
ã¾ããåãã±ã¢ã³ã®æã¾ãããããè¬ç¤¼é ãåå¾ããããã«ãã±ã¢ã³å³éã¯ã©ã¹ãä½ã£ã¦ããã¾ãã
# ãã±ã¢ã³ã®æç²é£åº¦ã¨è¬ç¤¼éãæãã¦ããããã±ã¢ã³å³éã¯ã©ã¹ class PokemonZukan: def __init__(self) -> None: self._data = pd.read_csv('resources/input/pokemon.csv', index_col='id') def get_capture_dificulty(self, pokemon_id: int) -> int: return self._data.loc[pokemon_id]['capture_dificulty'] def get_reward(self, pokemon_id: int) -> int: return self._data.loc[pokemon_id]['reward'] def get_name(self, pokemon_id: int) -> str: return self._data.loc[pokemon_id]['name']
æ¬ä¼¼ãã¼ã¿ã®çæ
æ¬ä¼¼ãã¼ã¿ã®çæã«ã¯ãOpen Bandit Piplineã® SyntheticBanditDataset
ãç¨ãã¾ããã以ä¸ã®ããã«ãä»åã®ç¶æ³ã«åãã㦠reward_function
㨠behavior_policy
ãå®ç¾©ãã¦SyntheticBanditDataset
ã«ä¸ããã ãã§ãï¼ç°¡åã§ããï¼ï¼ãreward_function
ã¯åã¢ã¯ã·ã§ã³ãåã£ãæã«ãã±ã¢ã³ãæã¾ã確çãè¿ããbehavior_policy
ã¯ã¹ãã¼ãªã¼ç·¨ã®step2ã§å®ç¾©ãããã¼ã¿åéç¨ã®ææ決å®ã¢ãã«ã®åºåãè¿ãããã«å®ç¾©ãã¦ããã¾ãã
def _reward_function( context: np.ndarray, action_context: np.ndarray, random_state: Optional[int] = None, ) -> np.ndarray: # çç¥ # åã¢ã¯ã·ã§ã³ãåã£ãæã«ãã±ã¢ã³ãæã¾ã確çãè¿ã return capture_probabilities def _behavior_policy( context: np.ndarray, action_context: np.ndarray, random_state: Optional[int] = None, ) -> np.ndarray: # çç¥ # ãã¼ã¿åéç¨ã®ææ決å®ã¢ãã«ã®åºåãè¿ã return policy dataset = SyntheticBanditDataset( n_actions=len(ACTIONS), dim_context=1, # pokemon_idã®å ã«ãªãfloatå¤ãçæãã reward_function=_reward_function, behavior_policy_function=_behavior_policy, random_state=615, )
ãã ããSyntheticBanditDataset
ã¯ä»åã®ã¹ãã¼ãªã¼ã®ãããªé¢æ£å¤ã®å ±é
¬ãçæãããã¨ãã§ããªãã®ã§ã以ä¸ã®ããã«å¾å¦çãè¡ãªã£ã¦ãã¾ãã
def _update_reward(data: BanditFeedback) -> BanditFeedback: rewards = data['context'][:, 2] costs = np.array([ACTIONS[action_id].cost for action_id in data['action'].flatten()]) data['reward'] = rewards * data['reward'] - costs return data def _post_process(data: BanditFeedback) -> BanditFeedback: # .... data = _update_reward(data) # ... return data training_data = _post_process(dataset.obtain_batch_bandit_feedback(n_rounds=50000)) validation_data = _post_process(dataset.obtain_batch_bandit_feedback(n_rounds=5000)) test_data = _post_process(dataset.obtain_batch_bandit_feedback(n_rounds=1000))
ææ決å®ã¢ãã«ã®å¦ç¿
åæ¸ã§ç´¹ä»ããã¦ãã IPWLearner
ã§ã¯ãä»åã®ã¹ãã¼ãªã¼ã®ããã«å ±é
¬ãè² ã®å¤ãåãå ´åã«ä¸æãå¦ç¿ãããã¨ãã§ãã¾ãããããã§ãå ±é
¬ãè² ã®å ´åã«ãæè»ã«å¯¾å¿ã§ããã¢ãã«ã§ãã NNPolicyLearner
ãç¨ãã¾ã*8ã使ãæ¹ã¯IPWLearner
ã¨ã»ã¼åãã§ãå
ã»ã©çæãããã¼ã¿ãç¨ãã¦fit
ããpredict
ããã ãã§ãã
class IPWModel(BaseModel): def __init__(self) -> None: self._model = NNPolicyLearner( n_actions=len(ACTIONS), dim_context=2, off_policy_objective=IPS().estimate_policy_value_tensor, random_state=615 ) self._scaler = StandardScaler() def fit(self, data: BanditFeedback) -> None: context = data["context"][:, 1:] self._scaler.fit(context) scaled_context = self._scaler.transform(context) self._model.fit( context=scaled_context, action=data['action'], reward=data['reward'], pscore=data['pscore'], ) def predict(self, context: np.ndarray) -> np.ndarray: scaled_context = self._scaler.transform(context[:, 1:]) return self._model.predict(context=scaled_context)
ã¢ãã«ã®ãªãæ¹çè©ä¾¡
Open Bandit Piplineã使ãã°ãã¢ãã«ã®ãªãæ¹çè©ä¾¡ãé常ã«ã·ã³ãã«ã«è¨è¿°ã§ãã¾ããOffPolicyEvaluation
ã«ããªãã¼ã·ã§ã³ãã¼ã¿ã¨ä½¿ç¨ããæ¨å®éãå
¥ãã¦åæåããvisualize_off_policy_estimates_of_multiple_policies
ãå¼ã¶ã ãã§ãã
ope = OffPolicyEvaluation( bandit_feedback=validation_data, # ããªãã¼ã·ã§ã³ãã¼ã¿ ope_estimators=[IPS(estimator_name="IPS")] # 使ç¨ããæ¨å®é ) ope.visualize_off_policy_estimates_of_multiple_policies( policy_name_list=list(action_choices.keys()), action_dist_list=list(action_choices.values()), random_state=12345, fig_dir=Path('./resources/output/'), ) plt.clf()
ã¢ãã«ã®çã®æ§è½ã®è©ä¾¡
çã®æ§è½ã¯ SyntheticBanditDataset
ã® calc_ground_truth_policy_value
é¢æ°ã«ããã¹ããã¼ã¿ã®expected_reward
ã¨åææ決å®ã¢ãã«ã®åºåã渡ãã¦ãããã¨ã§è¨ç®ã§ãã¾ãã
# ç¾ç¶calc_ground_truth_policy_valueãSyntheticBanditDatasetã®instance methodã«ãªã£ã¦ããã®ã§ãSyntheticBanditDatasetãé©å½ãªåæå¤ã§instanceåãã¦ããã ground_truth_score = SyntheticBanditDataset(2).calc_ground_truth_policy_value(expected_reward=test_data['expected_reward'], action_dist=action_choice)
ã¾ã¨ã
ãã®è¨äºã§ã¯ããæ½çãã¶ã¤ã³ã®ããã®æ©æ¢°å¦ç¿å ¥éãã®å 容ããæ¶ç©ºã®ã¹ãã¼ãªã¼ãéãã¦å®è·µãã¦ã¿ã¾ãããå®éã«æãåããã¦ã¿ããã¨ã«ãã£ã¦ããã«ç解ãæ·±ãããã¨ãã§ãã¾ãããä»å¾ããã®æ¬ã§å¦ãã ãã¨ãå®åã«ãåãå ¥ãã¦ããããã§ãã
ã¾ããOpen Bandit Piplineãç¨ãã¦æ軽ã«å®é¨ãè¡ããã¨ãã§ãã¾ãããã¿ãªããããã²ä½¿ã£ã¦ã¿ã¦ãã ããã
ãã®è¨äºãèªãã æ¹ã¯ãããªè¨äºãèªãã§ãã¾ãï¼å¤åï¼
- ããã±ã¢ã³ãé¡æã«å ææ¨è«ãå®è·µãã¦ã¿ãã
- åããæè¡è©è«ç¤¾ããåºçããã¦ãããå¹ææ¤è¨¼å ¥é *9ãã®å 容ããã¹ãã¼ãªã¼å½¢å¼ã§å®è·µãã¦ãã¾ãã
- ããã±ã¢ã³ãé¡æã«ãSQLã¢ã³ããã¿ã¼ã³ããå®è·µãã¦ã¿ãã
- ãã¼ã¿ãµã¤ã¨ã³ã¹ãæ©æ¢°å¦ç¿ããã¯é¢ãã¾ããããã¡ããæ¬ã®å 容ãè¸ã¾ãã¦ã¹ãã¼ãªã¼å½¢å¼ã§å®è·µãã¦ãã¾ãã
*1:æ½çãã¶ã¤ã³ã®ããã®æ©æ¢°å¦ç¿å ¥éããã¼ã¿åææè¡ã®ãã¸ãã¹æ´»ç¨ã«ãããæ£ããèãæ¹ -- é½è¤ åªå¤ª, å®äº ç¿å¤ª
*2:ãã®è¨äºãå«ããç§ãä½åº¦ãæ¸ãã¦ãããã±ã¢ã³ã®ããã°è¨äºã¯ããããäºæ¬¡åµä½ã«ç¸å½ããã¨èããããèä½æ¨©ã«å¯¾ãã¦æ³¨æãæãå¿ è¦ãããã¾ãã任天å ã¯ã²ã¼ã å ã®åç»ãéæ¢ç»ã«å¯¾ããã¬ã¤ãã©ã¤ã³ã«ã¦ãã¬ã¤ãã©ã¤ã³ã®ç¯å²å ã§é©åãªåç»ãéæ¢ç»ã®å ±æãµã¤ãã«æ稿ãããã¨ã許å¯ãã¦ãã¾ããä¸æ¹ãæ¬ããã°è¨äºã®ãããªå½¢å¼ã®äºæ¬¡åµä½ã«å¯¾ãã¦ã¯ã任天å ããã³æ ªå¼ä¼ç¤¾ãã±ã¢ã³ããæ確ãªã¬ã¤ãã©ã¤ã³ã¯å ¬è¡¨ããã¦ããªãããã§ãããããã§ãæ¬ããã°è¨äºã¯åçæ§ãæããªããã¨ã»ãã±ã¢ã³ã貶ããæå³ã¯ãªããã¨ãæè¨ããä¸ã§ã権å©è ã«è¦æ±ãããå ´åã¯éããã«è¨äºã®å ¬éãåæ¢ãããã¨ãããã«å®£è¨ãã¾ãã
*3:ããã±ã¢ã³ã売ããã¨ã§ãéããããã¾ããã¨ãã説æãä¸çªã·ã³ãã«ã§ã¯ããã®ã§ããããã±ã¢ã³ã«å¤æ®µãã¤ãã¦å£²è²·ãããã¨ã¯ãã±ã¢ã³ã®ä¸ç観ã«åããã®ã§ãããã±ã¢ã³ç 究ã¸ã®ååéãã¨ããã¹ãã¼ãªã¼ãã²ããåºãã¾ããã
*4:æç²é£åº¦ã¯ãã±ã¢ã³Wikiã®ææçä¸è¦§ ã®å¤§å°ãé転ããããã®ãç¨ãã¦ãã¾ãã
*5:è¬ç¤¼éã®éé¡ã¯ã赤ç·éãã«ãã¥ã¦æ»ç¥ãµã¤ã ã®åè¨ç¨®æå¤ã40ã§å²ã£ã¦ãã4ä¹ãããã®ãç¨ãã¦ãã¾ããããã«ããããå¼·ããã±ã¢ã³ã»ã©è¬ç¤¼éã大ããããã¤ããã±ã¢ã³ã®ç¨®é¡ã«ãã£ã¦ãããªãã«éé¡ã«éããããããæãç«ã¤ããã«ãã¦ãã¾ãã
*6: ã®æå¾ å¤ãå ã®ç®çé¢æ° ã«ä¸è´ãããã¨ã¯åæ¸ã§ä¸å¯§ã«è§£èª¬ããã¦ãã¾ã ã
*7:ãã±ã¢ã³æç²ã®A/Bãã¹ãã£ã¦ã©ããããã§ãããããããã§ã¯ããã±ã¢ã³ã¨å¯¾é¢ãããã³ã«ã³ã¤ã³ãæãã¦ã©ã¡ãã®ã¢ãã«ãç¨ããã決ãã¦ããã¨èãã¦ãã ããã
*8:ãã ããNNPolicyLearnerã¯è¿ã ç ´å£çãªå¤æ´ãå ¥ãäºå®ããããããªã®ã§æ³¨æãã¦ãã ãããä»åç§ã¯v0.4.1ã§å®è£ ãã¾ããã
*9:å¹ææ¤è¨¼å ¥éãæ£ããæ¯è¼ã®ããã®å ææ¨è«ï¼è¨éçµæ¸å¦ã®åºç¤ -- å®äº ç¿å¤ª