# Visual Analytic Method for Students' Association via Modularity Optimization
## 5 Data Collecting and Feature Extracting  
Our dataset includes records of book borrowing, showering, library entrance, and meals of 8685 students enrolled in the Spring 2017 semester.  
To compute the behavior similarity among students, we extracted the following seven features from the original behavior data.  
* Number of smart card transactions. In most Chinese universities, smart cards serve as the unique payment medium in cantenes, bathrooms, and libraries. Therefore, smart card consumption records can describe the activities of each student on campus. We count the number of transactions via smart card at given locations in a specified period. The higher this number, the more active a student at a specified location and time.
* Amount of transactions via smart card. The sum of transaction amounts can evaluate the consumption level of a student in a specified location and period.(i.e., a semester or a month).
* Consumption frequency during peak period. A peak period is a time interval during which most students perform the same activity. According to the teaching schedule, we define three peak consumption periods: 7 a.m. to 9 a.m. for breakfast, 11 a.m. to 1 p.m. for lunch, and 5 p.m. to 8 p.m. for dinner. We defined a triple to store the frequency of consumption during the three peak periods, through which we can measure the level of orderliness of each student.  
* Number of days that students have a regular lifestyle on campus. A regular lifestyle connotes consumption frequency during peak periods in the normal range.
* Entropy of activity locations. The degree of dispersion of activity locations reflects a student's level of disorder in a period. We acquire all the activity locations and compute the entropy as Equation (1), where \(L_{u}\) denotes all activity locations visited by student \(u\), \(L_{u}^{{}^{\prime}}=L_{u}\cap\{l\}\) represents the activity locations in the specified area \(l\) visited by student \(u\), \(|L_{u}^{{}^{\prime}}|\) is the total number of visits to area \(l\) by student \(u\), and \(P_{u}(l)=|L_{u}^{{}^{\prime}}|/|L_{u}|\) is the probability that student \(u\) visits area \(l\). \[\text{Entropy\_Loc}(u)=-\sum_{l\in L_{u}}P_{u}(l)\text{log}P_{u}(l).\] (1)
* Entropy of activity time. This measures the degree of dispersion of each student's activity time. Similar to the entropy of activity locations, we acquired all activity times and locations, and computed this entropy as Equation (2), where \(T_{u}\) is overall time distribution of visits to the specified area by student \(u\). \(T_{u}^{{}^{\prime}}\subset T_{u}\) is the specified part of \(T_{u}\), \(|T_{u}^{{}^{\prime}}|\) is the number of times student \(u\) visits the area in the specified time interval, and \(|T_{u}|\) is the total number of visits by student \(u\) to the given area. \(P_{u}(t)=|T_{u}^{{}^{\prime}}|/|T_{u}|\) is the probability that student \(u\) visits the given area in time interval \(t\). \[\text{Entropy\_Time}(u)=-\sum_{t\in T_{u}}P_{u}(t)\text{log}P_{u}(t).\] (2)
* Number of books borrowed from library. This can be computed through the book-borrowing records, which are filtered by borrowing time and book type.