Tuesday, April 25, 2017

FB社團:AI

FB社團:AI

-----



◎ 台灣「人工智慧」社團
https://www.facebook.com/groups/Taiwan.AI.Group/?fref=ts 

台灣機器學習與人工智慧同好會
https://www.facebook.com/groups/1126153717456741/

人工智慧/自然語言處理/搜尋引擎
https://www.facebook.com/groups/959050367523488/?fref=ts

AI人工智慧與機器人社團
https://www.facebook.com/groups/1852135541678378/ 

人工智慧與機器人學習交流俱樂部
https://www.facebook.com/groups/205835109792195/

Deep Learning Taiwan
https://www.facebook.com/groups/twdnn/?fref=ts

OpenAI@TW
https://www.facebook.com/groups/259799017688463/?fref=ts

香港深度學習交流會 - Hong Kong Deep Learning Study Group
https://www.facebook.com/groups/170776840085989/

-----

TensorFlow Taiwan
https://www.facebook.com/groups/294714030866185/

TensorFlow Group
https://www.facebook.com/groups/tensorflowdevelopers/?fref=ts

GPU Taiwan Facebook
https://www.facebook.com/groups/marketing.gpu/

-----



人工知能応用研究室
https://www.facebook.com/groups/AIAppLab/

人工知能研究会 / AIR
https://www.facebook.com/groups/1024547137580925/

汎用人工知能について語ろう!
https://www.facebook.com/groups/sig.agi.jp/

--

◎ ロボットと人工知能のある社会
https://www.facebook.com/groups/813342132068841/

-----



AI Korea (Deep Learning)
https://www.facebook.com/groups/AIKoreaOpen/

--

TensorFlow KR
https://www.facebook.com/groups/TensorFlowKR/

딥러닝 오픈소스 스터디 (TensorFlow, Caffe 등)
https://www.facebook.com/groups/caffestudy/

-----



AI & Deep Learning Enthusiasts Bay Area
https://www.facebook.com/groups/1691724667816799/?fref=ts

Artificial Intelligence & Deep Learning
https://www.facebook.com/groups/DeepNetGroup/?fref=ts

Deep AI
https://www.facebook.com/groups/DeepAI/

Deep learning
https://www.facebook.com/groups/DeepLearnng/?fref=ts

Deep Learning / AI
https://www.facebook.com/groups/1738168866424224/

HH Machine Learning and Artificial Intelligence
https://www.facebook.com/groups/hhmachinelearning/?fref=ts

Nvidia Deep Learning
https://www.facebook.com/groups/NvidiaDL/

Strong Artificial Intelligence
https://www.facebook.com/groups/strongartificialintelligence/?fref=ts

Wit.ai Hackers
https://www.facebook.com/groups/withackers/?fref=ts

-----



Deep Learning & Artificial Intelligence Germany
https://www.facebook.com/groups/939105009506344/?fref=ts
 
-----



Intelligence Artificielle, Neurotechnologie, Robotique et Transhumanisme
https://www.facebook.com/groups/1655802661300145/

-----



Deep Learning Italia
https://www.facebook.com/groups/196584677432705/?fref=ts

-----

西



-----




-----

希伯來

Machine & Deep learning Israel
https://www.facebook.com/groups/543283492502370/?fref=ts

-----

FB社團:其他技術:

Android Developer開發讀書會
https://www.facebook.com/groups/523386591081376/

Angular User Group Taiwan
https://www.facebook.com/groups/augularjs.tw/

◎ AWS User Group Taiwan
https://www.facebook.com/groups/awsugtw/

◎ Azure Taiwan User Group
https://www.facebook.com/groups/AzureTWUG/

Backend 台灣 (Backend Tw)
https://www.facebook.com/groups/616369245163622/

Computer Vision Taiwanese Group
https://www.facebook.com/groups/112719202116662/

◎ GCPUG.TW(Google Cloud Platform User Group Taiwan)
https://www.facebook.com/groups/GCPUG.TW/

golang
https://www.facebook.com/groups/golanggonuts/?fref=ts

Front-End Developers Taiwan
https://www.facebook.com/groups/f2e.tw/

Golang Gopher Taiwan
https://www.facebook.com/groups/1667684473462867/

