data mining - emory universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22march 26, 2008...

32
March 26, 2008 Data Mining: Concepts and Techniques 1 Data Mining: Concepts and Techniques — Chapter 3 — Data Warehousing and OLAP Li Xiong Department of Mathematics and Computer Science Slide credits: Jiawei Han and Micheline Kamber

Upload: truongminh

Post on 08-Mar-2018

219 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 1

Data Mining:Concepts and Techniques

— Chapter 3 —Data Warehousing and OLAP

Li Xiong

Department of Mathematics and Computer Science

Slide credits: Jiawei Han and Micheline Kamber

Page 2: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 2

Chapter 3: Data Warehousing and OLAP Technology: An Overview

What is a data warehouse?

A multi-dimensional data model

Data warehouse architecture

Data warehouse implementation

Page 3: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 3

Knowledge Discovery (KDD) Process

Data mining—core of knowledge discovery process

Data Cleaning

Data Integration

Databases

Data Warehouse

Task-relevant Data

Selection and transformation

Data Mining

Pattern Evaluation

Page 4: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 4

What is Data Warehouse?

“A data warehouse is a subject-oriented, integrated, time-variant,

and nonvolatile collection of data in support of management’s

decision-making process.”—W. H. Inmon

Key aspects

A decision support database that is maintained separately from

the organization’s operational database

Support information processing by providing a platform of

consolidated, historical data for analysis.

Data warehousing:

The process of constructing and using data warehouses

Page 5: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 5

Data Warehouse vs. Federated Database Systems

Data warehouse

Information from heterogeneous sources is integrated in advance

and stored in warehouses for direct query and analysis

Federated database systems

Build wrappers/mediators on top of heterogeneous databases

When a query is posed to a client site, a meta-dictionary is used

to translate the query into queries appropriate for individual

heterogeneous sites involved, and the results are integrated into

a global answer set

Page 6: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

Data Warehouse Approach

Client Client

Warehouse

Source Source Source

Query & Analysis

ETL

Metadata

Page 7: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

Advantages and Disadvantages of Data Warehouse

AdvantagesHigh query performanceCan operate when sources unavailableExtra information at warehouse

Modification, summarization (aggregates), historical information

Local processing at sources unaffectedDisadvantages

Data freshnessDifficult to construct when only having access to query interface of local sources

Page 8: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

Federated Database Systems

Client Client

Wrapper Wrapper Wrapper

Mediator

Source Source Source

Page 9: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

Advantages and Disadvantages of Federated Database Systems

AdvantageNo need to copy and store data at mediatorMore up-to-date dataOnly query interface needed at sources

DisadvantageQuery performanceSource availability

Page 10: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 10

Data Warehouse vs. Operational DBMS

OLTP (on-line transaction processing)

Major task of traditional relational DBMS

Day-to-day operations: purchasing, inventory, banking, manufacturing, payroll, registration, accounting, etc.

OLAP (on-line analytical processing)

Major task of data warehouse system

Data analysis and decision making

Distinct features (OLTP vs. OLAP):

User and system orientation: customer vs. market

Data contents: current, detailed vs. historical, consolidated

Database design: ER + application vs. star + subject

View: current, local vs. evolutionary, integrated

Access patterns: update vs. read-only but complex queries

Page 11: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 11

OLTP vs. OLAP

OLTP OLAP users clerk, IT professional knowledge worker function day to day operations decision support DB design application-oriented subject-oriented data current, up-to-date

detailed, flat relational isolated

historical, summarized, multidimensional integrated, consolidated

usage repetitive ad-hoc access read/write

index/hash on prim. key lots of scans

unit of work short, simple transaction complex query # records accessed tens millions #users thousands hundreds DB size 100MB-GB 100GB-TB metric transaction throughput query throughput, response

Page 12: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 12

Chapter 3: Data Warehousing and OLAP Technology: An Overview

What is a data warehouse?

A multi-dimensional data model

Data warehouse architecture

Data warehouse implementation

Page 13: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

Conceptual Modeling

Dimensional approachMulti-dimensional view of dataFacts and dimensions Advantage: easier to understand and useDisadvantage: can be complicated to load and maintain the data

Normalized approachFollowing Codd normalization ruleGrouped together by subject areasAdvantage: easier to add dataDisadvantage: can be difficult to join data and access information

March 26, 2008 Data Mining: Concepts and Techniques 13

Page 14: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 14

Multi Dimensional View: From Tables to Data Cubes

A data warehouse is based on a multidimensional data model which

