2/11/2014
1
Data Warehouse and Business Intelligence 1
Chương 1:
Tổng quan về kho dữ liệu và kinh
doanh thông minh
Data Warehouse and Business Intelligence 2
Nội dung
1. Giới thiệu về kho dữ liệu
2. Các đặc tính của kho dữ liệu
3. Các kiến trúc kho dữ liệu
4. Các mô hình kho dữ liệu
5. Giới thiệu về kinh doanh thông minh
6. Kiến trúc của kinh doanh thông minh
7. Vai trò của kinh doanh thông minh trong việc ra quyết
định
Data Warehouse and Business Intelligence 3
1. Giới thiệu về kho dữ liệu
Có nhiều các định nghĩa khác nhau về KDL, nhưng
không có cách nào là nghiêm ngặt:
Một cơ sở dữ liệu hỗ trợ quyết định được bảo trì tách biệt
từ cơ sở dữ liệu hoạt động của tổ chức
Hỗ trợ xử lí thông tin bằng cách cung cấp một nền tảng
vững chắc cho việc hợp nhất và dữ liệu lịch sử để phân tích
Theo W. H. Inmon: “Kho dữ liệu là tập dữ liệu hướng
chủ đề, tích hợp, gắn với thời gian và ít thay đổi để
hỗ trợ quá trình ra quyết định của nhà quản lí” 2/11/2014
2
dữ liệu
• Cấu trúc khóa chứa phần tử
thời gian
2/11/2014
4
Data Warehouse and Business Intelligence 11
2. Các đặc tính của kho dữ liệu (tt)
Ít thay đổi
Data Warehouse and Business Intelligence 12
OLTP vs. OLAP
OLTP (on-line transaction processing): Xử lí giao dịch
trực tuyến
Nhiệm vụ chính của Hệ quản lí cơ sở dữ liệu quan hệ (relational
DBMS) truyền thống.
Dùng cho các tác nghiệp hằng ngày (Day-to-day operations):
mua sắm, quản lí tồn kho, ngân hàng, quản lí lương, đăng ký, kế
toán,…
OLAP (on-line analytical processing): Quá trình phân tích
trực tuyến
Nhiệm vụ chính của hệ thống kho dữ liệu
Phân tích dữ liệu và làm quyết định (decision making)
Data Warehouse and Business Intelligence
OLTP vs OLAP
OLTP
OLAP
Người dùng
Thư lý, chuyên viên
CNTT
Kích thước CSDL
100MB-GB
100GB-TB
Đơn vị đo
Thông lượng giao dịch
Thông lượng truy vấn, đáp ứng 2/11/2014
5
Data Warehouse and Business Intelligence 14
Data mart
Hệ thống tập tất cả dữ liệu được yêu cầu bởi một phòng
ban chuyên biệt trong công ty (như tiếp thị, hậu cần,…)
Được sử dụng để phân tích BI
Một kho dữ liệu mức phòng ban (departmental data
warehouse)
Data warehouses và data marts có khung công nghệ giống
nhau
14
Data Warehouse and Business Intelligence 15
Công cụ ETL
ETL: Rút trích (Extraction), Chuyển đổi
(Transformation), tải (Loading)
Rút trích:
Rút trích từ những nguồn sẵn có bên trong hoặc ngoài
Những phiên bản phụ thuộc thời gian của dữ liệu
Chọn lựa dữ liệu: Dựa trên thiết kế DW
Chuyển đổi:
18
E
T
L
Separate ETL for each
independent data mart
Data access complexity
due to multiple data
marts
Data Warehouse and Business Intelligence 19
3.2.Data Mart độc lập (tt)
Data mart độc lập: data mart chứa dữ liệu được rút
trích từ môi trường hoạt động mà không có ảnh
hưởng của KDL
Hạn chế của Data mart độc lập:
Mỗi data mart cần một ETL riêng
Các data mart không tương thích nhau
Không thể drill-down
Tốn nhiều chi phí khi có ứng dụng mới
Tốn chi phí để làm data mart tương thích nhau
2/11/2014
7
Data Warehouse and Business Intelligence 20
3.3.Data Mart phụ thuộc và kho lưu trữ dữ
liệu hoạt động
E
T
L
data warehouse
Easier to create new data marts
2/11/2014
8
Data Warehouse and Business Intelligence 23
3.4. Data Mart luận lý và KDL tích cực (tt)
Logical data mart = relational view
Base tables: customer, product, order, orderline
Create views:
CREATE VIEW invoice AS
SELECT customer.customer_ID, customer_addr, order.order_ID,
product.product_ID, product.price, order.quantity,
product.price*order.quantity
FROM customer, order, orderline, product
WHERE customer.customer_ID= order.customer_ID,
AND order.order_ID= orderline.order_ID, product.product_ID =
orderline.product_ID
Data Warehouse and Business Intelligence 24
3.4. Data Mart luận lý và KDL tích cực (tt)
KDL tích cực:
Một kho dữ liệu mức tổ chức chứa dữ liệu gần thời gian
thực (near-real-time) của dữ liệu giao dịch từ những hệ
thống bản ghi, phân tích KDL, tiếp nối gần thời gian thực
từ qui trình nghiệp vụ đến KDL và những hệ thống bản ghi
để có những hành động trung gian có thể hồi đáp lại các sự
kiện kinh doanh
Ứng dụng: Dò tìm lỗi
Data Warehouse and Business Intelligence 25
3.5 Kiến trúc dữ liệu 3 lớp
25
10
Data Warehouse and Business Intelligence 29
Cube: Một lưới các Cuboids
all
time item location supplier
time,item time,location
time,supplier
item,location
item,supplier
location,supplier
time,item,location
time,item,supplier
time,location,supplier
item,location,supplier
time, item, location, supplier
0-D(apex) cuboid
1-D cuboids
2-D cuboids
3-D cuboids
4-D(base) cuboid
Data Warehouse and Business Intelligence 30
4.2 Mô hình ý niệm của KDL
Mô hình kho dữ liệu:
Lược đồ hình sao (Star schema): Một bảng sự kiện ở giữa
kết nối đến một tập bảng chiều
Lược đồ hình bông tuyết (Snowflake schema): Tinh chế
của lược đồ hình sao, trong đó một vài chiều có sự phân
cấp được chuẩn hóa thành một tập các bảng chiều nhỏ hơn,
có hình ảnh giống như bông tuyết
brand
type
supplier_type
item
branch_key
branch_name
branch_type
branch
2/11/2014
11
Data Warehouse and Business Intelligence 32
Ví dụ của lược đồ hình bông tuyết
time_key
day
day_of_the_week
month
quarter
year
time
location_key
street
city_key
location
Sales Fact Table
time_key
item_key
branch_key
location_key
units_sold
time
location_key
street
city
province_or_street
country
location
Sales Fact Table
time_key
item_key
branch_key
location_key
units_sold
dollars_sold
avg_sales
Measures
item_key
item_name
brand
type
supplier_type
item
branch_key
branch_name
branch_type
branch
Shipping Fact Table
time_key
item_key
shipper_key
avg(sales_in_dollars), units_sold = count(*)
define dimension time as (time_key, day, day_of_week,
month, quarter, year)
define dimension item as (item_key, item_name, brand,
type, supplier_type)
define dimension branch as (branch_key, branch_name,
branch_type)
define dimension location as (location_key, street, city,
province_or_state, country)
Data Warehouse and Business Intelligence 36
Định nghĩa lược đồ bông tuyết trong DMQL
define cube sales_snowflake [time, item, branch, location]:
dollars_sold = sum(sales_in_dollars), avg_sales =
avg(sales_in_dollars), units_sold = count(*)
define dimension time as (time_key, day, day_of_week,
month, quarter, year)
define dimension item as (item_key, item_name, brand,
type, supplier(supplier_key, supplier_type))
define dimension branch as (branch_key, branch_name,
branch_type)
define dimension location as (location_key, street,
city(city_key, province_or_state, country))
Data Warehouse and Business Intelligence 37
Định nghĩa lược đồ chòm sao sự kiện trong DMQL
define cube sales [time, item, branch, location]:
dollars_sold = sum(sales_in_dollars), avg_sales = avg(sales_in_dollars),
units_sold = count(*)
define dimension time as (time_key, day, day_of_week, month, quarter, year)
define dimension item as (item_key, item_name, brand, type, supplier_type)
define dimension branch as (branch_key, branch_name, branch_type)
all
region
office
country
Toronto Frankfurt city
Data Warehouse and Business Intelligence 40
Dữ liệu đa chiều
Sales volume as a function of product, month, and region
Product
Month
Dimensions: Product, Location, Time
Hierarchical summarization paths
Defined by concept hierarchies
Industry Region Year
Category Country Quarter
Product City Month Week
Office Day
2/11/2014
14
Data Warehouse and Business Intelligence 41
Một khối dữ liệu mẫu
Total annual sales
of TV in U.S.A.
Date
Country
Drill down (roll down)
Slice và dice
Pivot (rotate)
Các tác vụ khác:
drill across
drill through
2/11/2014
15
Data Warehouse and Business Intelligence 44
Slicing
Data Warehouse and Business Intelligence 45
Drill-down
Data Warehouse and Business Intelligence 46
visualization
2/11/2014
16
Data Warehouse and Business Intelligence 47
Mô hình truy vấn mạng hình sao (Star-Net)
Shipping Method
AIR-EXPRESS
TRUCK
ORDER
Customer Orders
CONTRACTS
Customer
Product
PRODUCT GROUP
PRODUCT LINE
Yêu cầu:
Hiệu quả (Effective)
Thõa mãn về thời gian (Timely)
Quyết định dựa trên:
Miền tri thức
Kinh nghiệm
Thông tin sẵn có
Trong thời đại ngày nay:
Môi trường thay đổi nhanh và thường xuyên
Có tính động và phức tạp
Những quan điểm nghiêm ngặt hơn được dựa trên các
phương pháp luận phân tích và mô hình toán học Data Warehouse and Business Intelligence 52
Một số ví dụ
Ví dụ 1.1 – Mức độ trung thành của khách hàng trong
lĩnh vực di động
Mức độ trung thành thấp của khách hàng là do đâu ?
• …
• …
• …
Mục đích của chiến dịch tiếp thị: Chọn đúng khách hàng để
giảm ngân sách
Ví dụ 1.2: Hoạch định Logistic
Phát triển kế hoạch hậu cần trong trung hạn
2/11/2014
18
Data Warehouse and Business Intelligence 53
Data Warehouse and Business Intelligence 58
Phân tích BI điển hình
Xác định các mục tiêu và chỉ tiêu hiệu suất
Phát triển các mô hình toán để khai thác những quan hệ
giữa các biến, tham số kiểm soát hệ thống và các tham số
ước lượng
Đưa ra phân tích what-if để đánh giá hiệu quả thực thi
2/11/2014
20
Data Warehouse and Business Intelligence 59
6. Kiến trúc của BI
Kiến trúc BI điển hình
Data Warehouse and Business Intelligence 60
6. Kiến trúc BI (tt)
Data Warehouse and Business Intelligence 61
6. Kiến trúc BI (tt)
Các nguồn dữ liệu (Data sources)
Kho dữ liệu và data marts
Các phương pháp luận BI
Khám phá dữ liệu (Data exploration)
Khai phá dữ liệu Data mining
Tối ưu hóa
Các quyết định
2/11/2014
21
Data Warehouse and Business Intelligence 62
7. Vai trò của BI trong việc ra quyết định
BI trong tổ chức