Go程式語言 (Golang Taiwan, Gopher Taipei)
https://www.facebook.com/groups/269001993248363/?fref=ts 


Julia Taiwan
https://www.facebook.com/groups/1787971081482186/

Python Taiwan
https://www.facebook.com/groups/pythontw/
 
Taiwan Hadoop User Group
https://www.facebook.com/groups/hadoop.tw/
 
Taiwan Machine Learning for Everything
https://www.facebook.com/groups/582156785222935/ 

Taiwan Spark User Group
https://www.facebook.com/groups/spark.tw/

大數據與數位決策(Big Data & Digital Decisions)
https://www.facebook.com/groups/BDD.UNISON/

讀書肚(dosudo)- 矽谷工程師讀書會
https://www.facebook.com/groups/dosudo/ 

Monday, April 24, 2017

AI從頭學(二二):Azure Machine Learning - Clustering

AI從頭學(二二):Azure Machine Learning - Clustering

2017/04/24

前言:

本文跟 ML(AI的一支)、Azure、Python 有關,將同步發表在 FB 相關社群。

-----

Summary:

Machine Learning (ML) 基本上屬於 AI 的一支 [1]。本文主要試圖透過 Python 使用 Azure 的 ML 服務 [2], [3]。本次將介紹 Clustering 的 k-means algorithm [4], [5]。

-----

Outline:

1: Introduction to Data Science
2: Introducing Microsoft Azure Machine Learning
3: Data Preparation
5: Integration with Python
6: Introduction to Statistical and Machine Learning Algorithms
 - Clustering Algorithms

-----

在進入主題之前,我們先介紹 [2] 這本書的架構,參考圖1.1。

前面兩章是簡介。第三章是資料預處理,這一章雖然沒有圖,但很重要。第四章是與 R 的連接,雖然重要,但後續有用到時才會介紹。第五章是透過 Python 使用 Azure 的 ML 服務,這是本次的重點之一。在第六章有各種 ML 演算法,都很重要,本次介紹 Clustering 的 k-means algorithm。

另外第十二章是 recommendation systems,由於這個工作上也有需求,將會在下次專文介紹。



Fig. 1.1. Azure Machine Learning [2].

-----

在進入主題之前,我們還是先簡單介紹一下 ML 的流程,參考圖1.2。首先資料會預處理,然後分成兩群,一群用來訓練 Model,當 Model 訓練完畢,另外一群用來測試。最後評估 Model 是否合用。圖1.3 用到 R,請自行參考。

資料預處理,也可以在跑完後重新做。參考圖2.1,當我們把 dayWeek 這一項移除後,整體的解析(相關度的呈現),就提高了,參考圖2.2。



Fig. 1.2. A generalized model training workflow for Azure ML models, p. 5 [3].



Fig. 1.3. Workflow for an R model in Azure ML, p. 7 [3].



Fig. 2.1. Plot of correlation matrix, p. 16 [3].



Fig. 2.2. Plot of correlation matrix without dayWeek variable, p. 16 [3].

-----

1: Introduction to Data Science

首先定義資料科學,參考圖3.1。廣義的資料科學可包括數學、信號處理、機器學習、科學計算、統計學、作業研究、程式、資料庫、以及語言學。

資料分析可分為四個層次,參考圖3.2。第一是描述,第二是診斷,第三是預測、第四是規範。

描述的話,以分群演算法為例,它將資料自動分成幾群。

診斷的部分先跳過。

預測是重點,這裡有幾個演算法:線性迴歸、邏輯迴歸、神經網路、支持向量機,都是用來預測的。

最後是規範,這裡舉出的例子是 Monte Carlo,這個方法,AlphaGo 也有用到 [6]。

圖3.3舉出一個企業應用的實例。分別用 Churn Model、Segmentation Model、以及 Propensity Model 來幫助企業找出有問題的客戶跟高價值的客戶。這本分別在第九章、第十章、第七章 [2],未來有機會將會一一介紹。

圖3.4是資料科學的循環圖,大體上就是圖1.2不斷循環。



Fig. 3.1. Highlighting the main academic disciplines that constitute data science, p. 4 [2].



Fig. 3.2. Spectrum of all data analysis, p. 5 [2].



