Professional Documents
Culture Documents
Bài 2. Dữ liệu
Bài 2. Dữ liệu
Bài 2. Dữ liệu
Data
Mã MH: 505043
TS. HOÀNG Anh
1
Nội dung
n Dữ liệu và các loại thuộc tính/ Data Objects and Attribute Types
2
Tập dữ liệu/ Data Sets
n Bản ghi/ Record
n Relational records
Data matrix, e.g., numerical matrix, crosstabs
timeout
n
season
coach
game
score
team
ball
lost
pla
wi
n
y
n Document data: text documents: term-
frequency vector
n Transaction data
Document 1 3 0 5 0 2 6 0 2 0 2
n Đồ thị và Mạng/ Graph and network
n World Wide Web Document 2 0 7 0 2 1 0 0 3 0 0
3
1. Dữ liệu có cấu trúc
n Chiều/ Dimensionality
n Curse of dimensionality
n Sparsity
n Only presence counts
n Resolution
n Các mẫu phụ thuộc vào qui mô
n Phân bổ/ Distribution
n Trung tâm, và phân tán
4
Dữ liệu/ Data Objects
n Tập dữ liệu được tạo thành từ các đối tượng/điểm dữ liệu
n Một đối tượng dữ liệu đại diện cho một thực thể/ entity
n Ví dụ:
n sales database: customers, store items, sales
n medical database: patients, treatments
n university database: students, professors, courses
n Tên gọi khác: samples , examples, instances, data points,
objects, tuples.
n Các đối tượng dữ liệu được mô tả bởi các thuộc tính/
attributes.
n CSDL/ Database: hàng/rows -> data objects; cột/columns ->attributes
5
Thuộc tính/ Attributes
n Attribute (or dimensions, features, variables): đại diện
cho một đặc điểm của một đối tượng dữ liệu.
n E.g., customer _ID, name, address
n Interval-scaled
n Ratio-scaled
6
Các loại thuộc tính
n Định danh/ Nominal: categories, states, or “names of things”
n Hair_color = {auburn, black, blond, brown, grey, red, white}
n marital status, occupation, ID numbers, zip codes
n Nhị phân/ Binary
n Thuộc tính nhị phân với 2 trạng thái (0 và 1)
n Nhị phân đối xứng: cả 2 trạng thái đều quan trọng như nhau
n e.g., gender
n Nhị phân bất đối xứng: cả 2 trạng thái không quan trọng như nhau
n e.g., medical test (positive vs. negative)
n Convention: assign 1 to most important outcome (e.g., HIV
positive)
n Thứ tự/ Ordinal
n Các giá trị có ý nghĩa thứ tự (xếp hang), nhưng độ lớn giữa các giá trị kế
tiếp không được biết
n Size = {small, medium, large}, grades, army rankings
7
Các loại thuộc tính số
n Định lượng/ Quantity (integer or real-valued)
n Khoảng/ Interval
n Measured on a scale of equal-sized units
n Values have order
n E.g., temperature in C˚or F˚, calendar dates
n No true zero-point
n Tỉ lệ/ Ratio
n Inherent zero-point
n We can speak of values as being an order of magnitude
larger than the unit of measurement (10 K˚ is twice as
high as 5 K˚).
n e.g., temperature in Kelvin, length, counts, monetary
quantities
8
Thuộc tính rời rạc, liên tục
n Rời rạc/ Discrete Attribute
n Chỉ có 1 bộ giá trị hữu hạn hoặc vô hạn đếm được
collection of documents
n Đôi khi, được biểu diễn dưới dạng các biến số nguyên
n Lưu ý: Thuộc tính nhị phân là trường hợp đặc biệt của thuộc
tính rời rạc
n Liên tục/ Continuous Attribute
n Gía trị thuộc tính là số thực
n Trên thực tế, các giá trị thực chỉ có thể được đo lường và biểu
diễn bằng 1 số chử số hữu hạn
n Các thuộc tính liên tục thường được biểu diễn dưới dạng các
biến dấu phẩy động
9
2. Mô tả thống kê cơ bản
n Lý do?/ Motivation
n Hiểu rỏ dữ liệu: xu hướng tập trung, biến thể, và giàn trải
n Độ phân tán/ Data dispersion characteristics
n median, max, min, quantiles, outliers, variance, etc.
n Các chiều được số hóa trên các khoảng:
n Dữ liệu phân tán: phân tích trên nhiều chiều
n Boxplot hoặc phân tích rời rạc trên các khoảng (sorted)
n Dispersion analysis on computed measures
n Folding measures into numerical dimensions
n Boxplot or quantile analysis on the transformed cube
10
Các đại lượng trung tâm
n Trung bình/ Mean (algebraic measure):
1 n
x = å xi µ= å x
Note: n is sample size and N is population size.
n i =1 N
n
n Weighted arithmetic mean: åw x i i
1 n 1 n 2 1 n 1 n
1 n
s =
2
å
n - 1 i =1
( xi - x ) =
2
[å xi - (å xi ) 2 ]
n - 1 i =1 n i =1
s =
2
N
å
i =1
( xi - µ 2
) =
N
åx
i =1
i
2
- µ2
n Boxplot
n Data is represented with a box
n The ends of the box are at the first and third
quartiles, i.e., the height of the box is IQR
n The median is marked by a line within the box
n Whiskers: two lines outside the box extended to
Minimum and Maximum
n Outliers: points beyond a specified outlier
threshold, plotted individually
14
Trực quan hoá phân tán dữ liệu: 3-D Boxplots
16
Đồ thị mô tả thống kê cơ bản
17
Biểu đồ Histogram
n Histogram: một dạng biểu đồ cột được
sử dụng để mô tả trực quan sự phân bố 40
tần suất cho tập dữ liệu. 35
30
n Trung tâm về mặt vị trí của tập dữ liệu; 25
n Độ phân tán của tập dữ liệu;
20
n Độ lệch của tập dữ liệu;
15
n Sự hiện diện của các giá trị ngoại lệ
(outliers); 10
18
Biểu đồ Histogram nhiều thông tin hơn Boxplot
19
Biểu đồ rời rạc hóa
n Hiển thị tất cả dữ liệu (cho phép người dùng đánh gía cả hành vi
tổng thể và các sự cố bất thường)
n Thông tin biểu đồ rời rạc hóa/ lượng tử
n For a data xi data sorted in increasing order, fi indicates that
approximately 100 fi% of the data are below or equal to the
value xi
21
Biểu đồ phân tán/ Scatter plot
n Cung cấp cái nhìn đầu tiên về dữ liệu 2 biến số để xem các cụm
điểm, giá trị ngoại lệ, v.v.
n Mỗi cặp giá trị được coi là 1 cặp tọa độ, và được vẽ dưới dạng
các điểm trong mặt phẳng
22
Dữ liệu tương quan dương, âm
23
Dữ liệu không tương quan
24
3. Trực quan hóa dữ liệu
n Tại sao? Why data visualization?
n Hiểu rỏ hơn về không gian thông tin bằng cách ánh xạ dữ liệu lên các tọa độ
n Cung cấp tổng quan định tính về tập dữ liệu lớn
n Tìm kiếm các mẫu, xu hướng, cấu trúc, bất thường, mối quan hệ giữa dữ liệu
n Giúp tìm các khu vực thú vị và các tham số phù hợp để phân tích định lượng
n Cung cấp bằng chứng trực quan
(a) Income (b) Credit Limit (c) transaction volume (d) age
26
Biểu diễn các pixel trong các đoạn hình tròn
n Để tiết kiệm không gian và hiển thị các kết nối giữa nhiều chiều, việc lấp đầy
khoảng trống thường được thực hiện trong một đoạn hình tròn
n Trực quan hóa các phép biến đổi hình học và phép
chiếu của dữ liệu
n Phương pháp/ Methods
n Trực quan hóa trực tiếp/ Direct visualization
n Biểu đồ phân tán/ Scatterplot and scatterplot matrices
n Landscapes
n Projection pursuit technique: Help users find meaningful
projections of multidimensional data
n Prosection views
n Siêu lát cắt/ Hyperslice
n Tọa độ song song/ Parallel coordinates
28
Ribbons with Twists Based on Vorticity
Trực quan hóa dữ liệu trực tiếp
news articles
visualized as
a landscape
• • •
33
Trực quan hóa dữ liệu dựa trên biểu tượng
n Trực quan hóa các giá trị dữ liệu dưới dạng các tính năng của
biểu tượng
n Phương pháp trực quan điển hình:
n Chernoff Faces
n Stick Figures
n Kỹ thuật chung:
n Mã hóa hình dạng: Sử dụng hình dạng để biểu thị mã hóa
thông tin nhất định
n Biểu tượng màu: Sử dụng biểu tượng màu để mã hóa thêm
thông tin
n Thanh ô xếp: Sử dụng các biểu tượng nhỏ để biểu thị các
véc-tơ đặc trưng có liên quan trong truy xuất tài liệu
34
Chernoff Faces
35
Stick Figure
A census data
figure showing
age, income,
used by permission of G. Grinstein, University of Massachusettes at Lowell
gender,
education, etc.
A 5-piece stick
figure (1 body
and 4 limbs w.
different
angle/length)
Two attributes mapped to axes, remaining attributes mapped to angle or length of limbs”. Look at texture pattern 36
Kỹ thuật trực quan hóa phân cấp
37
Xếp chồng chiều/ Dimensional Stacking
attribute 4
attribute 2
attribute 3
attribute 1
Visualization of oil mining data with longitude and latitude mapped to the outer
x-, y-axes and ore grade and depth mapped to the inner x-, y-axes
39
Worlds-within-Worlds
n Assign the function and two most important parameters to innermost world
n Fix all other parameters at constant values - draw other (1 or 2 or 3 dimensional
worlds choosing these as the axes)
n Software that uses this paradigm
n N–vision: Dynamic
interaction through data
glove and stereo displays,
including rotation, scaling
(inner) and translation
(inner/outer)
n Auto Visual: Static
interaction by means of
queries
40
Bản đồ cây/ Tree-Map
n Screen-filling method which uses a hierarchical partitioning of the
screen into regions depending on the attribute values
n The x- and y-dimension of the screen are partitioned alternately
according to the attribute values (classes)
Ack.: http://www.cs.umd.edu/hcil/treemap-history/all102001.jpg 41
Tree-Map of a File System (Schneiderman)
42
InfoCube
n A 3-D visualization technique where hierarchical
information is displayed as nested semi-transparent
cubes
n The outermost cubes correspond to the top level data,
while the subnodes or the lower level data are
represented as smaller cubes inside the outermost cubes,
and so on
43
Three-D Cone Trees
n 3D cone tree visualization technique works
well for up to a thousand nodes or so
n First build a 2D circle tree that arranges its
nodes in concentric circles centered on the root
node
n Cannot avoid overlaps when projected to 2D
n G. Robertson, J. Mackinlay, S. Card. “Cone
Trees: Animated 3D Visualizations of
Hierarchical Information”, ACM SIGCHI'91
n Graph from Nadeau Software Consulting
website: Visualize a social network data set that
models the way an infection spreads from one
person to the next
Ack.: http://nadeausoftware.com/articles/visualization
44
Trực quan hóa dữ liệu và quan hệ phức tạp
n Trực quan hóa dữ liệu phi số: văn bản và mạng xã hội
n Đám mây thẻ/ tag: Trực quan hóa các thẻ do người dùng tạo
n The importance of tag is
represented by font
size/color
46
Ma trận dữ liệu và ma trận không tương đồng
47
Thước đo tiệm cận cho các thuộc tính danh nghĩa
49
Sự khác biệt giữa các biến nhị phân
n Ví dụ
Name Gender Fever Cough Test-1 Test-2 Test-3 Test-4
Jack M Y N P N N N
Mary F Y N P N P N
Jim M Y P N N N N
zif = sf
n Chuẩn hóa (z-score):
n Thường sử dụng độ lệch tuyệt đối trung bình nhiều hơn độ lệch chuẩn
51
Ma trận dữ liệu và ma trận không tương đồng
Data Matrix
x2 x4 point attribute1 attribute2
x1 1 2
4 x2 3 5
x3 2 0
x4 4 5
2 x1 Dissimilarity Matrix
(with Euclidean Distance)
x1 x2 x3 x4
x3
x1 0
0 2 4
x2 3.61 0
x3 5.1 5.1 0
x4 4.24 1 5.39 0
52
Khoảng cách trên dữ liệu số: Minkowski Distance
n Minkowski distance: thước đo khoảng cách phổ biến
the vectors
54
Example: Minkowski Distance
Dissimilarity Matrices
point attribute 1 attribute 2 Manhattan (L1)
x1 1 2
L x1 x2 x3 x4
x2 3 5 x1 0
x3 2 0 x2 5 0
x4 4 5 x3 3 6 0
x4 6 1 7 0
Euclidean (L2)
x2 x4
L2 x1 x2 x3 x4
4 x1 0
x2 3.61 0
x3 2.24 5.1 0
x4 4.24 1 5.39 0
2 x1
Supremum
L¥ x1 x2 x3 x4
x1 0
x2 3 0
x3 x3 2 5 0
0 2 4 x4 3 1 5 0
55
Biến thông thường/ Ordinal Variables
n Cosine measure: If d1 and d2 are two vectors (e.g., term-frequency vectors), then
cos(d1, d2) = (d1 • d2) /||d1|| ||d2|| ,
where • indicates vector dot product, ||d||: the length of vector d
58
Example: Cosine Similarity
n cos(d1, d2) = (d1 • d2) /||d1|| ||d2|| ,
where • indicates vector dot product, ||d|: the length of vector d
d1 = (5, 0, 3, 0, 2, 0, 0, 2, 0, 0)
d2 = (3, 0, 2, 0, 1, 1, 0, 1, 0, 1)
d1•d2 = 5*3+0*0+3*2+0*0+2*1+0*1+0*1+2*1+0*0+0*1 = 25
||d1||= (5*5+0*0+3*3+0*0+2*2+0*0+0*0+2*2+0*0+0*0)0.5=(42)0.5 = 6.481
||d2||= (3*3+0*0+2*2+0*0+1*1+1*1+0*0+1*1+0*0+1*1)0.5=(17)0.5 = 4.12
cos(d1, d2 ) = 0.94
59
5. Tổng kết
n Các loại thuộc tính dữ lieu: danh nghĩa, nhị phân, thứ tự, chia khoảng, chia tỉ lệ
n Nhiều loại tập dữ lieu: ví dụ, số, văn bản, biểu đồ, web, hình ảnh
n Hiểu rỏ hơn về dữ liệu bằng cách:
n Thống kê cơ bản: xu hướng trung tâm, độ phân tán, hiển thị đồ họa
n Trực quan hóa dữ liệu: ánh xạ dữ liệu lên các tọa độ nguyên mẫu
n Đo độ tương tự của dữ liệu
60
Tham khảo/ References
n W. Cleveland, Visualizing Data, Hobart Press, 1993
n T. Dasu and T. Johnson. Exploratory Data Mining and Data Cleaning. John Wiley,
2003
n U. Fayyad, G. Grinstein, and A. Wierse. Information Visualization in Data Mining and
Knowledge Discovery, Morgan Kaufmann, 2001
n L. Kaufman and P. J. Rousseeuw. Finding Groups in Data: an Introduction to Cluster
Analysis. John Wiley & Sons, 1990.
n H. V. Jagadish, et al., Special Issue on Data Reduction Techniques. Bulletin of the
Tech. Committee on Data Eng., 20(4), Dec. 1997
n D. A. Keim. Information visualization and visual data mining, IEEE trans. on
Visualization and Computer Graphics, 8(1), 2002
n D. Pyle. Data Preparation for Data Mining. Morgan Kaufmann, 1999
n S. Santini and R. Jain,” Similarity measures”, IEEE Trans. on Pattern Analysis and
Machine Intelligence, 21(9), 1999
n E. R. Tufte. The Visual Display of Quantitative Information, 2nd ed., Graphics Press,
2001
n C. Yu , et al., Visual data mining of multimedia data for social and behavioral studies,
Information Visualization, 8(1), 2009 61