For this project, we are going to use the results obtained from a previous project (Data weekly update with cron). This data is already in a Database and correspond to the USD-NTD exchange rate retrieved from a bank website.[1]
The goal of this project is to find groups in the data (clustering) implementing the K-Means Algorithm, and plot after achieves the result.
- Version 1.1
- Programming Language: PHP and Javascript.
Tools:
-
K-Means Algorith PHP Class: PHP class jacobemerick/kmeans
-
Visualizing K-Means Clustering: Javascript Highcharts charting library
-
A Data resource (Database): sql.txt file in the report can help.
Before continuing with the implementation, please take a look at the following article about K-Means Algorithm Introduction [2], this will help you to have an idea about what clustering is without knowledge of machine learning.
-
The data source: You can use your own scraping data or use the sql.txt example in this repo.
-
Retrieve the data and create data set.
-
The Result: clusteringall.php file contains how to use the jacobemerick/kmeans [3].Because later will be required a JSON object so we store the results as a JSON object (centroids and clusters).
###Visualizing K-Means Clustering ###
Highchart Implementation Script: The results (centroids and clusters) are stored in different variables to add it to the highchart configuration. We are using Highcharts API please check the references. [4]
This is an example of the plotting.
For further references of implementation please review the attached PDF file in the repo.
If you have any question regarding this implementation, correct english grammar mistakes, comments or would like to improve the code, please let me know.
[1]"歡迎來到**銀行全球資訊網 ─ 新臺幣/美元 銀行間收盤匯率", Cbc.gov.tw, 2017. [Online]. Available: http://www.cbc.gov.tw/lp.asp?CtNode=645&CtUnit=308&BaseDSD=32&mp=1&nowPag e=1&pagesize=50. [Accessed: 24- May- 2017].
[2]A. Trevino, "Introduction to K-means Clustering", Datascience.com, 2017. [Online]. Available: https://www.datascience.com/blog/introduction-to-k-means-clustering-algorithm-learn-data-science-tutorials. [Accessed: 24- May- 2017].
[3]"jacobemerick/kmeans", GitHub, 2017. [Online]. Available: https://github.com/jacobemerick/kmeans. [Accessed: 24- May- 2017].
[4]"Highcharts API Reference", Api.highcharts.com, 2017. [Online]. Available: http://api.highcharts.com/highcharts/. [Accessed: 24- May- 2017].