Fig. 3.3. A smart telco using prescriptive analytics, p. 6 [2].



Fig. 3.4. Overview of the data science process, p. 13 [2].

-----

2: Introducing Microsoft Azure Machine Learning

在進入 Azure 之前,我們先來看一下 ML,以 Clustering 為範例,分群後配合特徵,這裡是年齡跟玩 game 的強度,則可界定潛在的消費者或客戶,參考圖4.1。

Azure 對於 ML,有提供圖像化的服務,能把圖1.2的演算法,在螢幕上實現,參考圖4.2。訓練好的模型,可以存起來,參考圖4.3,也可以發佈,參考圖4.4。



Fig. 4.1. Simple hypothetical customer segments from a clustering algorithm, p. 15 [2].



Fig. 4.2. Regression Model experiment, p. 37 [2].



Fig. 4.3. The experiment that uses the saved training model, p. 39 [2].



Fig. 4.4. A dialog box that promotes the machine learning model from the staging server to a live production web service, p. 40 [2].

-----

3: Data Preparation 

資料預處理很重要,而且一定會遇到,這裡簡單舉幾個例子:

1. 資料不見了。
2. 資料的值是空的。
3. 有重複的資料。
4. Outliers (跟大部分資料值差距太大的)。
5. 正規化。書中舉出幾個方法可以使用:Zscore、MinMax、Logistic、LogNormal、Tanh。也許這個觀念一時不容易,但這個老師調分數就可以活用了!

-----

5: Integration with Python

要達到客製化的需求,最好還是自己 coding。

圖5.1a是用 Python 存取一個 Azure 上的資料檔,並將其值呈現在螢幕上,圖5.1b則是透過 numpy 與 matplotlib 將資料圖像化。

圖5.2是一個完整的 Python 程式,可以存取兩個資料檔,並對其運算。參考圖5.3。



Fig. 5.1a. Viewing the content of the dataframe, p. 114 [2].



Fig. 5.1b. Using the pandas dataframe plot method, p. 115 [2].



Fig. 5.2a. Complete Python Code for the Experiment, p. 125 [2].



Fig. 5.2b. Complete Python Code for the Experiment, p. 126 [2].



Fig. 5.3. Using the Execute Python Script, p. 128 [2].

-----

6: Introduction to Statistical and Machine Learning Algorithms
 - Clustering Algorithms

本節講解 Clustering 的 k-means algorithm。

以圖6.1a為例,這裡有三群,但是如何寫程式將這三群分開來呢?

1. 如果要分成三群,首先要指定三個群的中心,這個中心可以是隨機指定。

2. 第二個步驟,計算每個點到這三個中心的距離,距離最短者,則屬於這個中心這一群。

3. 群分好了,接下來重新計算這三個群的中心。

4. 重複步驟2跟3。一直到最後,或者誤差很小。

可以參考圖6.1b、6.3a、6.3b的演算法。

圖6.3c是 Python 的實現,原則上只要設定相關的參數即可。



Fig. 6.1a. Dataset for k-means clustering, p. 147 [2].



Fig. 6.1b. Iterations of the k-means clustering algorithm with k=3 in which the cluster centroids are moving to minimize error, p. 147 [2].



Fig. 6.2. The k-means clustering algorithm, p. 335 [4].



Fig. 6.3a. The k-means clustering algorithm, p. 313 [5].



Fig. 6.3b. within-cluster sum of squared errors (SSE), p. 314 [5].



Fig. 6.3c. KMeans class from scikit-learn's cluster module, p. 314 [5].

-----

Clonclusion:

所以,在 Azure 上跑 ML 沒有很難吧!:)

-----

References

[1] AI從頭學(二一):A Glance at Deep Reinforcement Learning
http://hemingwang.blogspot.tw/2017/04/aia-glance-at-deep-reinforcement.html

[2] 2015_Predictive analytics with Microsoft azure machine learning, build and deploy actionable solutions in minutes

[3] 2015_Data Science in the Cloud with Microsoft Azure Machine Learning and R

[4] 2016_Practical Machine Learning

[5] 2015_Python Machine Learning

[6] AI從頭學(一一):A Glance at Deep Learning
http://hemingwang.blogspot.tw/2017/02/aia-glance-at-deep-learning.html