views data in the form of a data cube

A data cube, such as sales, allows data to be modeled and viewed in

multiple dimensions

Item

Locati

on

Time

Page 15: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 15

Cube: A Lattice of Cuboids

time,item

time,item,location

time, item, location, supplier

all

time item location supplier

time,location

time,supplier

item,location

item,supplier

location,supplier

time,item,supplier

time,location,supplier

item,location,supplier

0-D(apex) cuboid

1-D cuboids

2-D cuboids

3-D cuboids

4-D(base) cuboid

An n-D base cube is called a base cuboid. The top most 0-D cuboid, which

holds the highest-level of summarization, is called the apex cuboid. The

lattice of cuboids forms a data cube.

Page 16: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 16

Schemas for Multidimensional Databases

Tables

Dimension tables, such as item (item_name, brand, type), or

time(day, week, month, quarter, year)

Fact table contains measures (such as dollars_sold) and keys to

each of the related dimension tables

Schema

Star schema: A fact table in the middle connected to a set of

dimension tables

Snowflake schema: Some dimensional hierarchy is normalized into

a set of smaller dimension tables

Fact constellations (galaxy schema): Multiple fact tables share

dimension tables

Page 17: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 17

Example of Star Schema

time_keydayday_of_the_weekmonthquarteryear

time

location_keystreetcitystate_or_provincecountry

location

Sales Fact Table

time_key

item_key

branch_key

location_key

units_sold

dollars_sold

avg_salesMeasures

item_keyitem_namebrandtypesupplier_type

item

branch_keybranch_namebranch_type

branch

Page 18: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 18

Example of Snowflake Schema

time_keydayday_of_the_weekmonthquarteryear

time

location_keystreetcity_key

location

Sales Fact Table

time_key

item_key

branch_key

location_key

units_sold

dollars_sold

avg_sales

Measures

item_keyitem_namebrandtypesupplier_key

item

branch_keybranch_namebranch_type

branch

supplier_keysupplier_type

supplier

city_keycitystate_or_provincecountry

city

Page 19: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 19

Example of Fact Constellation

time_keydayday_of_the_weekmonthquarteryear

time

location_keystreetcityprovince_or_statecountry

location

Sales Fact Table

time_key

item_key

branch_key

location_key

units_sold

dollars_sold

avg_salesMeasures

item_keyitem_namebrandtypesupplier_type

item

branch_keybranch_namebranch_type

branch

Shipping Fact Table

time_key

item_key

shipper_key

from_location

to_location

dollars_cost

units_shipped

shipper_keyshipper_namelocation_keyshipper_type

shipper

Page 20: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 20

Measures of Data Cube: Three Categories

Distributive: if the result derived by applying the function to n aggregate values is the same as that derived by applying the function on all the data without partitioning

E.g., count(), sum(), min(), max()

Algebraic: if it can be computed by an algebraic function with M arguments (where M is a bounded integer), each of which is obtained by applying a distributive aggregate function

E.g., avg(), min_N(), standard_deviation()

Holistic: if there is no constant bound on the storage size needed to describe a subaggregate.

E.g., median(), mode(), rank()

Page 21: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 21

A Concept Hierarchy: Dimension (location)

all

Europe North_America

MexicoCanadaSpainGermany

Vancouver

M. WindL. Chan

...

......

... ...

...

all

region

office

country

TorontoFrankfurtcity

Page 22: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 22

OLAP Operations in the Multidimensional Data Model

Roll up (drill-up): summarize data

by climbing up hierarchy or by dimension reductionDrill down (roll down): reverse of roll-up

from higher level summary to lower level summary or detailed data, or introducing new dimensions

Slice and dice: project and selectPivot (rotate):

reorient the cube, visualization, 3D to series of 2D planesOther operations

drill across: involving (across) more than one fact tabledrill through: through the bottom level of the cube to its back-end relational tables (using SQL)

Page 23: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 23

Page 24: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 24

A Star-Net Query Model

Shipping Method

AIR-EXPRESS

TRUCKORDER

Customer Orders

CONTRACTS

Customer

Product

PRODUCT GROUP

PRODUCT LINE

PRODUCT ITEM

SALES PERSON

DISTRICT

DIVISION

OrganizationPromotion

CITY

COUNTRY

REGION

Location

DAILYQTRLYANNUALYTime

Page 25: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 25

Chapter 3: Data Warehousing and OLAP Technology: An Overview

What is a data warehouse?

A multi-dimensional data model

Data warehouse architecture

Data warehouse implementation

Page 26: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 26

