Dataiku DSS 入門教學(一)

CHIEN CHUN-YU
5 min readDec 19, 2019

--

今天要來介紹的就是 Dataiku Data Science Studio 基礎教學, 如果你對 DATA 這種神祕的東西充滿著好奇心,來玩玩這個平台會讓你對資料處理數據分析模型訓練、調參、預測 甚至整個 Data Pipeline 更有概念呢 ! 下圖就是透過 DSS Server 所產生的 Flow 也就是剛所以提及的 Pipeline,對於合作上也是非常重要的視覺化流程. 點我開始試試看吧!

Dataiku DSS

Dataiku DSS 算是在本地或雲端上的一種軟體,他的基礎主要是像 data stack 的概念,那什麼是 data stack ? 其實就是可進行 載入(loading)、數據倉庫(data warehouse)、轉換(transforming)、分析及商業智能(analysis and business intelligence) 的一間廚房,很特別吧? 也就是我會把原本看似沒有用的資料轉成有價值的特徵去做訓練預測甚至可視化。講白話一點好了! 假設我們要做一個蛋糕好了,透過這間廚房,我們把原本像是麵粉、雞蛋、奶油..的原料變成可食用的甜點。

  1. Loading: move data from one place to another.
  2. Warehousing: store it all in one place, usually on the cloud.
  3. Transforming: turn it into edible data.
  4. Analysis & Business Intelligence: serve it up to teams

Dataiku DSS is an on-premises/on-cloud software product (not SaaS) that operates as part of your data stack’s existing infrastructure.

A data stack typically includes development, production, and deployment environments; in order to work across these environments, a separate instance of Dataiku DSS is installed in each environment.

甚麼是 Data ?

資料資料資料 ! 因為很重要所以講三次! 我們分析資料時,當然必須先了解甚麼是資料? 其實資料就是客戶資訊、客戶購買紀錄、部落格留言、圖片、影音…等,其實資料又可分為結構性資料(相同架構的一系列紀錄,儲存的資料庫通常是 MySQL、PostgreSQL…)非結構性資料(留言、圖片、影片..,有點像是 RAW Data 的概念,儲存的資料庫通常是 MongDB、NoSQL..). 當然強大的 Dataiku DSS 可針對這兩種資料類型做處理.

Dataiku DSS allows you to work with data that is structured or unstructured.

(1) Structured data is a series of records with the same schema. In Dataiku DSS, such data is referred to as a dataset.

(2) Unstructured data can have an internal structure, but the entries do not necessarily have the same schema. Examples of unstructured data are images, video, audio, and so forth.

DSS Server Data Computation Principle(資料計算原理)

如果你今天是 Big Data 該怎麼辦? 當然 Dataiku DSS 也是有針對 Big Data 角度設計,也就是基於 Hadoop on HDFS 之原理所設計。

However, when dealing with big data, you want to push the computation to the data as much as possible. Computing engines like Hadoop on HDFS follow this principle, and are specifically designed for big-data computing. Pig or Hive recipes, which run in-cluster, are well-suited for big data computing.

DSS Server 三元素 Dataset、Recipe、Flow

嘿嘿嘿~那我的重點來了! Dataiku DSS 主要由重要的三個元素所組成來的,也就是 Dataset、Recipe、Flow ! 記住這個~在資料處理的運用上會非常實用~由下圖就可很明顯看到這三個部份,我們在使用平台時會時常使用到。

Flow、Recipe、Dataset

Dataset

資料集部分主要透過 tabular 的方式作呈現,包含了資料的存取與視覺化..等,除了檔案上傳以外也可透過連接資料庫的方式取得 dataset。連接的資料庫包含了 file system、SQL database、Hadoop..等內外部資料庫,檔案格式的上傳部分也包羅萬象,像是 CSV、JSON、Hadoop file format..等。

那如果我今天建立好 connection(假設今天與 PostgreSQL 資料庫連線 ) 的話,我能怎麼取得資料庫裡的資料呢? DSS Server 提供兩種方式,一種是取得特定 Table 另一種則是下 SQL 指令獲得,當然也會提供 preview 給你確認是否是你要存取的資料囉,如下圖所示。

PostgreSQL Create Dataset

A Dataiku DSS dataset is a tabular view into your data that allows you to access, visualize and write data in the same way, regardless of the underlying storage system. You can connect to a variety of storage systems (file system, SQL database, Hadoop, etc), and file formats (CSV, JSON, Hadoop file formats, etc).

Recipe (Visual Recipe、Code Recipe、Other recipe)

Recipe 中文叫食譜,可見..可透過它把原料變成一道料理呢! 也就是上面 data stack 所提到的 transforming。基本上 recipe 就是由好幾個 step 所組成的 action,也可以說是 action 的集合,當然資料處理一定包含了可進行 prepare、join 或 group..等。而 DSS Server 上主要提供了 visual recipe 和 code recipe ..等。

  • visual recipe 屬於可較快建立轉換資料的食譜,也就是較為常用或基礎的資料處理
  • code recipe 屬於必須寫扣的食譜,當然它較能達到使用者的特殊需求,故也相對比較進階
