MADlib and MLbase Quan Fang Xiaofeng Tao MADlib - - PowerPoint PPT Presentation

madlib and mlbase
SMART_READER_LITE
LIVE PREVIEW

MADlib and MLbase Quan Fang Xiaofeng Tao MADlib - - PowerPoint PPT Presentation

MADlib and MLbase Quan Fang Xiaofeng Tao MADlib Analy7cs Library What is a mad lib? - From bigdatablog.emc.com What is a mad lib?


slide-1
SLIDE 1

MADlib ¡and ¡MLbase ¡ ¡

Quan ¡Fang ¡ Xiaofeng ¡Tao ¡

slide-2
SLIDE 2

MADlib ¡Analy7cs ¡Library ¡ ¡

slide-3
SLIDE 3

What ¡is ¡a ¡mad ¡lib? ¡

  • ­‑ ¡From ¡bigdatablog.emc.com ¡
slide-4
SLIDE 4

What ¡is ¡a ¡mad ¡lib? ¡

  • ­‑ ¡From ¡bigdatablog.emc.com ¡
slide-5
SLIDE 5

MAD ¡Methodology ¡

  • Cohen, ¡Jeffrey, ¡et ¡al. ¡"MAD ¡skills: ¡new ¡analysis ¡

prac7ces ¡for ¡big ¡data."Proceedings ¡of ¡the ¡ VLDB ¡Endowment ¡2.2 ¡(2009): ¡1481-­‑1492. ¡

  • What ¡does ¡MAD ¡stand ¡for? ¡

¡

slide-6
SLIDE 6

Magne7c ¡

  • Use ¡all ¡data ¡sources ¡regardless ¡of ¡

format ¡or ¡quality ¡

slide-7
SLIDE 7

Magne7c ¡Agile ¡

  • Use ¡all ¡data ¡sources ¡regardless ¡of ¡

format ¡or ¡quality ¡

  • Support ¡dynamic ¡workflow ¡and ¡

whatever ¡data ¡analysts ¡need ¡

slide-8
SLIDE 8

Magne7c ¡Agile ¡Deep ¡

  • Use ¡all ¡data ¡sources ¡regardless ¡of ¡

format ¡or ¡quality ¡

  • Support ¡dynamic ¡workflow ¡and ¡

whatever ¡data ¡analysts ¡need ¡

  • Analyze ¡large ¡datasets ¡without ¡

sampling ¡

slide-9
SLIDE 9

Magne7c ¡Agile ¡Deep ¡

  • Goal: ¡Give ¡analysts ¡access ¡to ¡familiar ¡math ¡

concepts, ¡sta7s7cal ¡methods, ¡and ¡algorithms ¡ for ¡database ¡

  • Use ¡tradi7onal ¡SQL ¡and ¡a ¡wide ¡range ¡of ¡

extension ¡languages ¡

slide-10
SLIDE 10

Data ¡Parallel ¡Sta7s7cs ¡

  • Give ¡analysts ¡access ¡to ¡familiar ¡math ¡concepts ¡

and ¡sta7s7cal ¡methods ¡for ¡database ¡

  • Database ¡methods ¡are ¡data ¡parallel ¡and ¡have ¡an ¡

SQL ¡like ¡interface ¡

  • Database ¡methods ¡fall ¡into ¡one ¡of ¡the ¡following ¡

layers ¡of ¡abstrac7on: ¡

– Scalar ¡ – Vector ¡ – Matrix ¡ – Func7on ¡

slide-11
SLIDE 11

MAD ¡DBMS ¡

  • Loading ¡and ¡Unloading ¡

– Sca]er ¡/ ¡Gather ¡streaming ¡for ¡fully ¡parallel ¡access ¡ – External ¡tables ¡

¡

  • Extract-­‑Transform-­‑Load ¡(ETL) ¡and ¡Extract-­‑

Load-­‑Transform ¡(ELT) ¡

slide-12
SLIDE 12

MAD ¡DBMS ¡

  • Mul7ple ¡storage ¡formats ¡

– External ¡tables ¡ – Heap ¡format ¡ – Append-­‑mostly ¡format ¡

  • Different ¡storage ¡formats ¡per ¡table ¡par77on ¡
  • Atomic ¡par77on ¡exchange ¡
slide-13
SLIDE 13

MAD ¡Programming ¡

  • Tradi7onal ¡SQL ¡queries ¡with ¡extensions ¡
  • Map/Reduce ¡func7ons ¡wri]en ¡in ¡Python, ¡Perl, ¡
  • r ¡R ¡
  • Wide ¡range ¡of ¡extension ¡languages ¡

