ãã®è¨äºã¯ãèªç¶è¨èªå¦ç Advent Calendar 2019ã®16æ¥ç®ã®è¨äºã§ãã
https://qiita.com/advent-calendar/2019/nlp
ãã®è¨äºã§ã¯ãç§ãå¤ããLuminosoã¨ããä¼ç¤¾åã³ãã®æè¡ãããã§ç§ãã©ã®ãããªä»äºããã¦ããããã¨ãããã¨ãç´¹ä»ãã¾ãã
ã©ããªä¼ç¤¾ãªã®ï¼
ã¢ã³ã±ã¼ããå£ã³ããªã©ã®ãã¼ã¿ã解æãã¦é¡§å®¢ã®å£°ãå¾æ¥å¡ã®å£°ã解æããããæ¥åå ±åæ¸ãªã©ã解æãã¦ããã¾ãæ¤ç´¢ãè¡ããããªãµã¼ãã¹ãæä¾ãããã¹ãã³çºã®MITã¹ãã³ã¢ã¦ãã®ã¹ã¿ã¼ãã¢ããã§ãã
ããå°ãNLPã®æè¡è åãã«èª¬æããã¨ãã»ãã³ãã£ãã¯è¾æ¸ã«åºã¥ãã¦è£æ£ããã¯ã¼ãã¨ã³ããã£ã³ã°ãã¯ãã«ã¢ãã«ãããã¡ã¤ã³ãã¼ã¿ã§fine-tuningãããã¨ã§ãå°éã®ãã¼ã¿ã§åå¦çè¾¼ã§ã¦ã¼ã¶æ¯ã®ã¢ãã«ãé«éã«ä½æãããµã¼ãã¹ãæä¾ãã¦ããä¼ç¤¾ã§ãã
ä½ããã£ã¦ããã®ï¼
ã½ãªã¥ã¼ã·ã§ã³ã¢ã¼ããã¯ãã¨ãã¦ãä¼ç¤¾è£½åã®æ´»ç¨ã«ã¤ãã¦ã³ã³ãµã«ãã£ã³ã°ããããåºåçµæãæ´»ç¨ãããã¼ã«ãéçºãã¦ã客æ§ã«æä¾ããããã¦ãã¾ãã
èªç¤¾ã¯ã¼ãã¨ã³ããã£ã³ã°ã¢ãã«ã®æ¦è¦
ConceptNet ã¨ããã人éã®å¸¸èãèç©ãããªã¼ãã³ãã¬ãã¸ã°ã©ããã»ãã³ãã£ãã¯è¾æ¸ã¨ãã¦ãå¾æ¥ææ³ã«ãã£ã¦ä½æãããã¯ã¼ãã¨ã³ããã£ã³ã°ã¢ãã«ã«ã¬ãããã£ããã£ã³ã°ããã¤ã¢ã¹é¤å»ãªã©ãé©ç¨ãã¦ä½æãããªã¼ãã³ãã¼ã¿ã®ã¯ã¼ãã¨ã³ããã£ã³ã°ã¢ãã«ã ConceptNet-Numberbatch ããã¼ã¹ã¨ãã¦ãã¾ãã
詳細ã¯ãã®ãããªã®ãã®ãããã観ã¦ãã ããã
https://youtu.be/IEZxMhm1kV0?t=1289
ã¯ã¼ãã¨ã³ããã£ã³ã°ã«ã¤ãã¦ã¯ãã®ã¢ããã³ãã«ã¬ã³ãã¼ã®èªè ã®ã»ã¨ãã©ã«ã¯æ¢ç¥ã®è©±ã ã¨æãã®ã§çç¥ãã¾ãã
ConceptNetã¯ã人éä¸çã«ããã常èããã¬ãã¸ã°ã©ãã¨ãã¦éç©ãããªã¼ãã³ãã¼ã¿ã§ããä¾ãã°ããããããã¯ãæç©ãã®é¡åã®ä¸ã¤ã§ãããã赤ãããã赤ã¾ãã¯ç·ãã¨ããè¦ç´ ãæã¡ããðãã¨ããè¨å·ã§è¡¨ãããããªã©ã§ãã
ConceptNetã¯å
¬éWebãµã¤ãã§èª°ã§ã試ããã¨ãã§ãã¾ãããããã®ä¾ã¯ä»¥ä¸ã®URLããã¢ã¯ã»ã¹ãã¦ç¢ºèªãããã¨ãã§ãã¾ãã
http://conceptnet.io/c/ja/%E3%82%8A%E3%82%93%E3%81%94
ã¬ãããã£ããã£ã³ã°(Retrofitting)ã¨ããã®ã¯ãã¯ã¼ãã¨ã³ããã£ã³ã°ã¢ãã«ãã»ãã³ãã£ãã¯è¾æ¸ã使ã£ã¦æå³çãªæ å ±ã«åºã¥ãã¦è£æ£ããããã¨ããææ³ã§ããä¾ãã°ããå®è¡ãã¨ãå®æ½ãã¯é¡ç¾©èªã®é¢ä¿ã«ããã®ã§ããã¼ã¿ã½ã¼ã¹ã«ããã¦æèä¸ä½ãé¢ä¿ããªãã£ãã¨ãã¦ããã¯ãã«ã®è·é¢ãè¿ã¥ããããªã©ã§ãã
ãã¤ã¢ã¹é¤å»ã¨ããã®ã¯ãå ãã¼ã¿ã«åå¨ããæ§ã ãªåè¦ãé¤å»ããããã®ææ³ã§ããä¾ãã°ãããå½ã«ããããã¤ããªãã£ããã¬ãã£ããªåèªã¨çµã³ã¤ãã¨ããã®ã¯ãã¤ã¢ã¹ã®ä¸ã¤ãªã®ã§ãããã®é¤å»ãè¡ãã¾ãã
ãããã¦ä½æããããã®ã ConceptNet-Numberbatch ã§ãåºåçµæã®ã¢ãã«ã¯GitHubä¸ã§å
¬éããã¦ãã¾ãã
https://github.com/commonsense/conceptnet-numberbatch
製åçã¯ããããããã«æ¡å¼µãã¦ãã¦ããã¡ã¤ã³ãã¼ã¿ãåãè¾¼ãã å¾ãåå¦çãèªåã§å®æ½ããå¾ã«fine-tuningãã¦ãã¡ã¤ã³æ¯ã®ã¢ãã«ãä½æãã¾ãã
ã©ãããã¡ãªãããããã®ï¼
æ°åè¡ã®ãã¼ã¿ã§ãè¾æ¸ä½æãåå¦çãããã«ãé常ã«å°ããè¨ç®ãªã½ã¼ã¹ããå©ç¨ãã(GPUã使ããªã)ãæ°åããæ°ååã¨ããåä½ã§ãã¯ãã«ã¢ãã«ãä½æã§ãã¾ãã
æ大ã®ã¡ãªããã¯ãæªç¥èªã表è¨ãããç¥èªãªã©ã«é常ã«å¼·ãã¨ãããã¨ã§ãããã¨ãã°ãèªç¶è¨èªãã¨ãNLPãã¯ãé©åãªä¾æããç¨æã§ããã°è¾æ¸ããªãã¦ã容æã«é¡ç¾©èªã ã¨è¦åãããã¨ãã§ããã§ãããã社å ã®å°éç¨èªããä»ã®ã©ã®ç¨èªã¨æå³çã«é¢é£ãæ·±ããã¨ãããã¨ãè¦åãããã¨ãã§ããããã«ãªãã¾ãã
éã®å¼¾ä¸¸ãªã®ï¼
æ®å¿µãªããããã¯çãããã¾ããã
skip-gram ã¢ãã«ã«ãã£ã¦åºç¤ã¨ãªãåèªãã¯ãã«ãä½æãã¦ãã以ä¸ãåèªã®åºç¾é çªã大ããå½±é¿ãã¾ãããã®ããããã³ãã¬ã¼ãæã«é常ã«å¼±ãã¨ããç¹å¾´ãããã¾ããããã¤ããä¸è©±ã«ãªã£ã¦ããã¾ãããã¨ããæç« ãç¹°ãè¿ãåºç¾ããã ãã§ãããã¤ããã¨ããä¸è©±ããé常ã«é¢é£ãé«ãã¨è§£éãã¦ãã¾ãã§ãããã
æåä½ã§ã®è§£æããè¡ããªãããããã©ã°ã©ãåä½ãç« åä½ãªã©ã®å¤§ããªåä½ã®ã¡ã¿æ
å ±ãèæ
®ã§ããªãã¨ããåé¡ãããã¾ããããããããããé·æã解æãããã¨ãããã¼ãºã¯ãããããè²ã
ãªå·¥å¤«ããã¦ã客æ§ã«ãæä¾ãã¦ãã¾ãã(æ¥åã«æ·±ãé¢ãã話ãªã®ã§ãã®è¾ºã¯çç¥)
ã©ããã£ã¦ä»äºããã¦ããã®ï¼
ç§ã¯ãæ¥åã¨ãã¦ã¯NLPãæ±ãã¨ã³ã¸ãã¢ã§ã¯ããã¾ãããè¾æ¸ä½æãã¢ãã«ä½æãå ¨ããã¦ãã¾ãããã²ããããã¯ãã«ãæ±ãç¶ãã¾ãã ELMo ã BERT ã¨ãã£ãæµè¡ãã®æè¡ãå ¨ãæ±ãã¾ããã
æ±ãã©ã¤ãã©ãªã¯ã»ã¼ pandas 㨠numpy ã§ãã
ãã¨ãã°ä¸çªé«é »åº¦ã«å®æ½ããå¦çã¯ããããç©ãåããã¨ã«ãããã¯ãã«ã®è·é¢è¨ç®ã§ããããã¯ãã®ã¾ã¾é¡ä¼¼åº¦ã«ä½¿ããã¨ãã§ããããããã®çµæããã¨ã«æ§ã
ãªå¦çã«å¿ç¨ã§ãã¾ãã
ãã³ãã¬ã¼ãã®åé¤ãªã©ãç¾å ´ã§ã¯çµå±ã®ã¨ããåå¦çãå¿ è¦ã«ãªãã¾ããä¸è¦ãªãã³ãã¬ã¼ãæã®åé¤ãªã©ã®å¦çãè¡ããªãã¨ãå¹çãã解æã§ããªããªãã¾ããåå¦çã¯ã»ã¨ãã©Pythonæ¨æºã®æååé¢æ°ãæ£è¦è¡¨ç¾ã§è¡ã£ã¦ãã¾ããããã¾ã« spaCy ã使ããã¨ãããã¾ãã
解æããçµæã使ããªãããã客æ§ãæããããªä»çµã¿ãä½ãããã«ã³ã¼ããæ¸ãããä»çµã¿ãè¨è¨ãããããã¨ãããã¨ãè¡ã£ã¦ãã¾ãã
å¤åãNLPã¨åã®ã¤ãã¨ã³ã¸ãã¢ã®ä¸ã§ãããªãç¹æ®ãªä»äºããã¦ããã§ãããããNLPã®ã¨ã³ã¸ãã¢ã®ä¸ã«ã¯ãç§ã®ãããªä»äºã¯NLPã§ã¯ãªãã¨è¨ã人ãããããããã¾ããã
製åã¨ãã¦ã¢ãã«ãåæã«ä½ã£ã¦ãããã®ã§ããã®ã¢ãã«ããããã®ã§ã¯ãªãããã®ã¯ã»ãèããªãããã客æ§ãæããããªã·ã¹ãã ãæä¾ããã«ã¯ã©ãããã°ããããæ¤è¨ããã¨ããã®ãæ®æ®µç§ããã£ã¦ããä»äºã«ãªãã¾ãã
ä»äºã®ä¸ä¾ã¨ãã¦ããã¯ãã«ãã¼ã¿ã使ã£ãæ¤ç´¢ã¢ããªã±ã¼ã·ã§ã³ã¨ãããã®ãããã¾ãã
ææ¥ã®æ
å ±æ¤ç´¢ã»æ¤ç´¢ã¨ã³ã¸ã³ Advent Calendar 2019ã§ã¯ãã¡ãã«ã¤ãã¦ç°¡åã«è§¦ãããã¨æãã¾ãã
https://qiita.com/advent-calendar/2019/search
ã¾ã¨ã
Luminosoã¯ãèªç¤¾è£½ã®ã¯ã¼ãã¨ã³ããã£ã³ã°ã¢ãã«ãæä¾ããä¼ç¤¾ã§ããããã§åãã¨ã³ã¸ãã¢ã§ããç§ã¯ãè¾æ¸ä½æãã¢ãã«ä½æã¨ãã£ããã¨ãè¡ããããã¯ãã«ã°ãã触ã£ã¦ããã¨ãããNLPã®ã¨ã³ã¸ãã¢ã¨ãã¦ã¯ã¡ãã£ã¨å¤ãã£ãä»äºããã¦ãã¾ãããã¨ãããã¨ãç´¹ä»ãã¾ããã