2016年6月6日 星期一

[pycon]pycon 2016 day 2 小整理 from 共筆

關於迪士尼動畫使用的技術

  • Even if we do things in C++, we always make python binding with SWIG or CFFI.
  • Easier to do unit test in Python than C++.
  • All animations are handcrafted.
  • We want xxxxx! Python has a library doing that.
  • Scripting language is not just about syntax and grammar, it’s libraries that matter.
  • Disney’s Hyperion Renderer
  • Early response is important.
  • Disney’s Open Source
  • Free software is free as in puppy. It is free, but you have feed it, etc. You have a lot of responsibility. It is not “free”.
  • Disney’s Github
  • Disney’s Talk
  • Speaker’s Mail



關於股票分析系統

  • Slides: http://slides.com/iampf/pycon-2016
  • 歷史資料可從台灣期貨交易所、台灣證卷交易所
  • 分析資料:時間、開盤價、收盤價、最高價、最低價、成交量
  • 買賣情況分三種:買進、賣空、不動
  • itertools!!
  • np.convolve np.piecewise
  • multiprocess
  • GPU: PyCuda(還是要寫C!! orz)
  • Amcharts.js jQuery Flask Sqlite
  • 有問題可以找 pf@hst.tw

關於雲端轉檔


已有可用的套件
  • Gearman: 從 worker 出發的 workflow,但是workflow寫死在worker中了
  • Spotify Luigi
  • Others(Tractor, Celery…)
What we need
  • 不想管理 Job Server
    • 去中心化
    • 自我管理
    • 晚上好好睡覺 XD
  • Top-down: Wroker 可以根據需要,調整種類或需要

KKBOX 的 MASS 套件

關於python與深度學習

  • specific field of ML -> ANN -> deep ANN
  • ANN good at: classification problem
  • Tensor: n-dim arrary
DNN = a large matrix operations
You need distributed training
Google揭露首款自製機器學習專用晶片TPU

 關於機器學習與搜尋排序

  • 投影片
    搜尋引擎
  • indexing
  • 搜尋結果排序方式:
    • tf-idf term frequency–inverse document frequency
    • click model 點擊模型
    • PageRank
  • 萬一搜尋結果不理想
    • 初步想法就是去調特徵的權重
    • 加入更多特徵值
    • 訓練好主題模型,抽取出其特徵值再加入

關於MySQL高可用性方案

  • MySQL 高可用階層(可用性由上往下遞增)
    • Replication
    • Shared Disk / Virtualization Options
    • Group Replication
    • Cluster
  • MySQL Fabric
    • 做data shared
    • Fabric aware connection(支援java,php,python) 或是使用 MySQL Route
  • MySQL 5.7可做多源複製:
    • 使用場景,當有很多分公司或是搜集資料的master db,可以把資料都回傳給主公司的slave
  • Group Replication
    • 只支援InnoDB
    • 每個表都要有pk
    • 需要開啟GTID
    • 不能線上同時多地DDL
    • 交易會因為跟其他台衝突而中止
  • Cluster(架構由上而下)
    • client(PHP,python)
    • Application (MySQL, apache, java, nodes)
    • Data node

 關於機器學習

Scikit Learn 數字辨識

  1. Load data
  2. Set a classifier
  3. Laern a model
  4. Predict the result
  5. Evaluate
scikit learn 有很多 classifier,只需要參考 doc 給他參數就能夠使用了

前處理(對原始資料先做些處理)

  1. Clean data
  2. Feature extraction
  3. Convert category and string to number
  4. Sparse data
  5. Feature selection
raw data -> [前處理] -> 餵進去的向量

 關於Jupyter kernel: How to speak in another language

agenda

  1. Jupyter, IPython, notebook, console, clinet, kernel
  2. The Interactive Computing Protocol
  3. Implementing a kernet
  4. Live Demo

Jupyter

Client <- \(\varnothing MQ\) Socket -> Kernel
  • 也可以支援多個 client 連到相同的 Kernel 上面

What’s inside IPython

  • The interactive ipthon shell (No MQ
  • )
  • Magic commands, ( e.g. ls, pwd, cd )
  • Auto word completer
  • beautiful traceback
  • shell history management
IPyKernel’s repo

What’s inside jupyter

  • web-based notebook interface & nbconvert

interactive computing protocol

定義 kernel 和 client 要怎麼溝通
有提供一些 pattern: request, reply, …
  • i.e. jupyter messaging protocol
  • Communication between Kernel and Client
  • Base on MQ
  • and JSON
ClientClientKernelKernelDEALERSHELLROUTERSHELLDEALERPUBIOPubSUBIOPub 會推執行的 StatusROUTERstdinDEALERstdinROUTERDEALERcontrolROUTERcontrolDEALERREQheartbeatREPheartbeatREQ
Jupyter 官方說明

Kernel Types

  • Native Kernel
  • Python Wrapper Kernel
    • 在 IPyKernel 這個套件裡
  • REPL Wrapper Kernel

關於Async in python

async

  • 整個python都會變成async,沒有partial
  • is not parallelism
  • 3rd party support
  • 很難做unit test
    • 需要用decorator
    • add coverage to test code
    • consider asynctest
    • 使用pytest-asyncio 或 pytest
推pytest! (可參考Day1 R1 Talk: We Made the PyCon TW 2016 Website)

alternatives

  • concurrency with multiprocessing
  • Greenlets: 用coroutine做concurrency
  • threading
  • pypy: good choice,自動變multithread
async 會被 standard IO blcok

 關於第三方支付法律問題

  • 第三方支付平台的意義:擔保交易
  • 平台會同時管理資訊流及金流
  • 金管會 viewed it as 影子銀行
  • 影子銀行,做了銀行的功能,但不付銀行的責任
  • 第三方支付為特許行業(?),有資本額限制,專營限制
  • 支付機構收取款項後,只能作低風險投資(政府債券、定存⋯⋯),有法規禁止其他投資
  • 嚴格法令外,其他的遺留問題
    • 資本額限制過高,以致除銀行外,無其他參與者
    • 資本額:儲值型5億/支付型1億
    • 無法明顯與電子票證區隔
  • 分為陽春型/複雜型支付兩種
  • 電子支付:
    • 需要三個參與者:買賣雙方、中介
    • 有電子平台為仲介,款項之間的移轉
    • 僅有買賣雙方者,並不算電子支付(EX: 電子禮卷購買)
    • 記名
  • 電子票證:悠遊卡/一卡通/台灣通⋯⋯(不一定記名)
    • 記名、不記名
  • 電子支付與電子票證兩者功能重疊時,使用電子支付的法據(2015 年實施)
  • 案例:8591 (寶物交易)
    • 儲值功能被認為違反電子票證法規(符合「電子載具」定義)
    • 為避開電子票證法令,不使用儲值制,改用代收方式,因麻煩導致玩家出走
  • Q&A:
    • 金管會目前不認定比特幣為貨幣
    • app 儲值功能,哪些東西是包含在金流內?如果只是將資訊給銀行,這樣不會有金流問題。電商:金流、資訊流、物流。

沒有留言:

張貼留言

Google Analytics初學者入門簡介