¡

slide-14
SLIDE 14

MAD ¡Implementa7ons ¡

  • MADlib ¡

– Library ¡for ¡data ¡analy7cs ¡that ¡can ¡run ¡on ¡ Greenplum ¡or ¡PostgreSQL ¡

  • Greenplum ¡database ¡ ¡

– Massively ¡parallel ¡processing ¡database ¡

slide-15
SLIDE 15

MADlib ¡

  • Library ¡for ¡widely ¡used ¡sta7s7cs, ¡data ¡mining, ¡

and ¡machine ¡learning ¡that ¡runs ¡on ¡top ¡of ¡a ¡ SQL ¡database ¡

– Regression ¡models ¡ – Machine ¡learning ¡ – Linear ¡systems ¡ – Topic ¡modelling ¡ – Descrip7ve ¡sta7s7cs ¡ – And ¡more…. ¡(see ¡doc.madlib.net) ¡

¡

slide-16
SLIDE 16

MADlib ¡History ¡

  • S7ll ¡in ¡early ¡stages ¡of ¡development ¡
  • In ¡use ¡by ¡some ¡research ¡universi7es ¡and ¡

companies ¡

  • Heavily ¡sponsored ¡by ¡Greenplum ¡
slide-17
SLIDE 17

MADlib ¡Interface ¡

  • Interface ¡consists ¡of ¡extensible ¡SQL ¡like ¡scripts ¡

that ¡call ¡MADlib ¡func7ons ¡

  • Wide ¡range ¡of ¡extension ¡languages ¡possible ¡

but ¡C++ ¡/ ¡Python ¡recommended ¡

  • Designed ¡for ¡portability ¡
slide-18
SLIDE 18

MADlib ¡User ¡Extensions ¡

  • User ¡defined ¡aggregates ¡and ¡func7ons ¡in ¡C++ ¡
  • Driver ¡func7ons ¡use ¡Python ¡to ¡wrap ¡mul7ple ¡

MADlib ¡SQL ¡calls ¡

  • Templated ¡queries ¡are ¡supported ¡with ¡Python ¡

wrappers ¡

¡

¡

slide-19
SLIDE 19

MADlib: ¡Logis7c ¡regression ¡

slide-20
SLIDE 20

MADlib ¡Example: ¡K-­‑means ¡

  • Run ¡K-­‑means ¡

¡SELECT * FROM madlib.kmeanspp( 'km_sample', 'points', 2, 'madlib.squared_dist_norm2', 'madlib.avg', 20, 0.001 );

slide-21
SLIDE 21

MADlib ¡Example: ¡K-­‑means ¡

  • Calculate ¡silhoue]e ¡coefficient ¡

SELECT * FROM madlib.simple_silhouette( 'km_s ample', 'points', (SELECT centroids FROM 'km_centroids'), 'madlib.squared_dist_norm2' );

slide-22
SLIDE 22

Live ¡demo ¡

  • Postgres ¡command ¡line ¡
  • Principal ¡Component ¡Analysis ¡

– pca_train() ¡ – pca_project() ¡

slide-23
SLIDE 23

Conclusion ¡

  • Due ¡to ¡the ¡economics ¡of ¡data ¡(cheap, ¡high ¡

volume), ¡data ¡warehouses ¡in ¡the ¡future ¡need ¡ to ¡focus ¡on ¡data ¡analy7cs ¡

– Magne7cally ¡a]ract ¡all ¡data ¡sources ¡ – Agile ¡analysis ¡workflow ¡ – Deeply ¡analyze ¡large ¡datasets ¡without ¡sampling ¡

  • MADlib ¡provides ¡analysts ¡with ¡such ¡a ¡toolbox ¡

that ¡is ¡portable ¡across ¡SQL ¡databases ¡

slide-24
SLIDE 24

MLbase: ¡A ¡Distributed ¡Machine-­‑ Learning ¡System ¡ ¡

slide-25
SLIDE 25

Four ¡foci ¡ ¡

  • (1) ¡A ¡new ¡declara7ve ¡language ¡to ¡specify ¡ML ¡

tasks ¡

  • (2) ¡A ¡novel ¡op7mizer ¡to ¡select ¡ML ¡algorithms ¡
  • (3) ¡Provide ¡answers ¡early ¡and ¡con7nuously ¡
  • refine. ¡
  • (4) ¡Design ¡a ¡distributed ¡run-­‑7me ¡op7mized ¡for ¡

