《説文解字》:壬,位北方也。陰極陽生 ,故《易》曰:“龍戰于野。”戰者,接也 。象人褢妊之形。承亥壬以子,生之敘也 。與巫同意。壬承辛,象人脛。脛,任體也。凡壬之屬皆从壬。
本義:善於使用巧具,勝任事務。
《論語》‧泰伯第八
曾子曰:士不可以不弘毅,任重而道遠,仁以為己任,不亦重乎!死而後已,不亦遠乎!
曾子曰:以能問於不能,以多問於寡;有若無,實若虛,犯而不校;昔者吾友【顏淵】,嘗從事於斯矣。
假使不知道『仁』的『當量』,要如何計算『一輩子』為己任,能有多『重』呢?又不知道是否以『天下』為己任,『一生』又將走多『遠』的呢??然而這卻不礙『會意』,即使以待『一人之仁』之『重』對當於『那人體重』來算,想來大概也心中有數的了!
宋代釋贊寧《宋高僧傳》中記載李渤任江州刺史時曾與白居易一起去拜訪過智常禪師:李問曰:『教中有言,須彌納芥子芥子納須彌,如何芥子納得須彌?』常曰: 『人言博士學覽萬卷書籍還是否耶?』李曰:『忝此虛名。』常曰:『摩踵至頂只若干尺身,萬卷書向何處著?』李俯首無言。再思稱嘆。
就像老子所講的︰『虛其心,實其腹。』,正是顏淵學習之態度︰『有若無,實若虛』,豈非『芥子』之『心』可納『須彌』 的耶 !妙哉,大自然 在 1 公克 DNA 中可以儲存 360 EB 的信息量!!據聞物理學『弦論』中的『全像原理』 Holographic principle 述說著人類目前尚未理解的奧秘︰
全像原理認為目前所見的宇宙是真實宇宙的投影。以較宏觀的觀點來看,此原理指出了整個宇宙可視為一個呈現在宇宙學視界上的二維資訊結構,而日常觀察到的三維空間則是巨觀尺度且低能量的有效描述。值得注意的是,宇宙學全像原理在數學上仍未達精確。
,果真是宇宙人生現象之『大數據』 Big data 的哩!!
IBM 對維基百科的編輯紀錄資料進行視覺化的呈現。維基百科上總計數兆位元組的文字和圖片正是大資料的例子之一
全球資訊儲存容量成長圖
Cartoon critical of big data application, by T. Gregorius
【定義】是
大數據由巨型資料集組成,這些資料集大小常超出人類在可接受時間下的收集、庋用、管理和處理能力。大數據的大小經常改變 ,截至 2012 年,單一資料集的大小從數兆位元組(TB)至數十兆億位元組(PB)不等。
在一份 2001 年的研究與相關的演講中,麥塔集團 ( META Group,現為高德納)分析員道格‧萊尼(Doug Laney)指出資料增長的挑戰和機遇有三個方向:量(Volume,資料大小)、速(Velocity,資料輸入輸出的速度)與多變(Variety,多樣性),合稱「 3V 」或「 3Vs 」。高德納與現在大部份大數據產業中的公司,都繼續使用 3V 來描述大數據。高德納於 2012 年修改了對大數據的定義:「大數據是大量、高速、及/或多變的資訊資產,它需要新型的處理方式去促成更強的決策能力、洞察力與最佳化處理。」另外,有機構在 3V 之外定義了第 4 個 V:真實性(Veracity)為第四特點。
大數據必須藉由計算機對資料進行統計、比對、解析方能得出客觀結果。美國在 2012 年就開始著手大數據,歐巴馬更在同年投入 2 億美金在大數據的開發中,更強調大數據會是之後的未來石油。
資料探勘(data mining)則是在探討用以解析大數據的方法。
【應用範例】
大資料的應用範例包括大科學、RFID、感測裝置網路、天文學、大氣學、基因組學、生物學、大社會資料分析、網際網 路檔案處理、製作網際網路搜尋引擎索引、通訊記錄明細、軍事偵查、社群網路 、通勤時間預測、醫療記錄、相片圖像和影像封存、大規模的電子商務等。
【人性關切】
大 數據時代的來臨帶來無數的機遇,但是與此同時個人或機構的隱私權也極有可能受到衝擊,大數據包含了各種個人資訊資料,現有的隱私保護法律或政策無力解決這 些新出現的問題。有人提出,大數據時代,個人是否擁有「被遺忘權」,被遺忘權即是否有權利要求資料商不保留自己的某些資訊,大數據時代資訊為某些網際網路巨頭所控制,但是資料商收集任何資料未必都獲得用戶的許可,其對資料的控制權不具有合法性。 2014 年 5 月 13 日歐盟法院就「被遺忘權」(right to be forgotten)一案作出裁定,判決 Google應根據用戶請求刪除不完整的、無關緊要的、不相關的資料以保證資料不出現在搜尋結果中。這說明在大數 據時代,加強對用戶個人權利的尊重才是時勢所趨的潮流。
無論人們喜歡與否,我們已經活在了『大數據』的『礦坑』之中,我們本身就是『資訊礦石』。舉例來說,許多便利商店裝設著資訊收集、分析、儲存……的『攝像鏡頭』,用著『影像辨識』的科技追蹤『消費者』之『視線』,分析『消費者』的性別、年齡、喜好 ……等等數據,可用於廣告、促銷、商品管理……種種用途,企圖達到『別家』或『門可羅雀』,此處卻『人滿為患』的成效。那麼這是『合理』的嗎?應該『同意』的嗎??想像未來當你進入一個『賣場』,你的『手機』就已經告訴你今天有哪些你『喜歡』的『食品』正在『特價』,挑動著你的『感性欲望』;或許由於其它非食品業 APP 軟體廠商的大力『宣傳』,你的『手機』上也有那種分析『食品』對『身體健康』影響的 APP,它正提醒你的『理性』再吃就『超標』了……這難道不是…資訊轟炸……更像是……擺脫不掉,自己找來的麻煩!!
也許那還是自己可以選擇之『好』的一面。因為不是所有人利用『大數據』來『淘金』,都具有『專業訓練』以及『道德良心』。因此常有『□□ 研究』的『數據』『證實』吃『○○食品』能降低『☆☆指數』如何?如之何的『廣告』??一旦發生了『事故』,大概全成了那是『個案』以及『例外』的了。就像『風起雲湧』,天未必會下雨,『艷陽高照』,未必天就不下雨。比方說『徵候』是講時間『先行』的『現象』,與伴隨該『現象』之後『而來』的『現象』,『現象』之間可能會有『統計相關性』,但不一定具有什麼『因果關係』。或許可以讀一讀 《知未知‧既未濟》所言︰
就讓我們談談一個『氣質』或『人格』是不是與『血型』『相關』的科學『爭論』。
大約兩千五百年前,古希臘傑出的醫生希波克拉底 Ἱπποκράτης 認為︰
人的體內有四條『河流』,流著『血液』、『黑膽汁』、『黃膽汁』和『黏液』,疾病起因於這四液『失調』的結果,直 至平衡回復方能痊癒。同時這四條河之流速又有『快』、『慢』、『緩』與『急』,通常人之四液或有偏盛,假使某液佔了上風,就會展現該流的風采面貌,決定該人的『氣質』。『膽汁質』的人黃膽汁過盛,『暴躁有力』;『多血質』的人血液充沛,『靈活多變』;『黏液質』的人黏液太多,『穩定遲緩』;『抑鬱質』的人黑膽汁為主,『孱弱心細』。
在人類醫療史上,『輸血』是一個很古老的方法,但是人輸血給人,有時結果卻非常的糟糕,所以也曾經有過禁止輸血的法律。奧地利著名醫學家卡爾‧蘭德斯坦納 Karl Landsteiner 一九零一年發現了A、B、O、AB 四種血型中的 ABO ,後於一九三零年獲得諾貝爾醫學及生理學 獎。一個人的血型只能是四種其中的某型,它有遺傳性而且終生不變。就輸血上而言,同型的血可以互相輸血;O型 的血可以輸給其它三種血型,但自己只能接受O型的血;A型或B型的血可以輸給AB型的人;除上述之外的輸血情況,都會因抗體反應而凝集形成血栓,阻塞血管 致人於死。一九二七年日本的古川竹二將這四種血型與那四種氣質再次連繫起來,以大量調查的資料為基礎提出『血型之氣質說』。此後引起了許多人的興趣,因為此項研究進入人類學上廣闊的『未知之地』。但是又有很多學者認為,這個學說並沒有多少科學根據。主要的爭論的癥結點在於︰
為什麼『血型』能決定人的『氣質』或者說『性格』的呢?它們的『內在聯繫』到底是什麼?血型能遺傳,但是性格並不能。即使父母的『習慣』尚且不能決定子女的『性格』,所以事實上該是︰周遭『環境』帶來了『刺激』之因,而這個『經驗』之果才塑造了『性格』。此外,人的一輩子只有『一種』血型,卻可能有『多重』人格。
這個爭論看來並不在於『血型』與『性格』有沒有統計上的『相關性』,而在於這個『因果』是『如何』相干的呢?會不會是類似像『虛假原因』所產生的『因果謬誤』呢?舉例來說︰
『坐輪椅』很危險,因為『坐輪椅』的人都很容易『出車禍』。
以為『坐輪椅 → 出車禍』,難道不該是︰
『出車禍』的人才會『坐輪椅』。
所以必須釐清許多事情,比方探討著『假使○與□統計相關,它們又是那樣不同種類的事物,是否有著什麼☆居間,然後○→☆→□的呢?』。就像說花的『花期』決定了『開花』的時期,事實上並非是所說的那個『日期』所決定的,而是『這個日期』一般會有的『溫度』、『濕度』或是『壓力』等等決定的。觀察現今的『氣候變遷』怕會『提前』或『延後』花訊,甚至會引起『糧食』短缺的大問題啊!!
因此『大數據』是『煉金』的『巫術』還是『煉金』之『科學』的呢?決定於『使用』與『解析』『大數據』之『方法學』,立足在『解釋』上需要的『統計推理』,真的是一個必須『慎思明辨』的『大問題』ㄚ˙??否則從
『青蛙』的數據庫,可以得出
一嘴︰兩眼︰四隻腳,可以用於
貓、狗、……等等動物,彷彿也可以用之於
人!但是
八腳章魚該怎麼辦呢!!是個
例外?那麼
蜘蛛呢??都還沒問到
雞、鴨、鵝……的哩。
『大數據』的確是『任重』而『道遠』,就讓我們介紹那熊熊烈火『派生火焰』 Python blaze 的吧!照亮『大數據』『科學』之道路 !!
Blaze translates a subset of modified NumPy and Pandas-like syntax to databases and other computing systems. Blaze allows Python users a familiar interface to query data living in other data storage systems.
Overview
Blaze Abstracts Computation and Storage
Several projects provide rich and performant data analytics. Competition between these projects gives rise to a vibrant and dynamic ecosystem. Blaze augments this ecosystem with a uniform and adaptable interface. Blaze orchestrates computation and data access among these external projects. It provides a consistent backdrop to build standard interfaces usable by the current Python community.
Demonstration
Blaze separates the computations that we want to perform:
>>> from blaze import * >>> accounts = Symbol('accounts', 'var * {id: int, name: string, amount: int}') >>> deadbeats = accounts[accounts.amount < 0].name
From the representation of data
>>> L = [[1, 'Alice', 100], ... [2, 'Bob', -200], ... [3, 'Charlie', 300], ... [4, 'Denis', 400], ... [5, 'Edith', -500]]
Blaze enables users to solve data-oriented problems
>>> list(compute(deadbeats, L)) ['Bob', 'Edith']
But the separation of expression from data allows us to switch between different backends.
Here we solve the same problem using Pandas instead of Pure Python.
>>> df = DataFrame(L, columns=['id', 'name', 'amount']) >>> compute(deadbeats, df) 1 Bob 4 Edith Name: name, dtype: object
Blaze doesn’t compute these results, Blaze intelligently drives other projects to compute them instead. These projects range from simple Pure Python iterators to powerful distributed Spark clusters. Blaze is built to be extended to new systems as they evolve.
Scope
Blaze speaks Python and Pandas as seen above and also several other technologies, including NumPy, SQL, Mongo, Spark, PyTables, etc.. Blaze is built to make connecting to a new technology easy.
Blaze currently targets database and array technologies used for analytic queries. It strives to orchestrate and provide interfaces on top of and in between other computational systems. We provide performance by providing data scientists with intuitive access to a variety of tools.
【安裝方法】
# 避免 python 套件衝突,使用派生虛擬環境 pi@raspberrypi ~ $ sudo pip install virtualenv virtualenvwrapper /usr/local/lib/python2.7/dist-packages/pip-6.1.1-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning Collecting virtualenv /usr/local/lib/python2.7/dist-packages/pip-6.1.1-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning Downloading virtualenv-12.1.1-py2.py3-none-any.whl (1.6MB) 100% |████████████████████████████████| 1.6MB 20kB/s Collecting virtualenvwrapper Downloading virtualenvwrapper-4.5.1-py2.py3-none-any.whl Collecting virtualenv-clone (from virtualenvwrapper) Downloading virtualenv-clone-0.2.5.tar.gz Collecting stevedore (from virtualenvwrapper) Downloading stevedore-1.4.0-py2.py3-none-any.whl Requirement already satisfied (use --upgrade to upgrade): argparse in /usr/lib/python2.7 (from stevedore->virtualenvwrapper) Collecting six>=1.9.0 (from stevedore->virtualenvwrapper) Downloading six-1.9.0-py2.py3-none-any.whl Collecting pbr!=0.7,<1.0,>=0.6 (from stevedore->virtualenvwrapper) Downloading pbr-0.11.0-py2.py3-none-any.whl (78kB) 100% |████████████████████████████████| 81kB 78kB/s Requirement already satisfied (use --upgrade to upgrade): pip in /usr/local/lib/python2.7/dist-packages/pip-6.1.1-py2.7.egg (from pbr!=0.7,<1.0,>=0.6->stevedore->virtualenvwrapper) Installing collected packages: virtualenv, virtualenv-clone, six, pbr, stevedore, virtualenvwrapper Running setup.py install for virtualenv-clone Successfully installed pbr-0.11.0 six-1.9.0 stevedore-1.4.0 virtualenv-12.1.1 virtualenv-clone-0.2.5 virtualenvwrapper-4.5.1 # 設定使用環境 pi@raspberrypi ~ $ nano .profile pi@raspberrypi ~ $ source ~/.profile # 創建 blaze 虛擬環境 pi@raspberrypi ~ $ mkvirtualenv blaze New python executable in blaze/bin/python Installing setuptools, pip...done. # 安裝 blaze 套件 (blaze)pi@raspberrypi ~ $ pip install blaze /home/pi/.virtualenvs/blaze/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning Collecting blaze /home/pi/.virtualenvs/blaze/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning Using cached blaze-0.8.0.tar.gz Collecting numpy>=1.7 (from blaze) Using cached numpy-1.9.2.tar.gz Collecting pandas>=0.15.0 (from blaze) Using cached pandas-0.16.0.tar.gz Collecting datashape>=0.4.4 (from blaze) /home/pi/.virtualenvs/blaze/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning Downloading datashape-0.4.5.tar.gz (72kB) 100% |████████████████████████████████| 73kB 295kB/s Collecting odo>=0.3.2 (from blaze) Downloading odo-0.3.2.zip (142kB) 100% |████████████████████████████████| 143kB 172kB/s Collecting toolz (from blaze) Downloading toolz-0.7.1.tar.gz Collecting multipledispatch>=0.4.7 (from blaze) Downloading multipledispatch-0.4.7.tar.gz Collecting sqlalchemy>=0.8.0 (from blaze) Downloading SQLAlchemy-1.0.4.tar.gz (4.6MB) 100% |████████████████████████████████| 4.6MB 12kB/s Collecting psutil (from blaze) Downloading psutil-2.2.1.tar.gz (223kB) 100% |████████████████████████████████| 225kB 176kB/s Collecting python-dateutil (from pandas>=0.15.0->blaze) Downloading python_dateutil-2.4.2-py2.py3-none-any.whl (188kB) 100% |████████████████████████████████| 192kB 129kB/s Collecting pytz>=2011k (from pandas>=0.15.0->blaze) Downloading pytz-2015.2-py2.py3-none-any.whl (476kB) 100% |████████████████████████████████| 479kB 85kB/s Collecting networkx (from odo>=0.3.2->blaze) Downloading networkx-1.9.1-py2.py3-none-any.whl (1.2MB) 100% |████████████████████████████████| 1.2MB 41kB/s Collecting six>=1.5 (from python-dateutil->pandas>=0.15.0->blaze) Downloading six-1.9.0-py2.py3-none-any.whl Collecting decorator>=3.4.0 (from networkx->odo>=0.3.2->blaze) Downloading decorator-3.4.2.tar.gz Installing collected packages: numpy, six, python-dateutil, pytz, pandas, multipledispatch, datashape, toolz, decorator, networkx, odo, sqlalchemy, psutil, blaze Running setup.py install for numpy Running setup.py install for pandas Running setup.py install for multipledispatch Running setup.py install for datashape Running setup.py install for toolz Running setup.py install for decorator Running setup.py install for odo Running setup.py install for sqlalchemy Running setup.py install for psutil Running setup.py install for blaze Successfully installed blaze-0.8.0 datashape-0.4.5 decorator-3.4.2 multipledispatch-0.4.7 networkx-1.9.1 numpy-1.9.2 odo-0.3.2 pandas-0.16.0 psutil-2.2.1 python-dateutil-2.4.2 pytz-2015.2 six-1.9.0 sqlalchemy-1.0.4 toolz-0.7.1 # 安裝 flask 套件 (blaze)pi@raspberrypi ~ $ pip install flask # 大膽嚐鮮 (blaze)pi@raspberrypi ~ $ python
【火焰嚐鮮】
blaze – Data Blending and Analysis
Dr. Yves J. Hilpisch
The Python Quants GmbH
※ 有些 columns 必須改成 fields 。