Liang-Bo Wang
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # PyCon TW 2016 Collaborative Talk Notes <br> Day 3 - R0 > ### Quick Links > - [Portal for Collobration Notes 共筆統整入口](https://hackfoldr.org/pycontw2016) (hosted by [hackfoldr](https://hackfoldr.org/about) and [HackMD](https://hackmd.io/)) > - [Program Schedule 議程時間表](https://tw.pycon.org/2016/events/talks/) > - [PyCon TW 2016 Official Site 官網](https://tw.pycon.org/2016/) > > ### How to update this note? > - Everyone can *freely* update this note. 任何人都能自由地更新內容。 > - Please respect all the participants and follow our [code of conduct](https://tw.pycon.org/2016/about/code-of-conduct/) during discussion. 討論、記錄時,請遵守大會的[行為準則](https://tw.pycon.org/2016/about/code-of-conduct/)。 ## Talk: Python 的 50 道陰影 - Info: https://tw.pycon.org/2016/en-us/events/talk/69816515947397183/ - Speaker: Tim Hsu - slide: http://www.slideshare.net/tim518/python50 #### 容易碰到但不容易第一時間弄懂的問題: - 縮排 - 參數傳遞 - closure - Global Variable - Dead or Alive - Interface - List Related - Package - Quality - Inheritance ### 縮排 - Tab 和空白視為不同的字元 - 直譯器會用一個 stack 紀錄現在的縮排多少空格, 若是縮排減少, 會把 stack pop, 一直到縮排跟 stack 頂端一致 ### 參數傳遞 - 在看到 def 的時候會計算 arguments 的預設值 - 但只有第一次會計算,之後都不會 ### Closure - 把函數先存到list,再一個一個印出來 -> 結果會不正確 - 產生closure時,python只會記住內部變數的名字,不會執行涵數內的程式(只是個symbol table的名字) - 被 closure 記住的變數不會立刻被 GC - 解法: 1. 被closure的函數中加`parameter=`參數 2. 改用 class,並使用 `__call__` 3. 用 `functools.partial` ### Global Variable - Pyhton 在執行函數的第一步, 會先確定語法正確性, 才開始執行程式內容 - 若global var和local var同名,python會錯亂,會把兩個都當成local - 解法:記得用 `global` ### Dead or Alive - circular reference 的多個 objects 他們的 `__del__` 不會被執行, 因為他們的 reference count 都大於 0 - 如果兩個物件都有實作自己的`__del__`,Python會不敢動作 - 解法 1. 若一定要用circular reference,使用weak reference ### Interface ### Package - 用virtualenv隔離套件 - `pip freeze > requirements.txt` - 如果不熟悉 compile 流程或有用科學計算建議使用 conda - 建議 requirements.txt 用手動修改, 否則若有用一些嘗試性質的套件會被 pip freeze 匯出, 可能會弄髒其他共同開發的同事的環境 ### Quality - [flake8](https://flake8.readthedocs.io/en/latest/) 可以檢查code符合PEP ## Talk: Analyzing Chinese Lyrics with Python - Info: https://tw.pycon.org/2016/en-us/events/talk/27349121996161025/ - Speaker: Andy Dai - slide: https://speakerdeck.com/daikeren/analyzing-chinese-lyrics-with-python #### 取得中文歌詞 抓歌詞 Tools: [Scrapy](http://scrapy.org/), MongoDB #### 清理歌詞 有重複歌曲、奇怪字元等 抓出需要的資料(EX.作曲人、作詞人) #### 開始分析 使用[pandas](http://pandas.pydata.org/)+pymongo 可以把pandas想成程式版的excel。excel能做的事pandas幾乎都做得到 [matplotlib](http://matplotlib.org/):將資料畫成圖表的工具。 資料量不大的話可以直接整個資料庫丟進pandas `df[df.lyricist=='林夕']` 就可以直接找出所有林夕的歌 #### 斷詞 使用[jieba](https://github.com/fxsjy/jieba) - 支援繁體、自訂字典... #### 計算詞頻 使用 [counter](https://docs.python.org/2/library/collections.html#collections.Counter) 計算(counter.most_common) #### 視覺化(文字雲) 使用[wordcloud](https://github.com/amueller/word_cloud)套件作文字雲 -`pip install wordcloud` - 需要自己給他中文字型檔 #### 其他來不及說的東西 - [jupyter](http://jupyter.org/) - elasticsearch。配合ElasticSearchDSL會更好 ## Talk: Time series prediction implement on Python - Info: https://tw.pycon.org/2016/en-us/events/talk/70022152522301510/ - Speaker: 古宣佑 Hsuanyo - Slides: https://drive.google.com/file/d/0B7XRi9zdePwCUnI1VUlEQzh5cGM/view?usp=sharing What is Time series data? Methods: - OLS, GLS, ... - ARIMA+ SVR , SdA - ARIMA, Autoregressive Integrated Moving Average Model - http://wiki.mbalib.com/zh-tw/ARIMA%E6%A8%A1%E5%9E%8B - SVR, Support Vector Regression - Related Paper - A Distributed PSO-ARIMA-SVR Hybrid System for Time Series Forecasting - http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=6974534 - SDA, Stacked Denoising Autoencoders - Related Paper - Stacked Denoising Autoencoders: Learning Useful Representations in a Deep Network with a Local Denoising Criterion - http://www.jmlr.org/papers/volume11/vincent10a/vincent10a.pdf Scenario: IoT device report, need a model that is more complicated than the linear model. ARIMA: linear part (big picture) SVR: residual (details?) ACF/PACF AIC/BIC choose best model package rpy2 -automatically to decide the parameters - import pandas2ri, imporrtr use sklearn, SVR use grid_search to tune the parameters problem - pattern modeling (normal part) - exception modeling (abnormal part) - cross validation: beware of the order, because it's important for time series 第二部分 預測人會不會待在辦公室 (例如跟氣溫的相關性) Advantages of SdA - non-linear Packages used - Keras - deep learning - TensorFlow - backend of Keras - iypthon - visualization pretraining: autoencoders Steps: - add noise - autoencode - train - stack encoders supervised learning - Dataset: UCI SML2010 - - Target: indoor temperature

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully