èšäºã®æåŸã®ç¬¬4éšã§ã¯ãäžæ£é²æ¢ãµãŒãã¹ã®æãæè¡çã«é£ããéšåãã€ãŸãéè¡ã«ãŒãã«ããäžæ£ãªæ¯æããèªèããããã®åæã·ã¹ãã ã«ã€ããŠè©³ãã説æããŸã ã
ããŸããŸãªçš®é¡ã®è©æ¬ºã®èå¥ã¯ãæåž«ä»ãåŠç¿ã¿ã¹ã¯ã®å žåçãªã±ãŒã¹ã§ãããããæ¥çã®ãã¹ããã©ã¯ãã£ã¹ã«åŸã£ãäžæ£é²æ¢ãµãŒãã¹ã®åæéšåã¯ãæ©æ¢°åŠç¿ã¢ã«ãŽãªãºã ã䜿çšããŠæ§ç¯ãããŸãã
åã®ã¿ã¹ã¯ã§ã¯ãã¯ã©ãŠãããŒã¹ã®äºæž¬åæãµãŒãã¹ã§ããAzure Machine Learningã䜿çšããŸãã ãã®èšäºãç解ããã«ã¯ãåºæ¬çãªæ©æ¢°åŠç¿ãšAzure Machine LearningãµãŒãã¹ã®ç¥èãå¿ èŠã§ãã
ãã§ã«äœãè¡ãããŸãããïŒ ïŒåã®3ã€ã®ããŒããèªãã§ããªãããèå³ããã人åãïŒ
èšäºã®æåã®éšåã§ã¯ããªã³ã©ã€ã³æ±ºæžããéè¡ãŸã§ãé»å決æžåžå Žã®ãã¹ãŠã®åå è
ã«ãšã£ãŠè©æ¬ºæ¯æãã®åé¡ãéåžžã«æ·±å»ã§ããçç±ãšããã®ãããªã·ã¹ãã ã®éçºã³ã¹ããé«ãããããšãããäž»ãªå°é£ã«ã€ããŠèª¬æããŸããeã³ããŒã¹åžå Žã®å€ãã®åå è
ã
第2éšã§ã¯ããã®ãããªã·ã¹ãã ã«é©çšãããæè¡çèŠä»¶ãšéæè¡çèŠä»¶ ãããã³æ³šæããšã«äžæ£é²æ¢ã·ã¹ãã ã®éçºãšææã®ã³ã¹ããåæžããæ¹æ³ã«ã€ããŠèª¬æããŸããã
第3éšã§ã¯ããµãŒãã¹ã®ãœãããŠã§ã¢ã¢ãŒããã¯ã㣠ããã®ã¢ãžã¥ãŒã«æ§é ãããã³äž»èŠãªå®è£ ã®è©³çŽ°ã«ã€ããŠæ€èšããŸããã
æåŸã®ç¬¬4éšã§ã¯ã 次ã®ç®æšããããŸã...
第2éšã§ã¯ããã®ãããªã·ã¹ãã ã«é©çšãããæè¡çèŠä»¶ãšéæè¡çèŠä»¶ ãããã³æ³šæããšã«äžæ£é²æ¢ã·ã¹ãã ã®éçºãšææã®ã³ã¹ããåæžããæ¹æ³ã«ã€ããŠèª¬æããŸããã
第3éšã§ã¯ããµãŒãã¹ã®ãœãããŠã§ã¢ã¢ãŒããã¯ã㣠ããã®ã¢ãžã¥ãŒã«æ§é ãããã³äž»èŠãªå®è£ ã®è©³çŽ°ã«ã€ããŠæ€èšããŸããã
æåŸã®ç¬¬4éšã§ã¯ã 次ã®ç®æšããããŸã...
ç®ç
ãã®ããŒãã§ã¯ããããžã§ã¯ãã説æããŸããæåã®ã¹ãããã§ã¯ãããžã¹ãã£ãã¯ååž°ãããŒã»ãããã³ããµããŒããã¯ãã«æ³ãããã³æ±ºå®æšã䜿çšããŠ4ã€ã®ã¢ãã«ããã¬ãŒãã³ã°ããŸã ã ãã¬ãŒãã³ã°æžã¿ã®ã¢ãã«ããããã¹ããµã³ãã«ã®ç²ŸåºŠãé«ãããã®ãéžæãã REST / JSONãµãŒãã¹ã®åœ¢åŒã§å ¬éããŸã ã 次ã«ãåãåã£ããµãŒãã¹ã«ã€ããŠããœãããŠã§ã¢ã¯ã©ã€ã¢ã³ããäœæããRESTãµãŒãã¹ã®è² è·ãã¹ããè¡ããŸãã
ã¢ãã«äœæ
Azure ML Studioã§æ°ããå®éšãäœæããŸãã æçµçãªãã©ãŒã ã§ã¯ã次ã®å³ã«ç€ºãããã«ãªããŸãã å®éšã®åèŠçŽ ããã¢ãã«ããã¬ãŒãã³ã°ããéçšã§å¹³åçãªããŒã¿ç§åŠè ãå®è¡ããã¹ããŒãžã·ãŒã±ã³ã¹ãšé¢é£ä»ããŸãã
èšäºã®æåŸã®3éšã§èª¬æãããŠããæè¡çãªè©³çŽ°ãèæ ®ããŠãäžæ£ãªæ¯æããèªèããããã®ã¢ãã«ãäœæããå段éãæ€èšããŸãã
仮説
ã¢ãã«ã®äœæã«åœ¹ç«ã€åºæ¬çãªæŠå¿µãšåææ¡ä»¶ã«ã€ããŠã¯ãèšäºã®æåã®2éšã§èª¬æããŸããã ç¹°ãè¿ããŸãããè¯ã仮説ãäœæããããšã¯è©Šè¡é¯èª€ã®å埩ããã»ã¹ã§ããããã®åºç€ã¯ç 究察象åéãšããŒã¿ãµã€ãšã³ã¹åéã®äž¡æ¹ã®ç¥èã§ããããšã«æ³šæããŠãã ããã
ããŒã¿æ€çŽ¢
äžæ£ãªæ¯æãã®èªèã¢ãã«ã®ããŒã¿ã»ããã¯ãNoSQLã¹ãã¬ãŒãžã®2ã€ã®ããŒãã«ïŒAzureããŒãã«ïŒã§æ§æããããã©ã³ã¶ã¯ã·ã§ã³ãã°ã§ãããã©ã³ã¶ã¯ã·ã§ã³TransactionsInfoã«é¢ãããã¡ã¯ãã®ããŒãã«ãšã以åã«èšç®ãããçµ±èšã¡ããªãã¯TransactionsStatisticsãæã€ããŒãã«ã§ãã
ããŒã¿ãåä¿¡ãã段éã§ãããã2ã€ã®ããŒãã«ãReaderã³ã³ãããŒã«ããããŒãããŸãã
ããŒã¿ã®æºåãšç 究
TransactionIdãã£ãŒã«ãã«ãã£ãŠãããŒããããããŒãã«ãå éšçµåããŸãã ã¡ã¿ããŒã¿ãšãã£ã¿ãŒã³ã³ãããŒã«ã®å©ããåããŠãããŒã¿åïŒæååãæŽæ°ãã¿ã€ã ã¹ã¿ã³ãïŒã瀺ããåçïŒã©ãã«ïŒã§åãããŒã¯ããäºæž¬åïŒæ©èœïŒã§åãããŒã¯ãããã®ããŒã¿ã®ã¹ã±ãŒã«ã®ã¿ã€ãïŒåç®ã絶察ã瀺ããŸââãã
é©åãªã¢ãã«ãäœæããããã®æºåã®éèŠæ§ãéå°è©äŸ¡ããªãã§ãã ãããISOã³ãŒãïŒæŽæ°å€ïŒã®åœ¢åŒã§ä¿åãããæ¯æãé貚ã®ç°¡åãªäŸã瀺ããŸãã ISOã³ãŒã-å ¬ç§°ïŒåé¡ïŒã¹ã±ãŒã«ããããŸãã ãã ãã絶察ã¹ã±ãŒã«ã®éæŽæ°å€ãé貚åã«æ ŒçŽãããŠããããšãã·ã¹ãã ãèªåçã«å€æããããšãæåŸ ããããšã¯ã»ãšãã©ãããŸããïŒã€ãŸãã+ãŸãã¯>ãªã©ã®æäœãå¯èœã§ãïŒã ããã¯ããŸãã«ãæçœãªã«ãŒã«ã§ãããããã·ã¹ãã ãææããŠããªãç¥èã
ããŒã¿ã»ããã«æ¬ æå€ãå«ãŸããŠããå ŽåããããŸãã ç§ãã¡ã®å Žåãæ¯æ人ã®åœãŸãã¯IPã¢ãã¬ã¹ãåžžã«æ±ºå®ã§ãããšã¯éããŸããããã®ãããªãã£ãŒã«ãã«ã¯ç©ºã®å€ãå«ãŸããŠããå ŽåããããŸãã æ¢åã®ããŒã¿ã»ããã確èªããåŸã空ã®ããŒã¿ã®ã¯ãªãŒã³ã³ã³ãããŒã«ã䜿çšããŠã空ã®åœã®å€ããæªå®çŸ©ãã«çœ®ãæããŸãã åãã³ã³ãããŒã«ã䜿çšããŠãæããã«äžæ£ç¢ºãªããŒã¿ãå«ãè¡ã®ããã«ãã«ãŒãææè ãæ¯æãéé¡ããŸãã¯é貚ã«å€ãå«ãŸããŠããªãè¡ãã€ãŸãã¢ãã«ã«ãã€ãºãå°å ¥ããè¡ãåé€ããŸãã
次ã®æ®µéã§ã¯ãã¢ãã«ã§äœ¿çšãããŠããªããã£ãŒã«ããåé€ããŸãïŒäœæïŒæ¯æ人ã®åœãšèŠæ±å ã®åœã®ã¿ïŒãã«ãŒãææè åã®ããã·ã¥ïŒæ¯æãçµæã«åœ±é¿ããªãããïŒãRowIdããã³PartitionIdïŒãµãŒãã¹AzureããŒãã«ããéãããŠããããŒã¿ïŒã
çµè«ãšããŠã ããŒã¿ã®æ£èŠåã³ã³ãããŒã«ã䜿çšããŠãæ¯æãéé¡ïŒTransactionAmountåïŒãªã©ã®å€§ããªæ°å€ãå«ãããŒã¿ã®ZScoreæ£èŠåãå®è¡ããŸãã
ããŒã¿åå²
çµæã®ããŒã¿ã»ããããã¬ãŒãã³ã°ãµã³ãã«ãšãã¹ããµã³ãã«ã«åå²ããŸãã ãã¬ãŒãã³ã°ãµã³ãã«ãšãã¹ããµã³ãã«ã®ããŒã¿ã®æé©ãªæ¯çãéžæããŸãã ãã®ç®çã®ããã«ã Splitã³ã³ãããŒã«ã䜿çšããŠãå©çšå¯èœãªãã¹ãŠã®ããŒã¿ã®70ïŒ ããã¬ãŒãã³ã°ã»ããã«ãéä¿¡ãããããŒã¿ã®ãµãã»ããã«åå²ãããšãã«ã©ã³ãã ããŒã¿ã®æ··åïŒã©ã³ãã ååå²ãã©ã°ïŒãè¿œå ããŸãã åå²äžã«ããŒã¿ãæ··åããããšã«ããããã©ã¹ããã¯ã«ãŒãçªå·ã®å€§ããªæŒãã«é¢é£ãããã¬ãŒãã³ã°ãµã³ãã«ã®ãæªã¿ããåé¿ã§ããŸãïŒãã®çµæããã®æéäžã®äžæ£ããããã®ç°åžžãªåäœïŒã
ã¢ãã«ã®æ§ç¯ãšè©äŸ¡
ããã€ãã®åé¡ã¢ã«ãŽãªãºã ãåæåãããã¹ããµã³ãã«ã§æé©ãªçµæïŒç²ŸåºŠïŒãäžããã¢ã«ãŽãªãºã ãæ¯èŒããŸãã å®éã®ããŒã¿ã§ãã¹ãããŒã¿ãšåãããã©ãŒãã³ã¹ãéæããããšããäºå®ã§ã¯ãªãããšã«æ³šæããããšãéèŠã§ãã ãããã£ãŠãã¢ã«ãŽãªãºã ã®1ã€ãå€§å¹ ã«æªããŸãã¯è¯ãçµæãäžãããšã©ãŒãä¿®æ£ããåŠç¿ã¢ã«ãŽãªãºã ãåã³éå§ããçç±ãã¢ãã«ãèæ ®ããŠããªãããšãç解ããããšãéåžžã«éèŠã§ãã ãã®ããã»ã¹ã¯ãç 究è ã粟床ã®èš±å®¹å¯èœãªã¢ãã«ãåãåããšçµäºããŸãã
Azure MLã䜿çšãããšã1ã€ã®å®éšã§ç¡å¶éã®æ°ã®æ©æ¢°åŠç¿ã¢ã«ãŽãªãºã ãæ¥ç¶ã§ããŸãã ããã«ãããç 究段éã§ããã€ãã®ã¢ã«ãŽãªãºã ã®ããã©ãŒãã³ã¹ãæ¯èŒããŠãã©ã®ã¢ã«ãŽãªãºã ãç§ãã¡ã®ã¿ã¹ã¯ã«æé©ã§ããããç¹å®ããããšãã§ããŸãã å®éšã§ã¯ã2ã¯ã©ã¹ã®åé¡ã¢ã«ãŽãªãºã ã䜿çšããŸãïŒ 2ã¯ã©ã¹ããžã¹ãã£ãã¯ååž° ïŒããžã¹ãã£ãã¯ååž°ïŒã 2ã¯ã©ã¹ããŒã¹ããã£ã·ãžã§ã³ããªãŒ ïŒåŸé æé·æ³ã䜿çšããŠæ§ç¯ããã決å®ããªãŒïŒã 2ã¯ã©ã¹ãµããŒããã¯ã¿ãŒãã·ã³ ïŒãµããŒããã¯ãã«æ³ïŒã ã¯ã©ã¹ãã¥ãŒã©ã«ãããã¯ãŒã¯ ã
æé©ãªã¢ãã«ããã©ãŒãã³ã¹ãåŸããã1ã€ã®æ©äŒã¯ãã¢ã«ãŽãªãºã ã®èª¿æŽã«äœ¿çšã§ããå€æ°ã®ãã©ã¡ãŒã¿ãŒã䜿çšããŠæ©æ¢°åŠç¿ã¢ã«ãŽãªãºã ã調æŽããããšã§ãã ãã®ããã2ã¯ã©ã¹ããŒã¹ããã£ã·ãžã§ã³ããªãŒã¢ã«ãŽãªãºã ã§ã¯ãæ§ç¯ãããããªãŒã®æ°ãšãåããªãŒã®ãªãŒãã®æå°/æ倧æ°ã瀺ãããŸããã 2ã¯ã©ã¹ãã¥ãŒã©ã«ãããã¯ãŒã¯ã¢ã«ãŽãªãºã ã®å Žåãé ãããŒãã®æ°ããã¬ãŒãã³ã°ã®ç¹°ãè¿ããããã³åæéã¿ã
æåŸã®æ®µéã§ã¯ãåã¢ã«ãŽãªãºã ã®ã¢ãã«è©äŸ¡ã³ã³ãããŒã«ïŒèŠçŽ ã®ã³ã³ããã¹ãã¡ãã¥ãŒããã®èŠèŠåã³ãã³ãïŒã®åºåã確èªããŸãã
Evaluate Modelã³ã³ãããŒã«ã«ã¯ãæ··åãããªãã¯ã¹ã 粟床ã粟床ããªã³ãŒã«ãF1ã¹ã³ã¢ ãAUCãROCãããã³ç²ŸåºŠ/ãªã³ãŒã«ãã£ãŒãã®èšç®ããã粟床ã¡ããªãã¯ãå«ãŸããŠããŸãã ç°¡åã«èšãã°ã粟床ãšç²ŸåºŠãAUCå€ã1ã«è¿ãã¢ã«ãŽãªãºã ãéžæããŸããROCã°ã©ãã¯ããã¬ãŒãã³ã°ãµã³ãã«ãšãã¹ããµã³ãã«ã®äž¡æ¹ã§Y軞ã«åãã£ãŠããå¹ã«ãªã£ãŠããŸãã
ããã«ãèšå®ããããããå€ã«å¿ããŠAUCã®å€åã確èªããããšã¯ã§ããŸããã è©æ¬ºã®å Žåãããã¯éèŠã§ããèªèãããŠããªãäžæ£ãªæ¯æãã®ã³ã¹ãïŒ False Positive ïŒã¯ã誀ã£ãŠè©æ¬ºãšããŠåãå ¥ããããæ¯æãïŒ False Negative ïŒãããã¯ããã«é«ãããã§ãã
ãã®ãããªå Žåãããã©ã«ãå€ã®0.5以å€ã®ãããå€ãéžæããå¿ èŠããããŸãã
ãããå€ã¬ãã«ã«å ããŠãæé©ãªäžæ£èªèã¢ãã«ãååŸããããã®æé©ãªã¢ã«ãŽãªãºã ãéžæããéã«ã¯ãäžéšã®ã¢ã«ãŽãªãºã ïŒæ±ºå®ããªãŒãªã©ïŒã®æ±ºå®ããžãã¯ã¯åçŸã§ããããäžéšã®ã¢ã«ãŽãªãºã ã§ã¯åçŸã§ããªãïŒããŒã»ãããã³ïŒãšããäºå®ãèæ ®ããŸãã ç¹å®ã®åäŸã«åŸã£ãŠãã·ã¹ãã ãç¹å®ã®æ±ºå®ãäžããçç±ãç¥ãããšãéèŠã§ããå Žåããã®ãããªæ©äŒã®ååšã¯éèŠã§ãã
æé«ã®ç²ŸåºŠã¯ã2ã¯ã©ã¹ãã¥ãŒã©ã«ãããã¯ãŒã¯ã®ã¢ã«ãŽãªãºã -2ã¯ã©ã¹ãã¥ãŒã©ã«ãããã¯ãŒã¯ïŒç²ŸåºŠã€ã³ãžã±ãŒã¿ã¯äžã®å³ã«ç€ºãããŠããŸãïŒã«ãã£ãŠç€ºããããã®åŸã«æ±ºå®æšã«åºã¥ãã¢ã«ãŽãªãºã -2ã¯ã©ã¹ããŒã¹ã決å®æšãç¶ããŸãã
ã¢ãã«ãWebãµãŒãã¹ãšããŠå
¬éãã
å¿ èŠãªç²ŸåºŠã§æ©èœããã¢ãã«ãååŸããããå®éšãWebãµãŒãã¹ãšããŠå ¬éããŸãã çºè¡æäœã¯ãAzure ML Studioã®[ WebãµãŒãã¹ã®çºè¡ ]ãã¿ã³ãã¯ãªãã¯ããŠå®è¡ãããŸãã å®éšããWebãµãŒãã¹ãäœæããããã»ã¹ã¯ç°¡åãªã®ã§ããã®èª¬æã¯çç¥ããŸãã
ãã®çµæãAzure MLã¯ã¹ã±ãŒã©ãã«ã§ãã©ãŒã«ããã¬ã©ã³ããªïŒSLA 99.95ïŒ ïŒWebãµãŒãã¹ããããã€ããŸãã ãµãŒãã¹ã®å ¬éåŸãAPIãã«ãããã¥ã¡ã³ãããŒãžãå©çšå¯èœã«ãªããŸã-APIãã«ãã«ã¯ããµãŒãã¹ã®äžè¬çãªèª¬æã«å ããŠãäºæ³ãããå ¥åºåã¡ãã»ãŒãžã®åœ¢åŒã®èª¬æã«å ããŠãCïŒãPythonãããã³Rã§ãµãŒãã¹ãåŒã³åºãäŸãå«ãŸããŠããŸã
ãœãããŠã§ã¢ã¯ã©ã€ã¢ã³ãã«ãããµãŒãã¹ã®åŒã³åºãã®åçã¯ã次ã®ããã«è¡šãããšãã§ããŸãã
Azure ML WebãµãŒãã¹ã«æ¥ç¶ãã
ãã«ãAPIããCïŒã®äŸãåãäžããå°ãå€æŽããŠãAzure ML WebãµãŒãã¹ãåŒã³åºããŸãã
ãªã¹ã1. Azure ML WebãµãŒãã¹ãåŒã³åºã
private async Task<RequestStatistics> InvokePredictorService(TransactionInfo transactionInfo, TransactionStatistics transactionStatistics) { Contract.Requires<ArgumentNullException>(transactionInfo != null); Contract.Requires<ArgumentNullException>(transactionStatistics != null); var statistics = new RequestStatistics(); var watch = new Stopwatch(); using (var client = new HttpClient()) { var scoreRequest = new { Inputs = new Dictionary<string, StringTable>() { { "transactionInfo", new StringTable() { ColumnNames = new [] { #region Column name list }, Values = new [,] { { #region Column value list } } } }, }, GlobalParameters = new Dictionary<string, string>() }; client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", ConfigurationManager.AppSettings["FraudPredictorML:ServiceApiKey"]); client.BaseAddress = new Uri("https://ussouthcentral.services.azureml.net/workspaces/<workspace_id>/services/<service_id>/execute?api-version=2.0&details=true"); watch.Start(); HttpResponseMessage response = await client.PostAsJsonAsync("", scoreRequest); if (response.IsSuccessStatusCode) await response.Content.ReadAsStringAsync(); statistics.TimeToResponse = watch.Elapsed; statistics.ResponseStatusCode = response.StatusCode; watch.Stop(); } return statistics; }
次ã®ãªã¯ãšã¹ã/ã¬ã¹ãã³ã¹ãååŸããŸãã
ãªã¹ã2.1ã Azure ML WebãµãŒãã¹ãªã¯ãšã¹ã
POST https://ussouthcentral.services.azureml.net/workspaces/<workspace_id>/services/<service_id>/execute?api-version=2.0&details=true HTTP/1.1 Authorization: Bearer <api key> Content-Type: application/json; charset=utf-8 Host: ussouthcentral.services.azureml.net /* */ { "Inputs": { "transactionInfo": { "ColumnNames": [ "PartitionKey", "RowKey", "Timestamp", "CardId", "CrmAccountId", "MCC", "MerchantId", "TransactionAmount", "TransactionCreatedTime", "TransactionCurrency", "TransactionId", "TransactionResult", "CardExpirationDate", "CardholderName", "CrmAccountFullName", "TransactionRequestHost", "PartitionKey (2)", "RowKey (2)", "Timestamp (2)", "CardsCountFromThisCrmAccount1D", "CardsCountFromThisCrmAccount1H", "CardsCountFromThisCrmAccount1M", "CardsCountFromThisCrmAccount1S", "CardsCountFromThisHost1D", "CrmAccountsCountFromThisCard1D", "FailedPaymentsCountByThisCard1D", "SecondsPassedFromPreviousPaymentByThisCard1D", "PaymentsCountByThisCard1D", "HostsCountFromThisCard1D", "HasHumanEmail", "HasHumanPhone", "IsCardholderNameIsTheSameAsCrmAccountName", "IsRequestCountryIsTheSameAsCrmAccountCountry", "TransactionDayOfWeek", "TransactionLocalTimeOfDay" /* */ ], "Values": [ [ "990", "f31f64f367644b1cb173a48a34817fbc", "2015-03-15T20:54:28.6508575Z", "349567471", "10145", "32", "990", "136.69", "2015-03-15T20:54:28.6508575Z", "840", "f31f64f367644b1cb173a48a34817fbc", null, "2015-04-15T23:44:28.6508575+03:00", "640ab2bae07bedc4c163f679a746f7ab7fb5d1fa", "640ab2bae07bedc4c163f679a746f7ab7fb5d1fa", "20.30.30.40", "990", "f31f64f367644b1cb173a48a34817fbc", "2015-03-15T20:54:28.6508575Z", "2", "1", "0", "0", "0", "0", "1", "2", "0", "0", "true", null, "true", "true", "Monday", "Morning" /* */ ] ] } }, "GlobalParameters": { } }
ãªã¹ã2.2ã Azure ML WebãµãŒãã¹ã®å¿ç
HTTP/1.1 200 OK Content-Length: 1619 Content-Type: application/json; charset=utf-8 Server: Microsoft-HTTPAPI/2.0 x-ms-request-id: f8cb48b8-6bb5-4813-a8e9-5baffaf49e15 Date: Sun, 15 Mar 2015 20:44:31 GMT { "Results": { "transactionPrediction": { "type": "table", "value": { "ColumnNames": [ "PartitionKey", "RowKey", "Timestamp", "CardId", "CrmAccountId", "MCC", "MerchantId", "TransactionAmount", "TransactionCreatedTime", "TransactionCurrency", "TransactionId", /* */ "Scored Labels", "Scored Probabilities" ], "Values": [ [ "990", "f31f64f367644b1cb173a48a34817fbc", "2015-03-15T20:54:28.6508575Z", "349567471", "10145", "32", "990", "136.69", "2015-03-15T20:54:28.6508575Z", "840", "f31f64f367644b1cb173a48a34817fbc", /* */ "Success", "0.779961256980896" ] ] } } } }
è² è·è©Šéš
è² è·ãã¹ãã®ç®çã§ãAzure IaaSæ©èœã䜿çšããŸããåãå°åïŒç±³åœäžåéšïŒã§ä»®æ³ãã·ã³ïŒã€ã³ã¹ã¿ã³ã¹A8ïŒCPU 8åã56Gb RAMã40Gbit / s InfiniBandãWindows Server 2012 R2ã$ 2.45 /æéïŒãçºçãããŸãã Azure ML WebãµãŒãã¹ã VMã§ã20Kã¯ãšãªã§ã¿ã¹ã¯ãå®è¡ããçµæã確èªããŸãã
ãªã¹ã3.ãµãŒãã¹ã¯ã©ã€ã¢ã³ãã®ã³ãŒããšã¿ã¹ã¯
/// <summary> /// Entry point /// </summary> public void Main() { var client = new FraudPredictorMLClient(); RequestsStatistics invokeParallelStatistics = client.InvokeParallel(1024, 22); LogResult(invokeParallelStatistics); RequestsStatistics invokeAsyncStatistics = client.InvokeAsync(1024).Result; LogResult(invokeAsyncStatistics); } private static void LogResult(RequestsStatistics statistics) { Contract.Requires<ArgumentNullException>(statistics != null); Func<double, string> format = d => d.ToString("F3"); Log.Info("Results:"); Log.Info("Min: {0} ms", format(statistics.Min)); Log.Info("Average: {0} ms", format(statistics.Average)); Log.Info("Max: {0} ms", format(statistics.Max)); Log.Info("Count of failed requests: {0}", statistics.FailedRequestsCount); } /// <summary> /// Client for FraudPredictorML web-service /// </summary> public class FraudPredictorMLClient { /// <summary> /// Async invocation of method /// </summary> /// <param name="merchantId">Merchant id</param> /// <exception cref="ArgumentOutOfRangeException"><paramref name="merchantId"/></exception> public async Task<RequestsStatistics> InvokeAsync(int merchantId) { Contract.Requires<ArgumentOutOfRangeException>(merchantId > 0); IEnumerable<TransactionInfo> tis = null; IEnumerable<TransactionStatistics> tss = null; // upload input data Parallel.Invoke( () => tis = new TransactionsInfoRepository().Get(merchantId), () => tss = new TransactionsStatisticsRepository().Get(merchantId) ); var inputs = tis .Join(tss, ti => ti.TransactionId, ts => ts.TransactionId, (ti, ts) => new { TransactionInfo = ti, TransactionStatistics = ts }) .ToList(); // send requests var statistics = new List<RequestStatistics>(inputs.Count); foreach (var input in inputs) { RequestStatistics stats = await InvokePredictorService(input.TransactionInfo, input.TransactionStatistics).ConfigureAwait(false); statistics.Add(stats); } // return result return new RequestsStatistics(statistics); } /// <summary> /// Parallel invocation of method (for load testing purposes) /// </summary> /// <param name="merchantId">Merchant id</param> /// <param name="degreeOfParallelism">Count of parallel requests</param> /// <exception cref="ArgumentOutOfRangeException"><paramref name="merchantId"/></exception> /// <exception cref="ArgumentOutOfRangeException"><paramref name="merchantId"/></exception> public RequestsStatistics InvokeParallel(int merchantId, int degreeOfParallelism) { Contract.Requires<ArgumentOutOfRangeException>(merchantId > 0); Contract.Requires<ArgumentOutOfRangeException>(degreeOfParallelism > 0); IEnumerable<TransactionInfo> tis = null; IEnumerable<TransactionStatistics> tss = null; // upload input data Parallel.Invoke( () => tis = new TransactionsInfoRepository().Get(merchantId), () => tss = new TransactionsStatisticsRepository().Get(merchantId) ); var inputs = tis .Join(tss, ti => ti.TransactionId, ts => ts.TransactionId, (ti, ts) => new { TransactionInfo = ti, TransactionStatistics = ts }) .ToList(); // send requests var statistics = new List<RequestStatistics>(inputs.Count); for (int i = 0; i < inputs.Count; i = i + degreeOfParallelism) { var tasks = new List<Task<RequestStatistics>>(); for (int j = i; j < i + degreeOfParallelism; j++) { if (inputs.Count <= j) break; var input = inputs[j]; tasks.Add(InvokePredictorService(input.TransactionInfo, input.TransactionStatistics)); } Task.WaitAll(tasks.ToArray()); statistics.AddRange(tasks.Select(t => t.Result)); } // return result return new RequestsStatistics(statistics); } /* other members */ }
InvokeParallelïŒïŒåŒã³åºãïŒ
æè¯ã®å¿çæéïŒ421.683ããªç§
ææªæéïŒ1355.516ããªç§
å¹³åæéïŒ652.935ããªç§
æåãããªã¯ãšã¹ãã®æ°ïŒ20061
çŽåž°çã®æ°ïŒ956
InvokeAsyncïŒïŒåŒã³åºãïŒ
æè¯ã®å¿çæéïŒ478.102ããªç§
ææªæéïŒ1344.348ããªç§
å¹³åæéïŒ605.911ããªç§
æåãããªã¯ãšã¹ãã®æ°ïŒ21017
é害ã®æ°ïŒ0
å¶éïŒæœåšçïŒ
äžèŠãããšãããéçºäžã®ã·ã¹ãã ã®ããã«ããã¯ã¯Azure MLã«ãªããŸãã ãããã£ãŠãAzure MLã®äžè¬çãªå¶éãç¹ã«Azure ML WebãµãŒãã¹ã®å¶éãç解ããããšãäžå¯æ¬ ã§ãã ãããããã®åé¡ã«ã€ããŠã¯ãå ¬åŒããã¥ã¡ã³ããã»ãšãã©ãªããã³ãã¥ããã£ããåãåã£ãçµæããããŸããã
ãããã£ãŠãAzure ML WebãµãŒãã¹ã®ãšã³ããã€ã³ãã®ã¹ãããã«ããªã·ãŒã«ã¯çåãæ®ããŸã.Azure ML WebãµãŒãã¹ãžã®äžŠåãªã¯ãšã¹ãã®æ倧å€ïŒ1ã€ã®ãšã³ããã€ã³ããžã®20ã®äžŠåãªã¯ãšã¹ãã®æ°ãçµéšçã«æ€èšŒïŒãããã³åä¿¡ã¡ãã»ãŒãžã®æ倧ãµã€ãºïŒãããã¢ãŒãã«é¢é£ïŒã¯æ確ã§ã¯ãããŸãããµãŒãã¹äœæ¥ïŒã
é¢é£æ§ã¯äœãã§ããã質åã¯å ¥åããŒã¿ã®æ倧ãµã€ãºïŒCriteo Labsã1 TBã®ããŒã¿ã®ããŒã¿ã»ãããæçš¿ããŸããïŒãAzure MLã®æ©æ¢°åŠç¿ã¢ã«ãŽãªãºã ã«å ¥åã§ããäºæž¬åãšãŠãŒã¹ã±ãŒã¹ã®æ倧æ°ã§ãã
FraudPredictorML WebãµãŒãã¹ã®å¿çæéãããã³ã¢ãã«ãæå°å€ã«åãã¬ãŒãã³ã°ããæéãççž®ããããšã¯éèŠã§ããããããè¡ãæ¹æ³ã«é¢ããå ¬åŒã®æšå¥šäºé ã¯ãããŸã§ã®ãšãããããŸããïŒãããŠããã¯ãŸã£ããå¯èœã§ãïŒã
顧客ãžã®æèš
è©æ¬ºé²æ¢ãµãŒãã¹ã¯ãæ¯æãã®äºå確èªãšããã®åŸã®äºæž¬çµæã®è§£éã®äž¡æ¹ã«ãããŠããããªãæ¹æ³ã§ã顧客ãå¶éããŸããã ããžãã¹ããã»ã¹ã«åºæã®äºåãã§ãã¯ãããã³æ¯æãã®åãå ¥ã/æåŠã«é¢ããæçµæ±ºå®ã¯ãæããã«äžæ£é²æ¢ãµãŒãã¹ã®è²¬ä»»ãè¶ ããã¿ã¹ã¯ã§ãã
ã¯ã©ã€ã¢ã³ãã®åœ¹å²ïŒãªã³ã©ã€ã³ã¹ãã¢ãæ¯æãã·ã¹ãã ãéè¡ïŒã«é¢ä¿ãªããã¯ã©ã€ã¢ã³ãã«ã¯æ¬¡ã®æšå¥šäºé ããããŸãã
- æ¥çã§èªããããŠããæè¡ïŒæçŽãªã©ïŒã䜿çšããã¯ã©ã€ã¢ã³ãã«é¢ããç¬èªã®ç¥èïŒæ³šæå±¥æŽãªã©ïŒã䜿çšããŠãæ¯æãã®äºåãã§ãã¯ãå®è¡ããŸãã
- 次ã®ãã©ã¯ãã£ã¹ã䜿çšããŠçµæã解éããŸãã0.35æªæºã®äžæ£ç¢ºç-3D-Secureãªãã§æ¯æããåãå
¥ããã0.35ã0.85ã®ç¢ºç-3DSãæå¹ã«ããŠæ¯æããåãå
¥ãããäžæ£ç¢ºç-ããã«æåŠãã
- ç¬èªã®åæã«åºã¥ããŠåã®æ®µèœã§ææ¡ãããã¬ãã«ãéžæããå®æçã«ã¬ãã¥ãŒããŸãïŒå©çã®æ倱ãšäžæ£è¡çºã®ããã«ãã£ãæå°éã«æããŸãïŒã
ã³ã¡ã³ãè
ãžã®æšå¥šäºé
ãã®äžé£ã®èšäºã®äžç°ãšããŠãåé¡ã®æ³çãæ³çãæè¡çãªåŽé¢ãæ±ããŸããã ããã¯æè¡çãªèšäºã§ãããããžãã¹ãã©ã³ã®äœæã競åä»ç€Ÿã®æ±ºå®ãšã®æ¯èŒããããžã§ã¯ãã®å²åŒã³ã¹ãã®èšç®ãç®çãšãããã®ã§ã¯ãããŸãã ã ããããã¹ãŠã®è³ªå㧠RBC㧠-ç§ã«ãããã®ããã«ãããããŠãã®ãµã€ãã«ãããçãããããŸãã
ãããã«
ãã®4ã€ã®ã·ãªãŒãºã®èšäºã§ã¯ãå€éšãœãããŠã§ã¢ã¯ã©ã€ã¢ã³ãçšã®ãªãŒãã³REST / JSON APIã䜿çšããŠãã»ãŒãªã¢ã«ã¿ã€ã ã¢ãŒãã§åäœããã ã¹ã±ãŒã©ãã«ã§ãã©ãŒã«ããã¬ã©ã³ãã§ä¿¡é Œæ§ã®é«ãäžæ£é²æ¢ãµãŒãã¹ãèšèšããã³éçºããããã®å®éšãè¡ããŸããã
æ©æ¢°åŠç¿ã¢ã«ãŽãªãºã ïŒæ±ºå®æšããã¥ãŒã©ã«ãããã¯ãŒã¯ïŒã䜿çšããããšã§ ãèç©ãããå±¥æŽãšæ°ããæ¯æãã®äž¡æ¹ã«ã€ããŠèªå·±åŠç¿ã§ããåæã·ã¹ãã ãäœæããããšãã§ããŸããã PaaSãµãŒãã¹/ IaaSãµãŒãã¹ã䜿çšãããããã§ã ã€ã³ãã©ã¹ãã©ã¯ãã£ãšãœãããŠã§ã¢ã®åæ財åã³ã¹ããã»ãŒãŒãã«åæžããããšãã§ããŸãã ã ãµããžã§ã¯ãé åãããŒã¿ãµã€ãšã³ã¹ãããã³åæ£ã·ã¹ãã ã®ã¢ãŒããã¯ãã£ã«ãããéçºè ã®èœå ã¯ãéçºããŒã ã®åå è æ°ãåçã«åæžããã®ã«åœ¹ç«ã¡ãŸããã
ãã®çµæã60人ææªæºã§åæã€ã³ãã©ã¹ãã©ã¯ãã£ã³ã¹ããæå°éã«æãïŒMSDNãµãã¹ã¯ãªãã·ã§ã³ã§ã«ããŒãããŠãã150ãã«æªæºïŒãã³ã¢è©æ¬ºé²æ¢ã·ã¹ãã ãäœæããããšãã§ããŸããã
ãã¡ãããçµæãšããŠçãããµãŒãã¹ã«ã¯ãã¡ã€ã³ã¢ãžã¥ãŒã«ã®åŸ¹åºçãªãã§ãã¯ïŒããã³ãã®åŸã®ä¿®æ£ïŒãåé¡åã®åŸ®èª¿æŽãäžé£ã®è£å©ãµãã·ã¹ãã ã®éçºãé¢å¿ãããã³ïŒæ£çŽãªãšããïŒæè³ãå¿ èŠã§ãã ããããäžèšã®æ¬ ç¹ã«ããããããããµãŒãã¹ã¯ãéçºã³ã¹ããšææã³ã¹ãã®äž¡æ¹ã®é¢ã§ãæ¥çã®åæ§ã®éçºãããã¯ããã«å¹ççã§ã ã
èšäºã®ä»ã®éšå
äžæãªç¹ãããå Žåã¯ãåé¡ã¯äœã§ãã ïŒããŒã1ïŒã
è©æ¬ºåé¡ã®çç±ãèŠéããªãã£ãå Žå
ãœãããŠã§ã¢ã¢ãŒããã¯ãã£ã®èŠ³ç¹ããã©ã®ããã«èŠãããã«èå³ãããå ŽåïŒããŒã3ïŒã
ããããªãŒããããã
建ç¯å®¶ãéçºè ãæ奜家ããããŸã¬ç 究è ãã³ãŒããŒå¥œã