ããã«ã¡ã¯ï¼MLã¨ã³ã¸ãã¢ã®é澤ï¼@takapy0210ï¼ã§ãï¼
æ°ã¥ãã°2019å¹´ã®å¶æ¥æ¥ãæ®ã20æ¥å¼·ã§ãããå¹´å§ã«ç«ã¦ãå人çãªç®æ¨ã1/5ããéæã§ãã¦ããªããã¨ã«å æ¥æ°ä»ããã®ã§ãæ®ãã®æéã§1ã¤ãããã¯éæã§ããã¨è¯ãã§ãããã¨ããä»äººè¡åãªæ¯ãèããããããªã£ã¦ããä»æ¥ãã®é ã§ãã
ãã¦ä»åã¯ã11æ5æ¥ã«éå¬ãã(ã³ããããã«ã·ã§)ã§LTããå
容ã®å
¨ææ¸ãèµ·ããã§ããåèè³æã¨ãããã¦ãç´¹ä»ã§ããã°ã¨æãã¾ãã
å
¨ææ¸ãèµ·ããã¯åã®è©¦ã¿ãªã®ã§ããµããããªãã»ã©ãããããã®ãæ°æã¡ã§è¦ã¦ããã ããã°ã¨æãã¾ãã
çºè¡¨è³æã¯ãã¡ãã§ãã
Kaggleã¨ã¯
Kaggleã¨æ¸ãã¦ãã«ã°ã«ãã¨èªã¿ã¾ããæ¥æ¬ã§ãæè¿ã¯å®çãã¦ãã¾ããããKaggleã«åå ãã¦ããæ¹ããã«ã°ã©ã¼ï¼Kagglerï¼ãã¨ãå¼ã³ã¾ãã
ãThe Home of Data Science & Machine Learningãï¼ãã¼ã¿ãµã¤ã¨ã³ã¹ã¨æ©æ¢°å¦ç¿ã®å®¶ï¼ã¨é¡ããã¦ããéããä¸çä¸ã®æ©æ¢°å¦ç¿ã»ãã¼ã¿ãµã¤ã¨ã³ã¹ã«æºãã£ã¦ããç´40ä¸äººã®æ¹ãéã¾ãã³ãã¥ããã£ã§ããæ大ã®ç®çã¨ãè¨ããã®ã¯ãCompetetionï¼ã³ã³ãï¼ãã§ãã
https://www.kaggle.com/
SIGNATEã¨ã¯
æ¥æ¬çKaggleã¨ããã®ãä¸çªãããããããç¹å¾´ã¨ãã¦ã¯ãéå¬ãããã³ã³ããã£ã·ã§ã³ã®ãã¼ã¿ã¯æ¥æ¬ã®ä¼æ¥ããæä¾ããã¦ãã¾ããã³ã³ããã£ã·ã§ã³ã§é«é ä½ãã¨ãã¨ãå¾æ¥è¡¨å½°å¼ããã³å ±åä¼ã¨ããå½¢ã§å¼ã°ãããã¨ããããå
¥è³ããã¨ãè³éãåºã¾ãã
https://signate.jp/
ï¼ä¼å ´ã®9å²å¼·ã®äººãææï¼
åå ãããã¨ããæ¹ã«èãã¦ã¿ããã®ã§ãããç¹å¾´éã®ç®¡çã£ã¦ã©ãããã¦ã¾ããï¼
æåã«ãåã®å®ä½é¨ãæ·»ãã¦ãããã¡ãªãã¿ã¼ã³ã2ã¤ã»ã©ãç´¹ä»ã§ããã°ã¨æãã¾ãã
ä¾ãã°ã[A, B, C, D]ã¨ããç¹å¾´éããã£ãæã«ãããããã[E, F, G, H, ...]ã¨ããå½¢ã§ç¹å¾´éã¨ã³ã¸ãã¢ãªã³ã°ãããã¨ããã·ãã¥ã¨ã¼ã·ã§ã³ã¯ããããã¨æãã¾ãã
ã§ãä¸éãç¹å¾´éãçæãçµããå¾ã«ãå®é¨ãããç¹å¾´éãæå®ãã¦å¦ç¿ãã¼ã¿ãä½ããå¦ç¿ããã¾ãã
ä¸éãå¦ç¿ãçµããã¨ããã§ããµã¨ãããªäºãæãã¿ã¤ãã³ã°ãããã¾ããã
ã©ã®ãããªè¨ç®ã§çæããç¹å¾´éãæ¢ãã¦ã¿ãã¨ããããçµæ§å¤§å¤ã ã£ãããã¾ãã
ç¹å¾´éçæå ´æãè¦ã¤ãã£ã¦ããä»ã®ç¹å¾´éãã段éçã«çæããã¦ãããããå ´åããã®æ ¹æºãæ¢ãã®ã大å¤ã§ããï¼ãã¡ãããç¹å¾´éã®ååãä¸ç®ã§åãããã¨ã«ãã¦ãããã¨ã¯åæã¨ãã¦ã¨ã¦ã大åã ã¨æãã¾ããï¼
ç¶ãã¦ã2ã¤ç®ã®ãã¿ã¼ã³ããç´¹ä»ãã¾ãã
ããã¯çµæ§ãããã¡ã ã¨æãã¾ãï¼ç¬ï¼
ã§ãææ°æã ã¨Duplicateãã¦notebookã®ä¸èº«ãè¦ã¦ã¿ãã¨ãããªæãã«ãªã£ã¦ãããã§ããã
ããã
ãæ°ä»ãã®æ¹ãããã¨æãã®ã§ãããç¹å¾´éçæå¦çãªã©ãåãè¨ç®ãå度è¡ãå¿ è¦ãã§ã¦ãã¾ããããã¯æ¬å½ã«ç¡é§ã ã¨æã£ã¦ãã¦ãã©ãã«ãããªãã¨ãªãã¨æã£ã¦ãã¾ããã
ã¾ããDuplicateãç¹°ãè¿ãã¦ããã¨ãæ°ã¥ãããnotebookãã¡ã¤ã«ã ããã«ãªã£ã¦ããããªãã¦ãã¨ããããã¨æãã¾ãã
æåã¯ããã£ã¡ãè¯ãã¢ãã«ãä½ããï¼ãã¨æåãã¦ãã¾ããããç ©éãªnotebookãç¹å¾´é管çã«ãããã³ã³ãã®ã¢ããã¼ã·ã§ã³ãä½ä¸ãã¦ãã¾ãããªãã¦ãã¨ã«ããªãããã¾ããã
ä»åã¯ãä¸è¨ã§è¿°ã¹ããããªå®ä½é¨ããæãã¦ãã課é¡æããç人ã®äºä¾ãåèã«å°ãã¥ã¤è§£æ¶ã§ãã¦ããã®ã§ãã¿ãªããã«ãå°ããããåãã§ãããã¨æã£ã¦ãã¾ãã
é¡ãã¦
ããã¼ã¿åæã³ã³ãã«ããã¦ç¹å¾´é管çã«ç²å¼ãã¦ããå
¨äººé¡ã«ä¼ãããæ³ããå¦ç¿ã»æ¨è«ãã¤ãã©ã¤ã³ãæ·»ãã¦ãã
ã¨ãã壮大ãªã¿ã¤ãã«ï¼ç¬ï¼ã§ã話ã§ããã°ã¨æã£ã¦ãã¾ãã
ãã¡ããã¢ã¸ã§ã³ãã§ãã
ããããæ¸ãã¦ãã¾ããããç人ã®ç¥æµããåããã¦ãç¹å¾´é管çã¨å¦ç¿ã»æ¨è«ãã¤ãã©ã¤ã³æ§ç¯ã«åãçµãã çµæããã£ã¡ãããã£ãããã¨ãã話ããã¾ãã ããã¾ã§ä¸»è¦³ã«ãªãã¾ãã®ã§ãããããªæ¹æ³ã§åãçµãã ãããã£ãï¼ããªã©ããã¾ãããæ¯éæãã¦ãã ããã
ã¾ãã¯ç°¡åã«èªå·±ç´¹ä»ããã¦ãã ããã
é澤å²ç
§ã¨è¨ãã¾ãã¦ãã³ãããæ ªå¼ä¼ç¤¾ã§æ©æ¢°å¦ç¿ã¨ã³ã¸ãã¢ã¨ãã¦åãã¦ãã¾ãã
ä¼ç¤¾ãªã©ã§ã¯ãããã±ããã¨å¼ã°ãã¦ãã¾ãã
Kaggleããããéçããããã©ã¼ã¡ã³é£ã¹ããããã®ã好ãã§ãã
次ã«ç¹å¾´é管çæ¹æ³ã«ã¤ãã¦ã話ãã¾ãã
ããããçºè¡¨ããç¹å¾´é管çã«ã¤ãã¦ã¯ãä¸è¨è¨äºãåèã«ããã¦ããã ãã¾ããã
åèè¨äºï¼Kaggleで使えるFeather形式を利用した特徴量管理法 - 天色グラフィティ
ã¾ãã¯ãç¹å¾´éãåãã¨ã«ç®¡çããããã¡ã¢ãã¡ã¤ã«ãä½æãããã¨ããé¨åã®ã¤ã¡ã¼ã¸ãå ±æã§ããã°ã¨æãã¾ãã
ãç¹å¾´éãåãã¨ã«ç®¡çãããã¨ã¯ãä¸è¨ã®ããã«1ã¤ã®ç¹å¾´éãtrainãã¼ã¿, testãã¼ã¿ããããï¼ãã¡ã¤ã«ãã¤ã§ç®¡çãããã¨ãã¤ã¡ã¼ã¸ãã¦ãã ããã
ãã¡ã¢ãã¡ã¤ã«ãä½æãããã¨ã¯ãä¸è¨ã®ç¹å¾´éãçæããéã«èªåçã«ããã®ç¹å¾´éã¯ãããã£ã¦çæãããã®ãã¨ããã¡ã¢ãã¡ã¤ã«ãçæãããã¨ã§ãã
ããã ãè¦ãã¨çµæ§å¤§å¤ããã«æããæ¹ãããã¨æãã¾ããã1ã¤ã®ã¹ã¯ãªãããã¡ã¤ã«ãå®è¡ããã ãã§å®ç¾ã§ãã¾ãã
以ä¸ã§å ·ä½çãªæ¹æ³ã«ã¤ãã¦ãä¼ãã§ããã°ã¨æãã¾ãã
ä¾ãã°hoge.py
ã¨ããç¹å¾´éçæç¨ã®ã¹ã¯ãªãããä¸è¨ã®ããã«ç¨æãã¦ããã¾ãã
ãããå®è¡ããã¨ããåç¹å¾´éãã¨ãç¹å¾´éã¡ã¢ãã¡ã¤ã«ããçæããã¾ãã
ç¹å¾´éã®ã¡ã¢ãã¡ã¤ã«ãä½æããç®æã«é¢ãã¦ã¯ãé£ãããã¨ããã£ã¦ãã訳ã§ã¯ãªããçæããç¹å¾´éã®è¨è¿°ããã¡ã¤ã«ã«ãªããã°è¿½è¨ãã¦ãããã¨ãããã¨ããã£ã¦ãã¾ãã
ãã®ç¹å¾´éã¡ã¢ã¯CSVå½¢å¼ã§ä¿åãã¦ããã¨Githubããåç
§ããããã£ãããã¾ãã
ExcelãNumbersã¨ãã£ãã¢ããªã±ã¼ã·ã§ã³ããã§ã綺éºã«è¦ããã®ã§ãä»åã¯CSVãã¡ã¤ã«ãæ¡ç¨ãã¾ããã
æ°ããç¹å¾´éãçæãããå ´åã¯ãhoge.py
ã«ãã®ç¹å¾´éçæå¦çãæ°ããè¨è¿°ãã¾ãã
hoge.py
ãå®è¡ããã¨æ°ããç¹å¾´éãçæããã¾ããããã®æãã§ã«çæããã¦ããç¹å¾´éã®è¨ç®ã¯skipãã¦ãããã®ã§ãä½è¨ãªè¨ç®æéãããããã¨ã¯ããã¾ãããï¼ãã¡ãããåè¨ç®ãããã¨ãå¯è½ã§ãï¼
ç¹å¾´éãdataframeã«èªã¿è¾¼ãå ´åã¯ãèªã¿è¾¼ã¿ããç¹å¾´éåã®ãªã¹ããçæãã¦ãããä¸è¨ã®ããã«è¨è¿°ããã°æå®ããç¹å¾´éãã¼ã¿ã®ã¿ãèªã¿è¾¼ããã¨ãå¯è½ã§ãã
ãã®ç¹å¾´é管çæ¹æ³ã使ã£ã¦ä½ãå¬ããã£ããã¨è¨ãã¨
ç¹å¾´é管çããããã¨ã§ä¸è¨ã®ãããªã¡ãªããã享åãããã¨ãã§ãããæéçãªã³ã¹ããã大å¹
ã«åæ¸ã§ããã®ãå人çã«ã¯ã¨ã¦ãå¬ããã£ãã§ãã
ãã¼ã¿åæã³ã³ãã§ã¯ç¹å¾´éçæã ãã§ã¯ãªããå¦ç¿ãæ¨è«ã«ãä¸å®ã®æéããããã¾ãã
ãã®ãããªä¸ã§ãç¹å¾´éã管çãããã¨ã§ä½è¨ãªè¨ç®æéãæ¸ãã ãã§ãªããå¦ç¿âæ¨è«ã®PDCAãåãããããªã£ãã¨æãã¦ãã¾ãã
次ã«ãå¦ç¿ã»æ¨è«ãã¤ãã©ã¤ã³ã«ã¤ãã¦ãä¼ããã¾ãã
ãã¡ãã«é¢ãã¦ã¯ãæ¨ä»è©±é¡ã®ä¸è¨æ¸ç±ãåèã«ããã¦ããã ãã¾ããã
åèæç®ï¼Kaggleで勝つデータ分析の技術:書籍案内|技術評論社
æ¸ç±ã§ç´¹ä»ããã¦ãããã¤ãã©ã¤ã³ãåå°ã«ãä¸è¨run_nameãprefixã¨ãããã¨ã§ãä¸è²«æ§ã®ãããã¡ã¤ã«ãã¢ãã«ç®¡çããæèããªãã¦ãã§ããããã«å·¥å¤«ãã¾ããã
çæããããã¡ã¤ã«ã¯ä¸è¨ã®ãããªãã®ã«ãªãã¾ããã¢ãã«ãæ¨è«çµæã®ãã¡ã¤ã«ã¯çããã®æ³åéãã®ãã®ãªã®ã§ããã以å¤ã®ãã¡ã¤ã«ã«ã¤ãã¦å°ããç´¹ä»ãã¾ãã
features.txtã¯ä»åã®å¦ç¿ã«ä½¿ç¨ããç¹å¾´éãè¨è¼ããããã¡ã¤ã«ã§ãã
ã¾ããparam.txtã¯ä»åã®å¦ç¿ã«ä½¿ç¨ãããã¤ãã¼ãã©ã¡ã¼ã¿ãè¨è¼ããããã¡ã¤ã«ã§ãã
shap.pngã¯shapã§è¨ç®ãããå¯è¦åã¤ã¡ã¼ã¸ãä¿åãããã®ã§ãããããå ã«æ¬¡ã®å¦ç¿ã®åæãè¦ã¤ãã¦ããã¾ãã
logãã¡ã¤ã«ã«ã¤ãã¦ã¯ãå¦çéç¨ãä¿åãããã®ï¼general.logï¼ã¨ãã¢ãã«ã®ã¹ã³ã¢ã ããä¿åãããã®ï¼result.logï¼ã®2種é¡ããã¾ãã
ãã®å¦ç¿ã»æ¨è«ãã¤ãã©ã¤ã³ãæ§ç¯ãã¦ä½ãå¬ããã£ããã¨ããã¨
ããã®ç¹å¾´éãã¨ããã®ãã©ã¡ã¼ã¿ãã使ã£ã¦å¦ç¿ãããã¢ãã«ã«é¢ãã¦ããåã¿ã¹ã¯ã«è¦ããæéãã¨ãåfoldã¨æçµçãªã¹ã³ã¢ããæèããªãã¦ã管çã§ããããã«ãªã£ããã¨ã§ãã
ããã«ãããã¢ãã«ã®åç¾æ§ã¯ãã¡ãããã©ã®ç¹å¾´éã使ãã¨ã¹ã³ã¢ãä¸ãã£ã or ä¸ãã£ãã¨ãããã¨ãèªç¶ã¨ç®¡çã§ããããã«ãªãã¾ãã
ã¾ããshapã®è¨ç®çµæãªã©ãåºåãã¦ãããã¨ã§ã次ã®å¦ç¿æã®åæãæ´ããã¨ãã§ãã¾ãã
æå¾ã«ã¾ã¨ãã§ãã
ç¹å¾´é管çã¨ãã¤ãã©ã¤ã³ãæ§ç¯ãããã¨ã§ãæ§ã ãªããããï¼ããæãããã¨ãã§ãã¾ãããä¸å®ã®ã¤ãã·ã£ã«ã³ã¹ãã¯ãããã¾ãããä¸åº¦æ§ç¯ãã¦ãã¾ãã°æµç¨ã§ããã®ã§ãèå³ã®ããæ¹ã¯è©¦ãã¦ã¿ã¦ãã ããï¼
ã¾ãããä»ã«ãããªè¯ãæ¹æ³ããããï¼ãã¨ãã£ãç¥è¦ã»æè¦ããã°ãæ¯éæãã¦ããã ããã¨å¬ããã§ãï¼
ãæ¸ è´ãããã¨ããããã¾ããï¼
çºè¡¨è³æå ¨ä½ãã覧ã«ãªãããæ¹ã¯ãã¡ããã覧ãã ããã
以ä¸ãå½æ¥ã®æ¸ãèµ·ããã§ããã
ä»å¾ãã³ãããã®MLãã¼ã ã¨ãã¦ã¯æ¨è¦ã·ã¹ãã ã«åãçµãã§ããäºå®ã§ãã
åãçµã¿ããå¾ãç¥è¦ãªã©ãç©æ¥µçã«çºä¿¡ãã¦ããããã¨æã£ã¦ãã¾ãã®ã§ã楽ãã¿ã«ãã¦ãã¦ãã ããï¼
ãããããã°ãä»ã¾ã§ã®ãã£ãªã¢ãã³ãããã§ã®æ¥åãªã©ãã¾ã¨ãã¦ããã¾ãã®ã§ãã¡ããã覧ããã ãããå¬ããã§ãã www.wantedly.com