# Data Mining of Students' Consumption Behaviour Pattern Based on Self-Attention Graph Neural Network
## 3 Methods  
### Data Description  
As the behaviour of students is often the same regardless of the semester, we only collected behaviour data over a single month. The activities of first-year students are relatively messy due to their curiosity and are difficult to analyse, while the third-year and fourth-year students need to engage in some social work outside the school, which leads to very short time at school and consumption behaviours are lacking and inconvenient to analyse. Therefore, we considered the consumption data of all second-year students at Beijing Institute of Technology, which is characterized by science and engineering majors and has a male to female ratio of 2.2 to 1. Students use campus cards for on-campus consumption, and the corresponding data are transmitted and stored in the school's campus card consumption system later, which is relatively convenient to access. Thus, from December 2020 to January 2021, we collected 752,725 pieces of consumption data generated during May 2020 and 3640 pieces of final exam scores of the course of  
```
1:Raw data file
2:Processed data files for different students
3:Group data by \(ID\)
4:while Student \(ID\) equals some \(ID\)do
5:if Two adjacent rows of data are exactly the same then
6:Delete a row
7:endif
8:if The consumption behaviour is in the gym, management office or school bus then
9:Delete the row
10:endif
11:if Two adjacent behaviours are the same then
12:if Time difference is less than 5 fminutes then
13:Delete the second row
14:endif
15:endif
16:endwhile
17:if More than 15 consumption data for some student then
18:Generate a new data file for the student
19:else
20:Do not consider the student's behaviour data
21:endif
```  
**Algorithm 1** Data pre-processing  
In collected data, \"management office\" refers to students' short-term campus card recharging behaviour; \"school bus\" refers to the behaviour of commuting between campuses, and the uncertainty of destination campus makes it impossible to analyse behavioural purpose; as for \"gym\", the overall time and purpose of staying in the gym based on this record cannot be inferred. Hence, we deleted related behaviours in the preprocessing algorithm. After the data preprocessing, we got the data of 3616 students and next considered extracting features from the following three aspects:  
1. Indicators of regularity
2. Amount of consumption
3. Behaviour sequence pattern  
After obtaining the features, we performed the chi-square test, f-test and other feature selection methods, and finally determined thirty relevant features related to the grades. Table 3 presents some of the information related to the features that were extracted. We noted that the features related to consumption money were intermediate, which meant that excessive consumption and low consumption were both abnormal phenomena. Thus, this type of feature was transformed to the maximum feature using Formula (1):  
\[x_{i}=1-\frac{|x_{i}-x_{\text{best}}|}{\max\{|x_{i}-x_{\text{best}}|\}} \tag{1}\]  
The same method was applied to the other similar intermediate indicators, as presented in Table 3.