JupyterNotebookでのdebug入門(サンプルは説明欄にあります)
by
fkubota
Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
JupyterNotebookͰͷdebugೖ pdb, ipdb, %debugͱ͔ fkubota
Slide 2
Slide 2 text
2 ࣗݾհ fkubota (Twitter, Kaggle) - όϯυϧΧʔυͷձࣾ(ΧϯϜ)ͰػցֶशΤϯδχΞ - Kaggle Expert - ԭೄग़(౦ژʹग़͖ͯͯ3) - ཧֶՊग़(ڧ૬ؔిࢠܥɺ4.2KͷӷମϔϦϜʹ࣓ੑମಥͬࠐΜͰͨ) - ϓϩάϥϛϯάྺ2͙Β͍ - झຯ - ૣى͖(4࣌ىচ) - Kaggle - ίʔώʔɺϏʔϧɺΟεΩʔ - ಡॻɺཧɺֶ
Slide 3
Slide 3 text
3 Contents debug ʹ͍ͭͯ JupyterNotebookͰ debug ʹೖ ͳͥσόοΨ͕ඞཁ͔ͱ ͔ɻ ੳίϯϖͰඞͣͱߦͬͯ ͍͍΄Ͳ͏ JupyterNotebookͰͷdebug ํ๏ʹ͍ͭͯ؆୯ʹհɻ ओʹϏΪφʔʹ͚ͯʂ
Slide 4
Slide 4 text
4 ͋Δ͋Δʁ ίϯϖͬͨΔͰʔʂ ͜ͷϊʔτϒοΫͰೖ͠Α͏ɻ ͏ʔʔʔΜɻ ਓͷίʔυಡΉͷ͠ΜͲ͍ɻ ࣗͷڥͩͱಈ͔ͳ͍ͷͰमਖ਼͕ඞཁɻ ͽ͑Μ͑ͯ͜ͺ͓Μɻ*1 *1 ࠓ͞Βฉ͚ͳ͍ʮͽ͑Μʯͱʮͺ͓Μʯͷ͍ํ debugྗߴΊΕ ͠ΜͲܰ͞ݮ͞ΕΔ͔ʁ
Slide 5
Slide 5 text
5 ͜Μͳܦݧͳ͍Ͱ͔͢ʁ outputFͷΛ֬ೝ͍ͨ͠ɻ outputFinput_ʹґଘ͍ͯͯ͠ɺ input_outputCʹґଘ͍ͯͯ͠ɺ outputCfuncCͷhogeʹґଘ͍ͯͯ͠ɺ hogefuncBʹґଘ͍ͯͯ͠..........(T T) ਂ͗͢Δʂ
Slide 6
Slide 6 text
6 ͱΓ͋͑ͣ͜͏͢ΔΑͶ print debug ʂʂ
Slide 7
Slide 7 text
7 େม print debug ѱ͘ͳ͍͠ɺΑ͘͏ΜͰ͕͢ɺinput_ Λม͑ͨͱ͖ ͷ outputF ͷڍಈΛ֬ೝ͍ͨ͠ͱ͖ͳΜ͔ΊͪΌͪ͘ΌେมͰ͢ΑͶɻ ͦͦɺfuncB ͔Β funcF ʹ౸ୡ͢Δ·Ͱʹ͔͔ΔͱͳΔͱ࣌ؒ ͔͔ͬͯ͠·͏ɻ
Slide 8
Slide 8 text
8 ͔͔࣌ؒΔ Α͘Θ͔ΒΜ͔Β plotͯ͠ΈΔ͔ɻ ͔ͦͬoutputFೋ ࣍ݩ͔ͩΒΤϥʔ ͰͪΌ͏ͳɻ ͱΓ͋͑ͣ γΣΠϓ֬ೝɻ 30 sec 30 sec 30 sec funcD ʹ౸ୡ͢Δ·Ͱʹ͕͔͔࣌ؒͬͯ͠·͏...
Slide 9
Slide 9 text
9 σόοΨ͏ͱָͩΑ pdb, ipdb, IDE, %debug, etc...
Slide 10
Slide 10 text
10 .py ͱ .ipynb ੳίϯϖɺ ϊʔτϒοΫ(.ipynb)Ͱೖ͢Δਓ͕ଟ͍ & ࢀߟࢿྉ͕গͳ͍ ͷͰϊʔτϒοΫܗࣜͰਐΊ·͢ .ipynb JupyterNotebook, JupyterLab, Kaggle, Colab, etc... .py
Slide 11
Slide 11 text
11 ͲΕ͕͍͍ʁ(202108࣌) pdb %debug ipdb pudb xeus-python JupyterNotebook ˕ ˕ ̋ ˚ ˚ JupyterLab ˕ ˕ ̋ ˚ ˚ KaggleNotebook ˕ ˕ ̋ ʁ ʁ Colaboratory ˕ ˕ ̋ ʁ ʁ ߴػೳ ˕: Πϯετʔϧෆཁ ̋: Πϯετʔϧඞཁ(؆୯) ˚: Πϯετʔϧඞཁ(ͪΐͬͱΊΜͲ͍͘͞) ʁ: ಈ͔ͨ͜͠ͱͳ͍ Ұ෦Λհ
Slide 12
Slide 12 text
12 ಈֶ͔ͤͯΔαϯϓϧ pdbͱ%debugֶ͕Δαϯϓϧ࡞Γ·ͨ͠ʂ https://colab.research.google.com/drive/ 1di0EBQ5FaGME82JOLDP0kjaerk1fqakk?usp=shari ng 3ਓͷํʹ ςετϢʔβͱͯ͠ ڠྗͯ͠Β͍·ͨ͠ @natsumin_0813 @tnot_fount @chi1234s
Slide 13
Slide 13 text
Thanks :)