the ¡data ¡access ¡pa]erns ¡of ¡ML ¡

slide-26
SLIDE 26

A ¡Declara7ve ¡Approach ¡to ¡ML ¡

SQL ¡ Result ¡ MQL ¡

Model ¡

slide-27
SLIDE 27
slide-28
SLIDE 28

ML Developer Meta-Data Statistics User Declarative ML Task ML Contract + Code Master Server

….

result (e.g., fn-model & summary) COML (Optimizer) Parser Executor/Monitoring Binders of Algorithms Runtime Runtime Runtime Runtime LLP PLP

Master

MLbase ¡Architecture ¡

Algorithms, ¡ Data, ¡Sta7s7cs ¡ Adap%ve ¡ Op%mizer ¡ ¡ MLI ¡ Interface ¡between ¡ MLBase ¡and ¡ Distributed ¡Infra ¡ 1 ¡ 2 ¡ 3 ¡

slide-29
SLIDE 29

ML Developer Meta-Data Statistics User Declarative ML Task ML Contract + Code Master Server

….

result (e.g., fn-model & summary) COML (Optimizer) Parser Executor/Monitoring Binders of Algorithms Runtime Runtime Runtime Runtime LLP PLP

Master

MLI ¡ Interface ¡between ¡ MLBase ¡and ¡ Distributed ¡Infra ¡ 1 ¡

MLI: ¡Machine ¡Learning ¡Interface ¡

1 ¡

slide-30
SLIDE 30

MLI: ¡Machine ¡Learning ¡Interface ¡

  • Shield ¡ML ¡Developers ¡from ¡low-­‑level-­‑details. ¡
  • Independence ¡between ¡ML ¡algorithm ¡and ¡

run-­‑7me ¡

  • Current ¡supported ¡run-­‑7mes: ¡

1 ¡

TupleWare ¡

slide-31
SLIDE 31

ML Developer Meta-Data Statistics User Declarative ML Task ML Contract + Code Master Server

….

result (e.g., fn-model & summary) COML (Optimizer) Parser Executor/Monitoring Binders of Algorithms Runtime Runtime Runtime Runtime LLP PLP

Master

Algorithms, ¡ Data, ¡Sta7s7cs ¡ 2 ¡

Algorithms ¡Pool ¡

2 ¡

slide-32
SLIDE 32

Algorithms ¡Pool ¡

Implementa%on ¡ Algorithms ¡pool ¡ MLBase ¡defined ¡Contracts ¡

  • Type ¡(e.g., ¡classifica7on) ¡
  • Parameters ¡
  • Run7me ¡(e.g., ¡O(n)) ¡
  • Input-­‑Specifica7on ¡
  • Output-­‑Specifica7on ¡
  • … ¡

ML Developer

+ ¡

2 ¡

Extensibility ¡

slide-33
SLIDE 33

ML Developer Meta-Data Statistics User Declarative ML Task ML Contract + Code Master Server

….

result (e.g., fn-model & summary) COML (Optimizer) Parser Executor/Monitoring Binders of Algorithms Runtime Runtime Runtime Runtime LLP PLP

Master

MLbase ¡Architecture ¡

Op%mizer ¡ LLP ¡& ¡PLP ¡ 3 ¡

slide-34
SLIDE 34

Query ¡Op7miza7on(Logical ¡Learning ¡Plan) ¡

3 ¡

slide-35
SLIDE 35

Run ¡Time ¡(Physical ¡Learning ¡Plan) ¡

  • (1) ¡The ¡master ¡distributes ¡ML ¡tasks ¡to ¡workers ¡
  • (2) ¡Monitor ¡progress ¡
  • (3) ¡Handle ¡failures ¡

3 ¡

slide-36
SLIDE 36

Conclusion ¡ ¡

  • MLbase’s ¡core ¡is ¡its ¡op7mizer ¡
  • Transforms ¡a ¡declara7ve ¡ML ¡task ¡to ¡a ¡

sophis7cated ¡learning ¡plan ¡

  • Quickly ¡returns ¡a ¡first ¡quality ¡answer, ¡

improves ¡in ¡the ¡background ¡

  • To ¡be ¡fully ¡distributed ¡and ¡offers ¡a ¡run-­‑7me ¡

able ¡to ¡exploit ¡ML ¡algorithms ¡ ¡

slide-37
SLIDE 37

ML Developer