Recipe

A Dataiku DSS recipe is a set of actions to perform on one or more input datasets, resulting in one or more output datasets. Each time you prepare, join, group… your datasets, this will be through a recipe. A recipe can be visual or code.

  • A visual recipe allows a quick and interactive transformation of the input dataset through a number of prepackaged operations available in a visual interface.
  • A code recipe allows a user with coding skills to go beyond visual recipe functionality to take control of the transformation using any supported language (SQL, Python, R, etc).

Dataiku allows “coders” and “clickers” to seamlessly collaborate on the same project through code and visual recipes.

Flow

Flow

以上為 Flow (也可稱為 pipeline)的視覺化,也就是將整個資料來源、資料處理、特徵擷取、訓練模型甚至預測作簡易的呈現,故在協同合作上非常地有價值,當然我們還是得靠著類似 bridge 的 recipe 來產生這樣的流程。

The lineage of a dataset (or a model) is thus defined by the inputs and outputs of its ancestor recipes. The Flow is a visual representation of your work as a set of dependencies between datasets and the recipes used to produce them.

Lab Visual Analysis(視覺化分析)

這部分有點像是草稿的概念,可先進行像是前面所提及的 recipe 部屬,當然主是要針對 visual recipe 的部分。那另外特別要提的是建構 model 也是在這邊做分析的,如果你今天要訓練一個 model 我們會在這邊進行。如下圖可看到紅色圈起來的部分就是我們在訓練模型所需要點選的區塊。如果好奇到底是怎麼訓練與部屬的,別懷疑! 快去下載來玩玩看^^

Model Training

The Visual Analysis lab allows you to experiment with your data in a code-free environment where you can:

  • Perform interactive analyses with built-in charts and data preparation (cleaning, filtering, enriching). These steps can be deployed to the Flow as Prepare recipes.
  • Use machine learning algorithms (unsupervised and supervised training) to generate insights and build predictive models. These models can be deployed to the Flow.

Different kinds of modeling tasks(可針對不同演算法建構模型)

圖一 Task
圖二 Prediction Style
圖三 Automated Machine Learning

其實它裡面有分為 prediction 或者 clustering 兩種(圖一),基本上兩種的選取架構都類似。以 prediction(圖二) 為例,裡面必須先設定 target variable 預測欄位,接下來選取 Prediction Style(automated machine learning 或者 expert model) 兩者差別在 expert model 更進階一點,而如果點選 automated machine learning(圖三) 的話,他會列出三個選項 quick prototypes(訓練較快的 model) 、interpretable model(可解釋性的 model)、high performance model(精確性較高但可能訓練時間也會較長) ,對初學者而言我建議選擇 quick prototypes 會比較好上手。是不是開始覺得~哇! 機器學習的演算法真的各有優缺點呢而且還很多呢=3=

Prediction models are learning algorithms that are supervised, e.g. they are trained on past examples for which the actual values (the target column) is known. The nature of the target variable will drive the kind of prediction task.

  • Regression is used to predict a real-valued quantity (i.e a duration, a quantity, an amount spent…).
  • Two-class classification is used to predict a boolean quantity (i.e presence / absence, yes / no…).
  • Multiclass classification is used to predict a variable with a finite set of values (red/blue/green, small/medium/big…).

Clustering models are inferring a function to describe hidden structure from “unlabeled” data. These unsupervised learning algorithms are grouping similar rows given features.

Extra(補充)

如果你的作業系統是 windows 參考 Dataiku DSS for Windows ,基本上就是使用 virtual machine(virtualbox 或 vmware) 的方式,將 dataiku image import 進去,即可將其架設起來~

而在 Dataset 的部分,如果你要連外部或本地的資料庫,由於 DSS Server 只提供了 PostgreSQL、 SQlite..等 driver,因此像 MySQL 或 SQL Server..等就必須去下載 JDBC drivers,請參考此網址

Conclusion(結言)

恭喜你完成閱讀! 我相信你對 Dataiku DSS 已經有一些基本概念,如果你看完入門教學(一),覺得很有興趣! 那休息一下,快前往入門教學(二)吧 ! 它將帶領你了解更多關於 Dataiku DSS 的世界~

非常感謝你閱讀完這篇文章,如果你覺得這篇文章對你有幫助, 請在底下幫我拍個手 ^^ 如果你有任何問題或者文章內容有誤請務必留言或寄信給我, 這樣對我幫助會很大, 再次感謝你~

信箱: ncku4alex@gmail.com

Github: https://github.com/Alex-CHUN-YU

Reference

  1. https://academy.dataiku.com/latest/concepts/index.html

--

--

CHIEN CHUN-YU

Hi~ My name is Alex ! I am a data engineer ! Data include data waiting for you to explore. BTW, a true master is an eternal student!