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

異常検知ライブラリを作った話

tsurubee
November 18, 2017

 異常検知ライブラリを作った話

ライブラリの特徴:特異スペクトル変換による変化点検知

tsurubee

November 18, 2017
Tweet

More Decks by tsurubee

Other Decks in Technology

Transcript

  1. ҟৗݕ஌ϥΠϒϥϦ
    Λ࡞ͬͨ࿩

    ۝भ %BUB4DJFOUJTU.FFU6Q

    View full-size slide

  2. ࣗݾ঺հ
    ௽ా തจ
    ʢ!UTVSVCFFʣ
    ΤϯδχΞྺɿ
    ೥ͪΐ͍
    େֶͷઐ߈͸Խֶ
    લ৬͸ফ๷࢜
    झຯ͸ےτϨ
    ʢಛʹϕϯνϓϨεʣ

    View full-size slide

  3. ࠓճͷ಺༰͸ɾɾ
    ೥൒લʹθϩ͔ΒϓϩάϥϛϯάΛ࢝Ίͨࢲ͕ɺ
    ϊϦͱؾ߹͍Ͱҟৗݕ஌ϥΠϒϥϦΛ࡞ͬͨ࿩
    ɾҟৗݕ஌ʹ͍ͭͯ
    ɾϥΠϒϥϦΛ࡞ͬͨഎܠ
    ɾ࣮૷ΞϧΰϦζϜ
    ɾϦΞϧλΠϜҟৗ؂ࢹͷσϞ
    ͳͲͳͲɾɾ

    View full-size slide

  4. ҟৗݕ஌ͱ͸ʁ

    View full-size slide

  5. େଟ਺ͷσʔλͱ͸ৼΔ෣͍͕
    ҟͳΔσʔλΛݕग़͢Δٕज़
    σʔλϚΠχϯά
    نଇੑ ҟৗ
    σʔλͷࢁ

    View full-size slide

  6. ҟৗݕ஌ͷԠ༻ྫ
    ίϯϐϡʔλ΢Πϧε΍%PT߈ܸͷૣظൃݟ
    ηΩϡϦςΟ෼໺
    ނো༧ஹݕ஌
    ػց෼໺
    ྲྀߦͷݕ஌ɾ৽τϐοΫͷൃݟɾ
    ϢʔβߦಈͷมԽݕ஌
    ϚʔέςΟϯά෼໺

    View full-size slide

  7. ҟৗσʔλྫ ʙͦͷ̍

    View full-size slide

  8. ҟৗσʔλྫ ʙͦͷ̍
    ҟৗʂ

    View full-size slide

  9. ҟৗʂ
    if value > 120:
    print('ERROR!')
    JGจͰݕ஌Ͱ͖ͦ͏ʂ
    ҟৗσʔλྫ ʙͦͷ̍

    View full-size slide

  10. ҟৗσʔλྫ ʙͦͷ̎

    View full-size slide

  11. Կ͔ҟৗ͕ى͖ͯΔ
    ҟৗʹ΋͍Ζ͍Ζ͋Δ
    ҟৗσʔλྫ ʙͦͷ̎

    View full-size slide

  12. ҟৗݕ஌ͷ෼ྨ
    ֎Ε஋ݕ஌ มԽ఺ݕ஌
    ҟৗݕ஌
    ٸܹͳৼΔ෣͍ͷมԽΛݕ஌
    ࣌ܥྻϞσϧ
    ଞͱ͸େ͖͘ҟͳΔ஋Λݕ஌
    ಠཱϞσϧ

    View full-size slide

  13. ҟৗݕ஌ͷ෼ྨ
    ֎Ε஋ݕ஌ มԽ఺ݕ஌
    ҟৗݕ஌
    ࠓճ͸ίονͷ࿩ʂ
    ٸܹͳৼΔ෣͍ͷมԽΛݕ஌
    ࣌ܥྻϞσϧ
    ଞͱ͸େ͖͘ҟͳΔ஋Λݕ஌
    ಠཱϞσϧ

    View full-size slide

  14. ҟৗݕ஌ϥΠϒϥϦ
    ʹ͍ͭͯ

    View full-size slide

  15. ͳͥ࡞͔ͬͨ
    ͍ͭͷ೔͔ɺٕज़Λ࢖͍͜ͳ͢ଆͰ͸ͳ͘
    ࡞ΔଆʹͳΓ͍ͨ
    ϚΠϯυతഎܠ
    σʔλαΠΤϯεతഎܠ
    Ϗδωεͷݱ৔ʹᷓΕΔ࣌ܥྻσʔλ
    ʢྫ͑͹ɺച্σʔλɾΞΫηεϩάͳͲʣ
    ͷมԽͷஹީΛ͍ͪૣ͘ݕ஌͍ͨ͠

    View full-size slide

  16. ࡞ͬͨ΋ͷ
    ಛ௃ʢڧΈʣ͸Կʁ
    #BOQFJʢ൪ฌʣ
    ɿ1ZUIPO੡ҟৗݕ஌ύοέʔδ
    "ಛҟεϖΫτϧม׵ʹΑΔ࣌ܥྻσʔλͷมԽ఺ݕ஌
    ಛఆͷ֬཰෼෍ΛԾఆ͍ͯ͠ͳ͍ͨΊɺ
    ᶃଟ༷ͳมԽʹؤڧʹରԠͰ͖ɺ
    ᶄύϥϝʔλνϡʔχϯά͕༰қͳ
    มԽ఺ݕ஌͕Մೳ

    View full-size slide

  17. ಛҟεϖΫτϧม׵
    ࣌ࠁ
    ཤྺߦྻ"
    ςετߦྻ#
    ओ෦෼ۭؒ ",''', ( ",''', (
    มԽ౓

    શମΠϝʔδ
    ʮೖ໳ػցֶशʹΑΔҟৗݕ஌
    ʕ3ʹΑΔ࣮ફΨΠυʯͷਤ
    Λࢀߟʹ࡞੒
    աڈଆͱݱࡏଆͷߦྻಉ࢜ͷ৯͍ҧ͍ͷେ͖͞ΛఆྔԽ

    View full-size slide

  18. มԽ౓ͷఆٛ
    ಛҟ஋෼ղʹΑΔಛ௃ύλʔϯͷநग़
    9 6 7

    ಛҟ஋্ҐͷࠨಛҟϕΫτϧΛ
    NຊऔΓग़͢
    աڈଆ
    ݱࡏଆ
    ( ͷ࠷େಛҟ஋)
    4
    ֊਺SΛ΋ͭNºOߦྻ9
    N
    O S S O
    S
    มԽ౓

    View full-size slide

  19. #BOQFJͷ࢖͍ํ
    ҟৗݕ஌
    ϋΠύʔύϥϝʔλʢXʣɿεϥΠυ૭ͷαΠζ
    ΠϯϓοτʢEBUBʣϦετܕ΍/VN1Z BSSBZͳͲͷσʔλ഑ྻ
    Ξ΢τϓοτʢSFTVMUTʣΠϯϓοτͱಉ͡αΠζͷ/VN1Z BSSBZ
    git clone https://github.com/tsurubee/banpei.git
    cd banpei
    pip install .
    Πϯετʔϧ
    import banpei
    model = banpei.SST(w=50)
    results = model.detect(data)
    ˞ͨͬͨ̏ߦʂ

    View full-size slide

  20. #BOQFJʹΑΔप೾਺ҟৗݕ஌

    View full-size slide

  21. #PLFIͱͷ࿈ܞʹΑΔ
    ϦΞϧλΠϜҟৗ؂ࢹ
    ΁ͷ௅ઓ

    View full-size slide

  22. #PLFIͱ͸ʁ
    IUUQTCPLFIQZEBUBPSHFOMBUFTU
    ɾ*OUFSBDUJWFWJTVBMJ[FUJPO
    ɾ/PWFMHSBQIJDT
    ɾ4USFBNJOH EZOBNJD MBSHFEBUB
    ɾ/POFFEUPXSJUF+BWBTDSJQU
    ର࿩ܕՄࢹԽ؀ڥΛఏڙ͢Δ1ZUIPOϥΠϒϥϦ
    IUUQTXXXTMJEFTIBSFOFUDPOUJOVVNJPIBTTMFGSFFEBUBTDJFODFBQQTXJUICPLFIXFCJOBS

    View full-size slide

  23. • ʮಛҟεϖΫτϧม׵ʹΑΔप೾਺ҟৗݕ஌ʯ
    IUUQTZPVUVCFF'7/,"7U/1
    • ʮಛҟεϖΫτϧม׵ʹΑΔ܏͖ͷมԽ఺ݕ஌ʯ
    IUUQTZPVUVCF@XPVC-"I9L
    :PV5VCFʹσϞಈըΛެ։͍ͯ͠·͢ʂ

    View full-size slide

  24. (JU)VCʹެ։͍ͯ͠·͢ʂ
    IUUQTHJUIVCDPNUTVSVCFFCBOQFJ

    View full-size slide

  25. ϒϩάॻ͍͍ͯ·͢ʂ
    IUUQTHJUIVCDPNUTVSVCFFCBOQFJ

    View full-size slide

  26. ࠓޙͷల๬
    l ಛҟεϖΫτϧม׵ͷߴ଎ԽʹΑΔߋͳΔ
    ϦΞϧλΠϜੑͷ௥ٻ
    l ҟৗ௨஌ػೳͷ࣮૷ʹΑΔ࣮༻ੑͷ޲্
    ͋ͱɺ৽ͨͳΞϧΰϦζϜ΋࣮૷͍ͨ͠ɾɾ

    View full-size slide

  27. 1ZUIPOίϛϡχςΟ
    ʹ͍ͭͯ

    View full-size slide

  28. 1Z'VLVPLB΍ͬͯ·͢ʂ
    ݄ʹ-5ΠϕϯτΛ։࠵༧ఆͰ͢ʂ

    View full-size slide

  29. 1Z$PO ,ZVTIV΍Γ·͢ʂ
    ελοϑืूதʂ
    ڵຯ͕͋Δํ͸࠙਌ձͰ͓੠͔͚͍ͩ͘͞ʂ
    IUUQLZVTIVQZDPOKQ

    View full-size slide

  30. ͝ਗ਼ௌ͋Γ͕ͱ͏
    ͍͟͝·ͨ͠ʂ

    View full-size slide