ii CONTENTS
7 Outlier Detection 59
7.1 Univariate Outlier Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
7.2 Outlier Detection with LOF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
7.3 Outlier Detection by Clustering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
7.4 Outlier Detection from Time Series . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
7.5 Discussions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
8 Time Series Analysis and Mining 71
8.1 Time Series Data in R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
8.2 Time Series Decomposition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
8.3 Time Series Forecasting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
8.4 Time Series Clustering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
8.4.1 Dynamic Time Warping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
8.4.2 Synthetic Control Chart Time Series Data . . . . . . . . . . . . . . . . . . . 76
8.4.3 Hierarchical Clustering with Euclidean Distance . . . . . . . . . . . . . . . 77
8.4.4 Hierarchical Clustering with DTW Distance . . . . . . . . . . . . . . . . . . 79
8.5 Time Series Classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
8.5.1 Classification with Original Data . . . . . . . . . . . . . . . . . . . . . . . . 81
8.5.2 Classification with Extracted Features . . . . . . . . . . . . . . . . . . . . . 82
8.5.3 k-NN Classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
8.6 Discussions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
8.7 Further Readings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
9 Association Rules 85
9.1 Basics of Association Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
9.2 The Titanic Dataset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
9.3 Association Rule Mining . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
9.4 Removing Redundancy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
9.5 Interpreting Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
9.6 Visualizing Association Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
9.7 Discussions and Further Readings . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
10 Text Mining 97
10.1 Retrieving Text from Twitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
10.2 Transforming Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
10.3 Stemming Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
10.4 Building a Term-Document Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
10.5 Frequent Terms and Associations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
10.6 Word Cloud . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
10.7 Clustering Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
10.8 Clustering Tweets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
10.8.1 Clustering Tweets with the k-means Algorithm . . . . . . . . . . . . . . . . 106
10.8.2 Clustering Tweets with the k-medoids Algorithm . . . . . . . . . . . . . . . 107
10.9 Packages, Further Readings and Discussions . . . . . . . . . . . . . . . . . . . . . . 109
11 Social Network Analysis 111
11.1 Network of Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
11.2 Network of Tweets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
11.3 Two-Mode Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
11.4 Discussions and Further Readings . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
12 Case Study I: Analysis and Forecasting of House Price Indices 125
13 Case Study II: Customer Response Prediction and Profit Optimization 127
评论2
最新资源