Upgrade to Pro — share decks privately, control downloads, hide ads and more …

#JJUG - Java でカジュアルにはじめる機械学習

#JJUG - Java でカジュアルにはじめる機械学習

JJUG ナイト・セミナー「機械学習・自然言語処理特集!」12/17(水)での発表資料です。

セミナー概要はこちら:
http://jjug.doorkeeper.jp/events/18378

KOMIYA Atsushi

December 17, 2014
Tweet

More Decks by KOMIYA Atsushi

Other Decks in Programming

Transcript

  1. • ͲΜͳܗࣜͷσʔλͰ΋ OK ͱ͍͏Θ͚Ͱ͸ͳ͍ • ݪଇͱͯ͠਺஋ྻʢϕΫτϧʣ͔͠ѻ͑ͳ͍ • ඇߏ଄σʔλʢը૾ɺԻ੠ɺςΩετɺΞΫηεϩάɺetc.ʣ͸ͦͷ· ·Ͱ͸ѻ͑ͳ͍ •

    ඇߏ଄σʔλ͔Β͞·͟·ͳʮಛ௃ྔʯΛநग़ͯ͠ʮಛ௃ϕΫτϧʯΛ ࡞Δ • ΧςΰϦΧϧม਺͸μϛʔม਺Ͱදݱ͢Δ • εέʔϦϯά • feature engineering • ڭࢣ͋Γֶशͷ܇࿅σʔλͷ৔߹͸ɺՃ͑ͯʮϥϕϧʯͳͲਖ਼ղ৘ใΛ ෇༩͢Δ ԿΛೖྗσʔλͱ͢Δͷ͔
  2. ಘΒΕͨ݁Ռ͸ਖ਼͍͠ͷ͔ • ਖ਼͠͞Λ͔֬ΊΔ • k-෼ׂަࠩݕূ (k-fold cross validation) • ਖ਼͠͞ΛଌΔ

    • ෼ྨɾࣝผ • Precision, Recall, AUC, F-measure • ༧ଌɾճؼ • ૬ؔ܎਺ɺܾఆ܎਺ɺMAE, RMSE
  3. ΦϯϥΠϯֶशɾΦϑϥΠϯֶश • ΦϯϥΠϯֶश • ஞ࣍ಘΒΕΔσʔλΛ΋ͱʹɺϞσϧΛਵ࣌ߋ৽͢Δ • ετϦʔϜॲཧతͳΠϝʔδ • ར༻ͨ͠σʔλ͸஝ੵ͢Δ͜ͱͳ͘ഁغͰ͖Δ •

    ʢઍ੾ͬͯ͸౤͛ɺઍ੾ͬͯ͸౤͛…ʣ • ΦϑϥΠϯֶश • ஝ੵ͞ΕͨσʔλΛ΋ͱʹɺϞσϧΛҰؾʹߋ৽͢Δ • όονॲཧʹ૬౰͢Δ
  4. ػցֶशͷ࣮૷ɺਏΈ͔͠ͳ͍ • ػցֶशΞϧΰϦζϜͷςετɺͱʹ͔͘ਏ͍ • ʮςετॻ͔ͳ͍ͱ͔͓લ̋̋ͷલͰ΋ಉ͜͡ͱ ݴ͑Μͷʁʯ • ࣌ؒɾۭؒޮ཰ͷΑ͍࣮૷͸໘౗ɾ೉͍͠ • the

    state of the art ͳΞϧΰϦζϜΛ࣮૷͢Δͷ΋ɺ େ෯ͳਫ਼౓޲্͕ݟࠐΊΔ৔߹ʹཹΊ͍ͨ • طଘϥΠϒϥϦ౳Λ࢖͏͚ͩͰ͸Ͳ͏ͯ͠΋ղܾͰ ͖ͳ͍৔߹ʹͷΈɺࣗલ࣮૷͢ΔΑ͏ʹ͍ͨ͠
  5. ྫ͑͹͜ΜͳϫʔΫϑϩʔ 1. ର৅ͱ͢Δ໰୊Λೝࣝ͢Δ • ͲͷΑ͏ͳλεΫ͕߹͏ͷ͔ʁ 2. อ༗͍ͯ͠Δσʔλʹ͍ͭͯཧղΛਂΊΔ • ͲͷΑ͏ͳಛ௃ྔ͕நग़Ͱ͖Δͷ͔ʁ 3.

    ϞσϧΛ࡞੒͢Δ • ͲͷΞϧΰϦζϜΛར༻͢΂͖͔ʁ • Ͳͷಛ௃ྔΛར༻͢΂͖͔ʁ 4. ࡞੒ͨ͠ϞσϧΛධՁ͢Δ • ਫ਼౓͸͍͔΄Ͳ͔ʁ 5. γεςϜʹ૊ΈࠐΉɾγεςϜԽ͢Δ
  6. ྫ͑͹͜ΜͳϫʔΫϑϩʔ 1. ର৅ͱ͢Δ໰୊Λೝࣝ͢Δ • ͲͷΑ͏ͳλεΫ͕߹͏ͷ͔ʁ 2. อ༗͍ͯ͠Δσʔλʹ͍ͭͯཧղΛਂΊΔ • ͲͷΑ͏ͳಛ௃ྔ͕நग़Ͱ͖Δͷ͔ʁ 3.

    ϞσϧΛ࡞੒͢Δ • ͲͷΞϧΰϦζϜΛར༻͢΂͖͔ʁ • Ͳͷಛ௃ྔΛར༻͢΂͖͔ʁ 4. ࡞੒ͨ͠ϞσϧΛධՁ͢Δ • ਫ਼౓͸͍͔΄Ͳ͔ʁ 5. γεςϜʹ૊ΈࠐΉɾγεςϜԽ͢Δ ͜ͷ͋ͨΓͰ ػցֶशΛ ׆༻͢Δ
  7. ྫ͑͹͜ΜͳϫʔΫϑϩʔ 1. ର৅ͱ͢Δ໰୊Λೝࣝ͢Δ • ͲͷΑ͏ͳλεΫ͕߹͏ͷ͔ʁ 2. อ༗͍ͯ͠Δσʔλʹ͍ͭͯཧղΛਂΊΔ • ͲͷΑ͏ͳಛ௃ྔ͕நग़Ͱ͖Δͷ͔ʁ 3.

    ϞσϧΛ࡞੒͢Δ • ͲͷΞϧΰϦζϜΛར༻͢΂͖͔ʁ • Ͳͷಛ௃ྔΛར༻͢΂͖͔ʁ 4. ࡞੒ͨ͠ϞσϧΛධՁ͢Δ • ਫ਼౓͸͍͔΄Ͳ͔ʁ 5. γεςϜʹ૊ΈࠐΉɾγεςϜԽ͢Δ ͜ͷ͋ͨΓ͸ ΞυϗοΫͳ ෼ੳ͕ඞཁ
  8. ྫ͑͹͜ΜͳϫʔΫϑϩʔ 1. ର৅ͱ͢Δ໰୊Λೝࣝ͢Δ • ͲͷΑ͏ͳλεΫ͕߹͏ͷ͔ʁ 2. อ༗͍ͯ͠Δσʔλʹ͍ͭͯཧղΛਂΊΔ • ͲͷΑ͏ͳಛ௃ྔ͕நग़Ͱ͖Δͷ͔ʁ 3.

    ϞσϧΛ࡞੒͢Δ • ͲͷΞϧΰϦζϜΛར༻͢΂͖͔ʁ • Ͳͷಛ௃ྔΛར༻͢΂͖͔ʁ 4. ࡞੒ͨ͠ϞσϧΛධՁ͢Δ • ਫ਼౓͸͍͔΄Ͳ͔ʁ 5. γεςϜʹ૊ΈࠐΉɾγεςϜԽ͢Δ +BWBʹ޲͍ͯ ͍Δͷ͸ ͜ͷ͋ͨΓ
  9. దࡐదॴͰ͍͜͏ • Java ͰػցֶशΛ༻͍ͨΞυϗοΫ෼ੳ͕Ͱ͖ͳ͍Θ͚Ͱ͸ͳ͍͕ɺR ͳͲΛ࢖͏ํ͕Ұൠతʢʁʣ • ෼ੳΛ͢ΔͨΊʹಛԽͨ͠؀ڥ͕޲͍͍ͯΔ • Java ͩͱ

    Weka ͱ͔ Spark ͷΠϯλϥΫςΟϒͳίϯιʔϧͱ͔ • Java Ͱૉ௚ʹίʔυΛॻ͍ͯϏϧυͯ͠ɺ࠷ॳ͔Β࣮ߦ… Έ͍ͨͳ ͷ͸खֻ͕͔ؒΓա͗Δ • ҰํͰ R ͸ R ͰɺγεςϜԽʹ͸޲͔ͳ͍ • HTTP ϦΫΤετΛड͚ͯɺαʔό಺ͰϦΞϧλΠϜͰػցֶशͨ͠ ͍… Έ͍ͨͳγεςϜΛ࡞Γ͍ͨ৔߹ͳͲ
  10. liblinear-java • gradle ‘de.bwaldvogel:liblinear:1.95' • https://github.com/bwaldvogel/liblinear-java • ˒ 121 •

    LibSVM Λઢܗ෼ྨɾճؼʹಛԽͨ͠΋ͷɺͷ Java ϙʔ ςΟϯά • ϥΠϒϥϦ • ΘΓͱؤுͬͯɺຊମ (C++ ൛) ͷ࠷৽όʔδϣϯʹ௥ै ͠Α͏ͱ͍ͯ͠Δ
  11. MLlib (Spark) • gradle ‘org.apache.spark:spark-mllib_2.10:1.1.1' • https://github.com/apache/spark • ˒ 2,336

    • ෼ࢄॲཧϑϨʔϜϫʔΫ Spark ্Ͱͷར༻Λલఏͱͨ͠ ϥΠϒϥϦ • ػೳ௥Ճɾվળ͕ࠓͩ੝Μ • ΞυϗοΫ෼ੳͷ؀ڥͱͯ͠΋ར༻Ͱ͖Δʢ͸ͣʣ • ৄ͍͠࿩͸͜ͷޙͷԐా͞ΜτʔΫʹظ଴ʂ
  12. Mahout • gradle ‘org.apache.mahout:mahout-core:0.9' • https://github.com/apache/mahout • ˒ 229 •

    ෼ࢄॲཧϑϨʔϜϫʔΫ Hadoop ্ͷػցֶशϥ ΠϒϥϦ • Spark / MLlib ͕ग़͖͔ͯͯΒ͍ͩͿΦϫίϯײ͕ ᕷΈग़͖ͯͨؾ͕…
  13. Jubatus • https://github.com/jubatus/jubatus • ˒ 389 • ෼ࢄॲཧϑϨʔϜϫʔΫˍΦϯϥΠϯػցֶशϥΠϒ ϥϦ •

    ຊମ͸ C++ ࣮૷͕ͩɺJava ͷΫϥΠΞϯτϥΠϒϥ Ϧ͕ఏڙ͞Ε͍ͯΔ • ϦΞϧλΠϜॲཧͳػցֶश͕ཁٻ͞ΕΔ৔߹ʹద͠ ͍ͯΔʁ
  14. h2o • https://github.com/h2oai/h2o • ˒ 1,333 • ෼ࢄॲཧϑϨʔϜϫʔΫ Hadoop ্Ͱར༻Ͱ

    ͖ΔػցֶशϥΠϒϥϦ • Կ͔ͱ࿩୊ͷ Deep learning Λ Java Ͱ͍ͨ͠ ͳΒɺ͜Ε୒Ұʂʁ
  15. UCI Machine learning repository • https://archive.ics.uci.edu/ml/datasets.html • ͍͍ͩͨ CSV ϑΝΠϧͰఏڙ͞Ε͍ͯΔ

    • ୅දతͳσʔληοτ • Mushroom: Ωϊί • ৭ɾܗঢ়ɾେ͖͞ͱ৯༻ɾ༗ಟͷϥϕϧ / ೋ஋෼ྨ • Iris: ΞϠϝσʔλ • ͕͘΍Ֆหͷ෯ɾ௕͞ͱ඼छͷϥϕϧ / ଟ஋෼ྨ • Abalone: ΞϫϏ • େ͖͞΍ॏ͞ͳͲͱ೥ྸ / ೥ྸͷ༧ଌ
  16. Weka ͷೖྗܗࣜ @RELATION iris @ATTRIBUTE sepallength NUMERIC @ATTRIBUTE sepalwidth NUMERIC

    @ATTRIBUTE petallength NUMERIC @ATTRIBUTE petalwidth NUMERIC @ATTRIBUTE class {Iris-setosa,Iris-versicolor,Iris-virginica} ! @DATA 5.1,3.5,1.4,0.2,Iris-setosa 4.9,3.0,1.4,0.2,Iris-setosa 4.7,3.2,1.3,0.2,Iris-setosa 4.6,3.1,1.5,0.2,Iris-setosa 5.4,3.9,1.7,0.4,Iris-setosa …… "3''ϑΝΠϧ
  17. Weka ͷೖྗܗࣜ @RELATION iris @ATTRIBUTE sepallength NUMERIC @ATTRIBUTE sepalwidth NUMERIC

    @ATTRIBUTE petallength NUMERIC @ATTRIBUTE petalwidth NUMERIC @ATTRIBUTE class {Iris-setosa,Iris-versicolor,Iris-virginica} ! @DATA 5.1,3.5,1.4,0.2,Iris-setosa 4.9,3.0,1.4,0.2,Iris-setosa 4.7,3.2,1.3,0.2,Iris-setosa 4.6,3.1,1.5,0.2,Iris-setosa 5.4,3.9,1.7,0.4,Iris-setosa …… "3''ϑΝΠϧ $47ϑΝΠϧΛΘ͟Θ͟ม׵͢Δͷ΋໘౗ʜ
  18. ར༻͍ͯ͠ΔΫϥεͷղઆ • weka.classifiers.Evaluation • k-෼ׂަࠩݕূΛ࣮ࢪ͢Δ • weka.classifiers.functions.Logistic • ϩδεςΟοΫճؼʹΑΔ෼ྨ •

    weka.classifiers.trees.RandomForest • RandomForest (ܾఆ໦ͷྨ) ʹΑΔ෼ྨ • weka.classifiers.functions.LinearRegression • ઢܗճؼ