Pythonによるパッケージ開発〜異常検知パッケージをつくってみた

5381bd68abe2b91239ca1600db2a890d?s=47 tsurubee
October 26, 2017

 Pythonによるパッケージ開発〜異常検知パッケージをつくってみた

Pythonによるパッケージ開発の手法と特異スペクトル変換法を実装した異常検知パッケージの紹介

5381bd68abe2b91239ca1600db2a890d?s=128

tsurubee

October 26, 2017
Tweet

Transcript

  1. 1ZUIPOʹΑΔύοέʔδ։ൃ ʙҟৗݕ஌ύοέʔδΛͭͬͯ͘Έͨʙ  1Z'VLVPLB 

  2. ࣗݾ঺հ Խֶͷम࢜߸औಘ ΤϯδχΞྺ ɿ΋͏ͪΐ͍ͰҰ೥ ফ๷࢜ʹͳΔʢফ๷ୂɾٹٸୂɾՐࡂௐࠪ൝ʣ *5ΤϯδχΞʹస৬ʢ೥݄ʙʣ ʻܦྺʼ ܦྺ ௽ాʢͭΔͨʣ 5XJUUFS!UTVSVCFF

  3. ύοέʔδͱ͸ʁ

  4. 1ZUIPOʹ͓͚Δύοέʔδ ύοέʔδͱ͸ɺෳ਺ͷϞδϡʔϧʢQZϑΝΠϧʣ ΛσΟϨΫτϦʹ·ͱΊͨ΋ͷɻ σΟϨΫτϦͷதʹʮ@@JOJU@@QZʯΛஔ͘ͱɺ JNQPSUσΟϨΫτϦ໊ ͕Ͱ͖Δ QBDLBHF @@JOJU@@QZ NPEVMFQZ NPEVMFQZ

  5. ύοέʔδͭ͘Δ ͱԿ͕͍͍ͷʁ

  6. ύοέʔδͭ͘ΔͱԿ͕͍͍ͷʁ ύοέʔδԽ͢Δ͜ͱͰɺ഑෍͠΍͍͢ɻ ͢ͳΘͪɺଞͷϢʔβʔ΍ଞͷϓϩδΣΫτ ͔Βར༻͠΍͍͢ɻ Ұൠత

  7. ύοέʔδͭ͘ΔͱԿ͕͍͍ͷʁ ύοέʔδԽ͢Δ͜ͱͰɺ഑෍͠΍͍͢ɻ ͢ͳΘͪɺଞͷϢʔβʔ΍ଞͷϓϩδΣΫτ ͔Βར༻͠΍͍͢ɻ Ұൠత ϑϩϯτͷίʔυΛॻ͔ͣʹϞϊͮ͘Γ͕ Ͱ͖Δ͔Βخ͍͠ʢָ͍͠ʣʂ ݸਓత

  8. ύοέʔδͬͯ Ͳ͏΍ͬͯͭ͘Δͷʁ

  9. σΟϨΫτߏ੒ྫ SPPU ᵓᴷᴷNZQBDLBHF ᴹ ᵓᴷᴷ@@JOJU@@QZ ᴹ ᵋᴷᴷNZNPEVMFQZ ᵓᴷᴷ3&"%.&NE ᵓᴷᴷ-*$&/4&UYU ᵓᴷᴷTFUVQQZ

    ᵓᴷᴷ."/*'&45JO ᵓᴷᴷEPDT ᵋᴷᴷUFTUT
  10. σΟϨΫτߏ੒ྫ SPPU ᵓᴷᴷNZQBDLBHF ᴹ ᵓᴷᴷ@@JOJU@@QZ ᴹ ᵋᴷᴷNZNPEVMFQZ ᵓᴷᴷ3&"%.&NE ᵓᴷᴷ-*$&/4&UYU ᵓᴷᴷTFUVQQZ

    ᵓᴷᴷ."/*'&45JO ᵓᴷᴷEPDT ᵋᴷᴷUFTUT ύοέʔδ ৘ใͷઃఆ
  11. ύοέʔδԽ 㲈 TFUVQQZΛॻ͘

  12. TFUVQQZͷத਎ from setuptools import setup, find_packages setup( name='banpei', version='0.0.1', description='Anomaly

    detection library with Python', author='Tsuruta', packages=find_packages(exclude=('tests', 'docs')), include_package_data=True, test_suite='tests', install_requires=['numpy', 'pandas', 'scipy'] )
  13. $ python setup.py --help-commands Standard commands: build build everything needed

    to install build_py "build" pure Python modules (copy to build directory) build_ext build C/C++ and Cython extensions (compile/link to build directory) build_clib build C/C++ libraries used by Python extensions build_scripts "build" scripts (copy and fixup #! line) clean clean up temporary files from 'build' command install install everything from build directory install_lib install all Python modules (extensions and pure Python) install_headers install C/C++ header files install_scripts install scripts (Python or otherwise) install_data install data files sdist create a source distribution (tarball, zip file, etc.) register register the distribution with the Python package index bdist create a built (binary) distribution ・・ʢҰ෦লུʣ TFUVQQZΛॻ͘ͱɾɾ ύοέʔδؔ࿈ͷૢ࡞ΛίϚϯυϥΠϯ͔Β࣮ߦͰ͖Δ
  14. $ python setup.py --help-commands Standard commands: build build everything needed

    to install build_py "build" pure Python modules (copy to build directory) build_ext build C/C++ and Cython extensions (compile/link to build directory) build_clib build C/C++ libraries used by Python extensions build_scripts "build" scripts (copy and fixup #! line) clean clean up temporary files from 'build' command install install everything from build directory install_lib install all Python modules (extensions and pure Python) install_headers install C/C++ header files install_scripts install scripts (Python or otherwise) install_data install data files sdist create a source distribution (tarball, zip file, etc.) register register the distribution with the Python package index bdist create a built (binary) distribution ・・ʢҰ෦লུʣ TFUVQQZΛॻ͘ͱɾɾ ύοέʔδؔ࿈ͷૢ࡞ΛίϚϯυϥΠϯ͔Β࣮ߦͰ͖Δ
  15. TFUVQQZΛॻ͘ͱɾɾ ίϚϯυͰ1Z1*ʹొ࿥Ͱ͖Δ $ python setup.py register

  16. TFUVQQZΛॻ͘ͱɾɾ ίϚϯυͰϢχοτςετ΋Ͱ͖Δ $ python setup.py test running test running egg_info

    writing requirements to banpei.egg-info/requires.txt writing top-level names to banpei.egg-info/top_level.txt writing dependency_links to banpei.egg-info/dependency_links.txt writing banpei.egg-info/PKG-INFO reading manifest file 'banpei.egg-info/SOURCES.txt’ reading manifest template 'MANIFEST.in’ writing manifest file 'banpei.egg-info/SOURCES.txt’ running build_ext test_hotelling (tests.test_hotelling.TestHotelling) ... ok test_sst (tests.test_sst.TestSST) ... ok ---------------------------------------------------------------------- Ran 2 tests in 1.085s OK
  17. ҟৗݕ஌ͷύοέʔδ Λͭͬͯ͘Έͨ

  18. #BOQFJʢ൪ฌʣ ɿ1ZUIPO੡ҟৗݕ஌ύοέʔδ ࣌ࠁ ཤྺߦྻ" ςετߦྻ# ओ෦෼ۭؒ ",''', ( ",''', (

    มԽ౓ #BOQFJͷಛ௃ ಛҟεϖΫτϧม׵๏ͷ࣮૷ ʮೖ໳ػցֶशʹΑΔҟৗݕ஌ ʕ3ʹΑΔ࣮ફΨΠυʯͷਤ Λࢀߟʹ࡞੒
  19. ಛҟεϖΫτϧม׵๏ʹΑΔมԽ఺ݕ஌

  20. ಛҟεϖΫτϧม׵๏ʹΑΔมԽ఺ݕ஌

  21. ͭͬͯ͘ Α͔ͬͨ͜ͱ

  22. QJQͰ͖Δͱײಈʂ QJQGSFF[FͰOVNQZͱ͔ͱ ฒͿͱ௒ϥΠϒϥϦͬΆ͍

  23. ͍͞͝ʹ (JU)VCʹެ։ͯ͠·͢ɻ IUUQTHJUIVCDPNUTVSVCFFCBOQFJ

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