Data Warehouse: A MultiData Warehouse: A Multi--Tiered ArchitectureTiered Architecture

DataWarehouse

ExtractTransformLoadRefresh

OLAP Engine

AnalysisQueryReportsData mining

Monitor&

IntegratorMetadata

Data Sources Front-End Tools

Serve

Data Marts

Operational DBs

Othersources

Data Storage

OLAP Server

Page 27: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 27

Chapter 3: Data Warehousing and OLAP Technology: An Overview

What is a data warehouse?

A multi-dimensional data model

Data warehouse architecture

Data warehouse implementation

Page 28: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 28

Efficient Data Cube Computation

How many cuboids in an n-dimensional cube with L levels?

Materialization of data cube

Full materialization

No materialization

Partial materialization

Selection of which cuboids to materialize

Size, sharing, access frequency, etc.

)11

( +∏=

=n

i iLT

(item)(city)

()

(year)

(city, item) (city, year) (item, year)

(city, item, year)

Page 29: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 29

Iceberg Cube

Computing only the cuboid cells whose count or other aggregates satisfying the condition like

HAVING COUNT(*) >= minsup

MotivationOnly a small portion of cube cellsOnly calculate “interesting” cells

Efficient computation(item)(city)

()

(year)

(city, item) (city, year) (item, year)

(city, item, year)

Page 30: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 30

Summary: Data Warehouse and OLAP Technology

Why data warehousing?

A multi-dimensional model of a data warehouse

Star schema, snowflake schema, fact constellations

A data cube consists of dimensions & measures

OLAP operations: drilling, rolling, slicing, dicing and pivoting

Data warehouse architecture

Efficient computation of data cubes

Partial vs. full vs. no materialization

Page 31: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 31

References (I)

S. Agarwal, R. Agrawal, P. M. Deshpande, A. Gupta, J. F. Naughton, R. Ramakrishnan, and S. Sarawagi. On the computation of multidimensional aggregates. VLDB’96

D. Agrawal, A. E. Abbadi, A. Singh, and T. Yurek. Efficient view maintenance in data warehouses. SIGMOD’97R. Agrawal, A. Gupta, and S. Sarawagi. Modeling multidimensional databases. ICDE’97

S. Chaudhuri and U. Dayal. An overview of data warehousing and OLAP technology. ACM SIGMOD Record, 26:65-74, 1997

E. F. Codd, S. B. Codd, and C. T. Salley. Beyond decision support. Computer World, 27, July 1993.J. Gray, et al. Data cube: A relational aggregation operator generalizing group-by, cross-tab and sub-totals. Data Mining and Knowledge Discovery, 1:29-54, 1997.

A. Gupta and I. S. Mumick. Materialized Views: Techniques, Implementations, and Applications. MIT Press, 1999.

J. Han. Towards on-line analytical mining in large databases. ACM SIGMOD Record, 27:97-107, 1998.

V. Harinarayan, A. Rajaraman, and J. D. Ullman. Implementing data cubes efficiently. SIGMOD’96

Page 32: Data Mining - Emory Universitylxiong/cs570s08/share/slides/… ·  · 2009-07-22March 26, 2008 Data Mining: Concepts and Techniques 2 Chapter 3: Data Warehousing and OLAP Technology:

March 26, 2008 Data Mining: Concepts and Techniques 32

References (II)

C. Imhoff, N. Galemmo, and J. G. Geiger. Mastering Data Warehouse Design: Relational and Dimensional Techniques. John Wiley, 2003

W. H. Inmon. Building the Data Warehouse. John Wiley, 1996

R. Kimball and M. Ross. The Data Warehouse Toolkit: The Complete Guide to Dimensional Modeling. 2ed. John Wiley, 2002

P. O'Neil and D. Quass. Improved query performance with variant indexes. SIGMOD'97

Microsoft. OLEDB for OLAP programmer's reference version 1.0. Inhttp://www.microsoft.com/data/oledb/olap, 1998

A. Shoshani. OLAP and statistical databases: Similarities and differences. PODS’00.

S. Sarawagi and M. Stonebraker. Efficient organization of large multidimensional arrays. ICDE'94

OLAP council. MDAPI specification version 2.0. In http://www.olapcouncil.org/research/apily.htm, 1998

E. Thomsen. OLAP Solutions: Building Multidimensional Information Systems. John Wiley, 1997

P. Valduriez. Join indices. ACM Trans. Database Systems, 12:218-246, 1987.

J. Widom. Research problems in data warehousing. CIKM’95.