csc662 data mining, data warehouse and...
TRANSCRIPT
����� 3 ����� ������� ��� ��. ��. ก�� ������� ������
��� �!��"�������� �"# ���������� $�%��ก�"� &� �������
CSC662 Data Mining, Data Warehouse and Visualization
©๒๕๕๐ กรุง สินอภิรมยสราญ 2
� ��� ��ก����������� �� (Data warehouse)
� ����'�� (Data mart)
� �(�)*��ก�� ������ �� (Data warehouse architecture)
� �(�)*��ก�� ���+� (BI architecture)
� ,����- (Lattice)
� �����'������� �� (Data warehouse schema)
� ���,�#�� �����ก���ก� (Cube dimension and measure)
��./�&�
©๒๕๕๐ กรุง สินอภิรมยสราญ 3
�&����ก����������� �� (Data warehouse)
� ��ก���0�� ���ก� ������� �ก���ก1��� ��2��ก�$+ ' '�$#�)3��� ��2��ก�� ���ก��� �� ��������,�#���ก�� ,�'�� ������ก1�+ '4!'�� �����ก����ก��,�#���)-5� �)�#��!���6�&���������&��
� ก���6��� ������& �#� +)4!�(�ก���,�#(�ก� ���)3���.������6���� the right information @ the right time!
� �)7�& ���ก����������� ���.�ก��� �� �� ��4&����'4���ก0"#����& �#�'�ก�� �����#&�,�#�6� �4!� �8.��4&�4!�+��(�ก���,�#(�ก� ��
� ก���6������ ��& ��� ,&�'�ก1��� �� (����ก�� �����#&�) 8��� ก�#� �ก�� �����#&� �8.�� �����#&��� �����/���ก�4� ��������4$
©๒๕๕๐ กรุง สินอภิรมยสราญ 4
�&����ก����������� �� (Data warehouse)
� )�ก����ก �����#&�4!������ �� �' ก��ก���6��& .��� �� (Data
mining) �8.�����&�� � ������-'�����'4�9���� ������ก�
� ก���6��& .��� ��ก1�8.��&�� � ������-'�����' -5��� ��(�6� �4!�����$������ '� �� ������)3�)�#��!��(�ก4!�(�ก���,�#(�ก� ��
� �(�)*��ก�� ������ �� �� ��(4!��#��9���� ���!��� 8��2� (Relational DataBase Management System -RDBMS) �!'�
Oracle, DB2, Sybase, Informix, Focus, SQL Server &�.��#�������ก,�� ��6�&���ก���ก1������ ������:8�# �!'� Applix TM1, Crystal report, Microsoft Analysis service
©๒๕๕๐ กรุง สินอภิรมยสราญ 5
���� ����� �� (Data warehouse)
- W.H. Inmon
“A subject-oriented, integrated, time-variant and non-
volatile collection of data in support of management's
decision making process”
- Ralph Kimball
“A copy of transaction data, specifically structured for query and analysis”
1.
2.
©๒๕๕๐ กรุง สินอภิรมยสราญ 6
����� �� Subject-Oriented
� ����� ��(�ก��ก,��,�#$���ก1��8.��������$��)�#���&�.�&� ��&��ก���
������&��ก6�&�� 5/�ก�����������ก�� �!'� volume of product sales,
profit from sales, cost
� ����ก����������� ���8.�� �����#&� + '4!'�� ��$�กก���ก1�����5กก���6�
2��ก�$ operation &�.� transaction processing
� ��ก,�� ��8.��4&� '��,�#!���$� �� ��(��/���6�(� �� � � ��4$����
4!� ���)�ก���� �����+ '�)3�)�#��!���'�ก�#� �ก��������4$$#+ '(�ก�ก1�
4������ ��
©๒๕๕๐ กรุง สินอภิรมยสราญ 7
����� �� Integrated
� �������ก��� ,&�'�� ���'���),��,�#�'��(������ relational databases, flat files, on-line transaction
records
� ��� �ก�#� �ก���6�� � �#���,�#�'��ก�#� �ก��� ���!���$�,�#�& �#�
� ���)�#ก��ก�����ก����� �� �!'�ก����/!.�� �������ก���ก1� &�' � ���9�� $�ก,&�'�� ����/���ก�
� �!'� Hotel price: currency, tax, breakfast covered, etc.
� �ก��)����)������� ��4&��& �#� 4�ก���ก1�,�#ก�� �����#&� ©๒๕๕๐ กรุง สินอภิรมยสราญ 8
����� �� Time variant
� )�# ������ ��4������ ��(�ก�6� �4!�+ '4!'�� ������)�����+)"#��/�
� Operational database: �ก1�,�#$��ก���� ��)*$$����
� Data warehouse data: 4!��� ��$�ก�������� �� �!'� �� ���ก'�
� .�� 5-10 );ก'�� �8.���6� � �����#&��(��ก��"�����'�� � &�.��6�+)4!�
ก���(��ก��"� 4������
� ���4������ �� �,� ����� ��,<���'
� �� ������)3�� ����$,$4&��&1�,�� ��� &�.�,<�)3����
©๒๕๕๐ กรุง สินอภิรมยสราญ 9
����� �� Non-volatile
� ����� �� � ก���ก1��� ��,�ก��ก$�ก �� ������ก1�)�#$6�
� ก��)����)�������� ������ก1�)�#$6� + '�'��ก�#��ก������� �� $�ก '�
$# �ก���6������ก���/
� ����� ��+ '$6��)3���� � transaction processing, recovery ,�# concurrency control mechanisms
� ����� �����ก�� ��ก�#� �ก��4�ก������,�#4!����.�
� ก���6��� ���������� �� ,�# ก�����(5�� ��4������ ��
©๒๕๕๐ กรุง สินอภิรมยสราญ 10
� ������&���� ��(4!� heterogeneous DB integration ,������� ��
� ���� wrappers/mediators �)3��� ก���#& '�9���� ���'� =
� � .�����4!����ก�������� �� �#����ก�'� $#4!� meta-
dictionary 4�ก���������6�(� ����& �#� ก�#$��+)�� 9��
�� ������ก��� �� �5�� �� ,�� �6�����82����+�� �� �)3��6����
� �ก��$��ก�����-��-��� ,�#�)�.����8��ก� �ก
� ����� �� 4!� �2�ก���'���� ����� ��ก1���'� ��#����� -5� �)�#���2���8
�กก '� �2�ก�������
� � ,�ก�'��#& '������ ��ก��9���� ���� ก
©๒๕๕๐ กรุง สินอภิรมยสราญ 11
����� ��
� ก��4!�)�#��!��$�ก�� ��4����ก� �� ����ก�' � ($�ก�'���� �) ���(�ก
� �� ,�#$������4&����ก�� ����ก '�ก�#� �ก����������� �� Data
Warehousing (DW)
� DW �6�4&����ก� (enterprise) $�$6��' ��6�������,<���'4��� �� ������
���&��4!���,�)4�ก�����&�&�.� �����#&��' ��'� = ���4����ก�
� ������ก���6��& .��� ��ก1�)3���ก���.�� .�&�5��8.�����&�� � ������-'�����'
4��� ��,������� ���&�.�ก5������ ���
©๒๕๕๐ กรุง สินอภิรมยสราญ 12
����� ��
Customers
Etc…
Vendors Etc…
Orders
DataWarehouse
Enterprise“Database”
Transactions
Copied, organizedsummarized
Data Mining
������������
������������ก��
������������������
©๒๕๕๐ กรุง สินอภิรมยสราญ 13
����� ��$�ก���� � Kimball
� ����� ���.� copy of transaction data specifically structured �6�&������ ���6�(� �����#&� ,�#$���6����������ก�
� ������� ����� ��+��$�กก�������ก�� �� transaction ���4&�ก���)�����,)� transaction + 'ก�#���'������ ��
� ��.��$�ก����� ��(�ก��ก,���8.��ก�� �����#&� ����/�ก��$���ก1��� ������ก1�4������������& �#� �6�4&���� �ก�#� �ก���5�� ��,�#,)��������� ��
©๒๕๕๐ กรุง สินอภิรมยสราญ 14
��ก0"#� MDDB
� age = Adult� product type = TV� date = 1/12/48� count = 10� value = $30000� cost = $5500
Age
Product type
Dat
e
©๒๕๕๐ กรุง สินอภิรมยสราญ 15
����'�� (Data mart)
� ����'���)3������ ����� �'�����:8�#��.��&�.��:8�#,��ก (.�+���)3� a
mini-warehouse
� ����'��)�ก���#����ก��)�#ก��2��ก�$4��' �����ก��� ��ก��,��ก
� ��(�)�#���&��ก���4!�����'����� �ก�)3� ��(�)�#�������
� ����'�� ������1กก '� ����� ��,�# �ก��$��ก�����'��ก '�
� 4�ก�� �����#&����4!��� ��(4!���,�) �8.�� �����#&��� ��
©๒๕๕๐ กรุง สินอภิรมยสราญ 16
ก��$��ก������'��$�ก����� ��
����� ��
����'���� �����)���4!�ก���#��ก��������4$
�� �����)���4!�ก���#��ก��������4$
�� �����)���4!�ก���#��ก��������4$
����'��
����'��
©๒๕๕๐ กรุง สินอภิรมยสราญ 17
��ก0"#ก���)�����$�ก�� �� +)��'� � ���
�� ���ก1�)�#$6� �� ��2��ก��
�� �����)4!�4�ก��������4$
�����'�9���� ��
�� ��� ��
ก>� � ���
�#���
� � ����
��+��
����� ��
��������������+��$�ก�� ��
�� ���,��$6����� 2�� �!����ก#+)������#�����
,��ก�� ��� �� ������ก0"#)�#$6� ���!�� !���
���)�6�&���������&��$��ก���8.��4!�4�ก��������4$
�� ��
©๒๕๕๐ กรุง สินอภิรมยสราญ 18
��ก0"#Transaction/Operation DB
� �#��ก���ก1��� ��,�� transaction �ก���ก1��� ���)3�$6�� � �ก �!'� ���������+�� ก��-./� ก��<�ก ก��(�� ก���.���� �'������8��
� �� ��4���),�� transaction (.� '��)3��� ����� �����#����� �ก������ (���'4��#����'�����)?�# ��) – (.��)3� ��(��������6�+)4!�4�ก���5ก0�8@��ก�� ���ก���
� �� ��4���),�� transaction/operational ,<8@��ก�� ���ก���
� ����/�ก����ก,������� ��$5���ก� �ก��ก���)�����+)��� ����ก�'�
©๒๕๕๐ กรุง สินอภิรมยสราญ 19
�� ��'��� �����)ก�#� �ก��)�#$6�
��������)�,�'�#��.�� �� �����4!��)3�ก��� transaction ����ก��5/�4�!' &�5���.��
©๒๕๕๐ กรุง สินอภิรมยสราญ 20
�� �����)���4!�ก���#����������ก��������4$
� �� ��(�ก�6� �4!�4�ก��$��ก��2��ก�$
� �� ������ก����� �!'�� Income Statements (Profit & Loss)� Balance Sheets (Assets – Liabilities = Net Worth)
� �� �����)ก����
� ก����ก,���#�����������������/,�� Operational ,�# Analytic �)3���.����ก ,�# �� � ������'�ก���' ��#����/���� ������&�����ก��ก����ก,���#�����,�ก����/���' ���ก$�กก�� ,�'�� �ก��)����)������� ������#��������/��,��
©๒๕๕๐ กรุง สินอภิรมยสราญ 21
�����'�9���� �� (DB Schema)
� �����'�9���� �� (Database schema) ���� ��������ก���ก1��� ��+ '4!'�'��� �� �!'� !.��-�� �ก�� �)3������'� ,�' 8���ก0� ��'��.� �)3��'��� ��
� �6�&���9���� ���!��� 8��2�
� &��ก = �� ,)� = ��ก0"#)�#$6� �!'� (A,B,C)
� ,( = �#����� (1-7)
� �� ��'��� ��4�9���� ���!��� 8��2�
©๒๕๕๐ กรุง สินอภิรมยสราญ 22
� �2������ ��4&� ��0�� � �2������ �����,��ก���ก1�4�9���� ���!��� 8��2� -5����4!� �ก+ '$6��)3��������
�����'�9���� ���!�ก����8,�#�!����ก#
©๒๕๕๐ กรุง สินอภิรมยสราญ 23
�� ��� ��
� ���� �� ��� ��: �� ������ก��� ก���� ��!!!
� �������&�&���.�4�&��� ���)3��� ��� ������6�+)��'&���.�������ก��
� �#��,A7 �� ��4��#��)B�����ก���)3��� ��� ������6�+)��',A7 ��ก���
� �� ��� �� �ก�ก1�4���ก�������ก��� ��ก���#�� �!'�
� ก6�&���'�����)3�+)+�����ก0"#)�#$6� �!'� ��9 AZ, WI, CA
� �6��2������./�� � ���ก0"#)�#$6� �!'� � ������ก1��)3�� ������ ���
� �'��ก� ���'��������� ��(�ก����ก4!�
� ก��$����'�#& '���ก0"#)�#$6��'��#�� (�!'� A.this = B.that)
©๒๕๕๐ กรุง สินอภิรมยสราญ 24
� � ���&�.�ก>����6�+)4!�+���!�2��ก�$
� � � ���&�.�ก>���+���.��� ��4��#�����������+��$�ก�� ���#����'�
� ก>���+��$#!�/� � �� 8��2����4��� �� -5����4!��� ��(�6�+)4!�)�#��!��+��
� ก���� 4&�������ก����ก������ ���ก����������ก�������ก�'� 3 ,��
� ก��(�����$�ก���(������2�����+��+ '�ก�� $200 �'� ��
� &��$�กก��8���� ����#�� log-in ���/��� 3rd -5�+ '�6���1$ 4&��#��
)7�ก��ก������#������4!�����ก�'�
� �6�&���,��ก����,��ก + '4&����2������ก�� $100
©๒๕๕๐ กรุง สินอภิรมยสราญ 25
� �� �� ,�#�#���ก1��� ��
� ก���5 (�6�� � �#���) ,)�,�#�6��� ����� Extraction, (Clean), Transformation & Load
� ���<�ก�� ��ก��
� ���<�ก�� ��� ��
� ����'��
� �#��ก�����ก���
� ���4!� (End users)
�(�)*��ก�� ก���6������ ��
©๒๕๕๐ กรุง สินอภิรมยสราญ 26
� �2����������������� ��
� �!'� �����'� � � ��� �#���!�/� ���� ��ก0"#)�#$6�4& ' �(�����
� ��ก0"#ก���6���)�#$6�
� �!'� data lineage ()�# ���ก���6������ ��,�#ก��,)��� ��), currency of data (ก6���4!� �ก1�+ �&�.�����ก), monitoring
information (�(���ก��4!������ �� ������ � ���8���)
� �/���� �2����4!� �8.��4&�+�� �-5��� �����) ��ก���ก�
� �� ������ก��� ��ก��)�#���2���8��#��
� �� ���!�2��ก�$ �!'� ��� ,�#���� �$����� �� ������ก������ก������
ก��4!��� ��� ��
©๒๕๕๐ กรุง สินอภิรมยสราญ 27
� ก���5�� �� (Data extraction):
� �'���� ��$�ก&���,&�' &�����ก0"#$�ก�����ก� ก���6�� � �#����� �� (Data cleansing):
� �� $$��� � ���8���,�#,���� ��� ������& �#� � ก��,)��� �� (Data transformation):
� ,)��� ��4&����'4���),�����4!�4������ ��� ก���6���� (Load):
� ���� ���)4&����ก�� �6�� ",�#�� $��� �������!��,�#ก��,�'ก�/�� ก���6����4& ' (Refresh)
� )���)���� ��4����4&��#������ ��4& '4�9���� �������
ก�#� �ก���6��� ���������� ��
©๒๕๕๐ กรุง สินอภิรมยสราญ 28
�(�)*��ก�� ���+�
©๒๕๕๐ กรุง สินอภิรมยสราญ 29
� 4�ก�� �����#&��� ��4������ �� �� ��(�ก$��4���) multidimensional
data model ก�'� �.�8�$��"��� ��4���ก0"#��ก���ก�
� �� ����ก���ก�)�#ก���� �
� ����,�'�# � � �!'� item(name, brand, type), time(day,
week, month, quarter, year) � �� ��&�.� ��� �� �!'� sale_baht, sale_volume, budget
� �������ก��ก���ก���� �ก��ก6�&���'���/ n ��� '� 9����ก���ก�&�.� base
cuboid ��ก���ก�������'4��#������+ ' �ก��ก6�&���'��,�'�# ������ ����ก '� apex cuboid ,�#�'����4�$���������ก �� ����ก���ก� data cube
����,�#��ก���ก�
©๒๕๕๐ กรุง สินอภิรมยสราญ 30
0-D(apex) cuboid
1-D cuboids
2-D cuboids
3-D cuboids
4-D(base) cuboid
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
��ก���ก�4� � �� Lattice
©๒๕๕๐ กรุง สินอภิรมยสราญ 31
� ����� �� �ก��4!������'����+��$�ก ��� (dimensions)
� �����'���)�� (Star schema): ������ ���!.�� �'�+) ���&�5��#���
� �����'���)�ก�1�&� # (Snowflake schema): �)3�ก����������'���)�� ����� ��� �ก���!.�� +) ����.���)3��#���!�/��������)�ก�1�&� #
� �����'�ก��' �� (Fact constellations): ������ ��&����������'� ก����� �ก���!.�� ��+)��� ������4!��' ก�� ��ก0"#�& .��ก��' �� &���� �����$����ก '� �����'�$�ก� �� (galaxy schema)
� ������ ������ก1�����ก '� �����ก1�� � $�� (Fact table)
�����'������� ��
©๒๕๕๐ กรุง สินอภิรมยสราญ 32
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_sales
Measures
item_keyitem_namebrandtypesupplier_type
item
branch_keybranch_namebranch_type
branch
�� ��'�������'���)��
©๒๕๕๐ กรุง สินอภิรมยสราญ 33
location_keystreetcity_key
location
Sales Fact Table
time_key
item_key
branch_key
location_key
units_sold
dollars_sold
avg_sales
item_keyitem_namebrandtypesupplier_key
itemtime_keydayday_of_the_weekmonthquarteryear
time
Measures
branch_keybranch_namebranch_type
branch
supplier_keysupplier_type
supplier
city_keycityprovince_or_statecountry
city
�� ��'�������'���)�ก�1�&� #
©๒๕๕๐ กรุง สินอภิรมยสราญ 34
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_sales
Measures
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
�� ��'�������'�ก��' ��
©๒๕๕๐ กรุง สินอภิรมยสราญ 35
� � ����ก�#$�� (distributive): ����82�4�ก���6�� "�'�$�ก n ก��' ��'�ก��ก��
,�'ก��' �6�� ",�� ก��� �� ก�� +��,ก' count(), sum(), min(), max()
� � ����8�!�"�� (algebraic): ����82��� ��(�6�� "���4!�A*ก�!����
8�!�"����� � M ��ก0"# ,�'�#�'�4� M +��$�กก��4!�� ����ก�#$��ก��!���� ��
+��,ก' avg(), min_N(), standard_deviation()
� � ����ก��4!��� ����/& � (holistic): ����82�+ '�ก��$�กก���6�� "���ก��
,�'+����� ���4!��� ����/& ���'���/� +��,ก' median(), mode(), rank()
� ����� ��� ��
©๒๕๕๐ กรุง สินอภิรมยสราญ 36
all
Europe North_America
MexicoCanadaSpainGermany
Vancouver
M. WindL. Chan
...
......
... ...
...
TorontoFrankfurt
all
region
office
country
city
�#���!�/�� � ����� ����(�����
©๒๕๕๐ กรุง สินอภิรมยสราญ 37
ก��ก6�&���#���!�/�
� �#���!�/�,���-�
{1..10} < inexpensive
� ��������#���!�/�
day < {month < quarter; week} < year
�� ��'� � ������ ��,�#�#���!�/�
©๒๕๕๐ กรุง สินอภิรมยสราญ 38
� )�� �"ก�����)3�A*ก�!��� product, month ,�# region
Pro
duct
Regio
n
Month
���: Product, Location, Time
,���#���!�/�+������/Industry Region Year
Category Country Quarter
Product City Month Week
Office Day
�� ��,��&��� ���
©๒๕๕๐ กรุง สินอภิรมยสราญ 39
Total annual salesof TV in U.S.A.Date
Produ
ct
Cou
ntrysum
sum TV
VCRPC
1Qtr 2Qtr 3Qtr 4Qtr
U.S.A
Canada
Mexico
sum
�� ��'���� ����ก���ก�
Grand total����������
©๒๕๕๐ กรุง สินอภิรมยสราญ 40
0-D(apex) cuboid
1-D cuboids
2-D cuboids
3-D(base) cuboid
all
product date country
product,date product,country date, country
product, date, country
Cuboid ก����ก���ก�
©๒๕๕๐ กรุง สินอภิรมยสราญ 41
� ���.�� .�,���� ���8
� ������ก�����4!������
ก��,���� ���8���ก���ก�
©๒๕๕๐ กรุง สินอภิรมยสราญ 42
��ก�������� C
� S. Agarwal, R. Agrawal, P. M. Deshpande, A. Gupta, J. F. Naughton, R. Ramakrishnan, and S. Sarawagi. On the computation of multidimensional aggregates. In Proc. 1996 Int. Conf. Very Large Data Bases, 506-521, Bombay, India, Sept. 1996.
� D. Agrawal, A. E. Abbadi, A. Singh, and T. Yurek. Efficient view maintenance in data warehouses. In Proc. 1997 ACM-SIGMOD Int. Conf. Management of Data, 417-427, Tucson, Arizona, May 1997.
� R. Agrawal, J. Gehrke, D. Gunopulos, and P. Raghavan. Automatic subspace clustering of high dimensional data for data mining applications. In Proc. 1998 ACM-SIGMOD Int. Conf. Management of Data, 94-105, Seattle, Washington, June 1998.
� R. Agrawal, A. Gupta, and S. Sarawagi. Modeling multidimensional databases. In Proc. 1997 Int. Conf. Data Engineering, 232-243, Birmingham, England, April 1997.
� K. Beyer and R. Ramakrishnan. Bottom-Up Computation of Sparse and Iceberg CUBEs. In Proc. 1999 ACM-SIGMOD Int. Conf. Management of Data (SIGMOD'99), 359-370, Philadelphia, PA, June 1999.
� S. Chaudhuri and U. Dayal. An overview of data warehousing and OLAP technology. ACM SIGMOD Record, 26:65-74, 1997.
©๒๕๕๐ กรุง สินอภิรมยสราญ 43
��ก�������� D
� J. Gray, S. Chaudhuri, A. Bosworth, A. Layman, D. Reichart, M. Venkatrao, F. Pellow, and H. Pirahesh. Data cube: A relational aggregation operator generalizing group-by, cross-tab and sub-totals. Data Mining and Knowledge Discovery, 1:29-54, 1997.
� V. Harinarayan, A. Rajaraman, and J. D. Ullman. Implementing data cubes efficiently. In Proc. 1996 ACM-SIGMOD Int. Conf. Management of Data, pages 205-216, Montreal, Canada, June 1996.
� K. Ross and D. Srivastava. Fast computation of sparse datacubes. In Proc. 1997 Int. Conf. Very Large Data Bases, 116-125, Athens, Greece, Aug. 1997.
� K. A. Ross, D. Srivastava, and D. Chatziantoniou. Complex aggregation at multiple granularities. In Proc. Int. Conf. of Extending Database Technology (EDBT'98), 263-277, Valencia, Spain, March 1998.
� Y. Zhao, P. M. Deshpande, and J. F. Naughton. An array-based algorithm for simultaneous multidimensional aggregates. In Proc. 1997 ACM-SIGMOD Int. Conf. Management of Data, 159-170, Tucson, Arizona, May 1997.