# Research on Psychological Emotion Recognition of College Students Based on Deep Learning

Authors: Yuebo Li; Yatong Zhou
Journal: Scientific Programming
 (2022)

---

## Abstract

College students’ anxiety, depression, inferiority complex, interpersonal sensitivity, and a series of mental health problems have a very serious negative impact on individuals, families, and society. In order to obtain better psychological emotion recognition effect of college students, this paper proposes a psychological emotion recognition algorithm based on multisource data. One-dimensional convolutional neural network (1D-CNN) was used to mine students’ online patterns from online behavior sequences. According to the consumption data of students in the canteen, abnormal scores are calculated to depict the dietary differences among students. At the same time, the students’ psychological state data provided by the psychological center are used as labels to improve the shortcomings of the questionnaire. Five kinds of common classification algorithms are trained by training set, and the classifier with the best effect is selected through evaluation of verification set, which is used to identify students with mental health problems in the test set. Experimental results show that precision, recall, andF1-measure reach 0.68, 0.56, and 0.67, respectively. 75% of students with mental health problems are identified. The psychological and emotional recognition system of college students based on deep learning provides systematic method and theoretical support for the school to find students with psychological problems in time and provide intervention.


---

## Body

## 1. Introduction

With the rapid development of knowledge economy and the increasing popularity of higher education, the number of college students is increasing day by day, and there are more and more students with psychological problems [1]. College students, as a part of high-level talents, have always been regarded as the outstanding generation of the society, with strong psychological quality by default, but the fact is disappointing. All kinds of pressures such as study, social relationship, and employment make college students mentally exhausted, and timely detection of abnormal students has become one of the most concerned and intractable problems in universities [2].People’s psychological characteristics can be expressed through daily living behaviors and work-and-rest rules. Researchers have mined information that can reflect the mental health state from the daily behavior data of college students. Research shows that there is a close relationship between mental health and online behavior. Jorm proposed an algorithm to predict mental health problems through online use behavior. Based on web usage behavior, a computational model for predicting scores of SCL-90 dimensions was established [3]. Nie [4] proposed a new method to predict the future mental illness severity (MIS) of users sharing posts on Instagram in 2014. Paola [5] discussed the universality and treatment of college students’ psychology and psychosis, proposed the uniqueness of college students’ development stage and environment in terms of psychological abnormalities, and summarized the influence of college students’ psychological problems [6]. Zanganeh [7] (2018) explored the role of emotional factors in doctoral students’ online information retrieval. Domestic scholars have conducted relevant research on this topic [8]. Tang [9] used SCL-90 scale to measure the mental health of graduate students, established a prediction model through BP neural network to analyze and predict the mental health status of students, and put the model into practical application [10]. Wang Yinmei et al. [11] used symptom measurement scale to investigate 532 college students and found that college students’ mental health varies in different grades, mainly influenced by interpersonal relationship, diet and sleep in college, and students of different majors have different psychological conditions [12]. Zhu [13] (2019) proposed a new method to detect depression through time-frequency analysis of network behaviors. A classification model was established to distinguish the high SDS group from the low SDS group, and a more accurate prediction model was established to identify the psychological state of the depression group [14].To sum up, this paper carries out an analysis and research on students’ mental health state through the data of students’ education in school and excavates the relationship between college students’ behaviors and their mental health state, which plays an important role and shows significance for university student managers to carry out early intervention for students with psychological abnormalities.


## 2. Principle of Deep Learning Algorithm

Deep learning is the process of using computers to imitate human learning behaviors. In the process of learning, new knowledge and experience are constantly accumulated, and their own knowledge structure is established according to this knowledge so as to improve their learning ability [15]. The research in this paper is a binary classification problem, and five commonly used classification algorithms are used in the experimental process, including decision tree, random forest, naive Bayes, gradient ascending tree, and BP neural network. In the feature extraction process, in order to reflect the dining situation of students, k-means clustering is used to cluster the dietary data of students.


### 2.1.k-Means Clustering

The main idea ofk-means clustering algorithm: firstly, select K sample points randomly from the sample set and take them as the center of the cluster. Then, according to the distance between each sample and the k centroids, it is divided into the nearest cluster, and then the centroids of each cluster are recalculated [16]. Euclidean distance is used in this paper, and the calculation formula is shown as(1)dx,Ci=∑j=1mxj−cij2,where x is the data object, Ci is the ith cluster center, m is the dimension of the data object, xi, Cij are the j attribute values of x and Ci. The calculation formula of error square and SSE of the whole data set is shown as(2)SSE=∑i=1k∑x∈Cidx,Ci2.


### 2.2. Decision Tree Algorithm

The different decision tree algorithms according to different split attribute algorithms are as follows. ID3 algorithm selects the optimal attribute for splitting by calculating the information gain, and the attribute with the maximum information gain after partitioning is the optimal attribute [17]. The information gain is calculated on the basis of information entropy, which is shown as(3)EntropyD=−∑i=1mpilog2pi.Among them,m is the number of categories in a data set D, and pi is the first i category of probability. The smaller the value of (D) is, the higher the purity of Dis.If attributea in the data set is used, the possible values of a are v=a1,a2,a3,…,av, which can be calculated according to formula (4) to attribute a classified information entropy Dv, because the various values of a sample are different, add weight to each branch node| Dv |/| D |, when dividing the data set with property a, can according to the formula to calculate the sample set of type D information gain.(4)GainD,a=EntropyD=−∑v=1VEntropyDv.However, the information gain tends to favor attributes with more values. In order to improve this defect, the famous C4.5 algorithm is proposed [7], which uses the information gain rate when selecting attributes, as shown in formula (5). The detailed attribute selection process is as follows: firstly, the information gain of the attribute is calculated, and the attribute whose information gain is higher than the average value is selected, and then the highest gain rate is selected from these attributes for classification.(5)Gain_ratioD,a=GainD,aSIa.(6)SIa=−∑v=1VDvDlog2DvD.CART algorithm uses Gini index to select the optimal splitting attribute, and the calculation speed is faster than the information gain rate [13]. The purity of dataset D can be measured by Gini index, as shown in (7). The smaller (D) is, the higher the purity of the data set is. Therefore, which attribute is the optimal splitting attribute can be judged according to the size of Gini index.(7)GiniD=1−∑i=1npi2.The idea of decision tree algorithm is simple, easy to understand, and easy to extract rules. Insensitivity to data can process both nominal and numerical data and can process unrelated features. However, it also has some disadvantages. First, it is easy to produce overfitting, and second, it is easy to ignore the correlation between attributes.


### 2.3. Random Forest Algorithm

The random forest algorithm takes decision tree-based classifier and combines Bagging construction with random attribute selection. Its workflow is shown in Figure1. Specifically, random forest determines the category of samples by voting, and each base classifier has one vote to determine the category of samples according to the principle of majority rule. The randomness of the random forest in random attribute selection, for each node base classifier, randomly selected from the set from the current node attributes first k attribute a subset, and then according to the attribute selection algorithm from subset to calculate the optimal split attribute, rather than the traditional decision tree from the current node, find out the best in all of the attributes of the attribute. The parameter k is introduced to reflect the randomness of the random forest Algorithm 1.Figure 1
Random forest workflow.Algorithm 1:
(i)
Input: data setT = {(x1, y1), (x2, y2),…, (xm, ym)}, loss function L(ii)
Output: Additive modelf⌢x = fM(x)(1) Initialize the base classifierf0=x=argminγ∑i=1NLyi,γ(2) Each base classifier needs to perform the following operations:① According to the loss function, the negative gradient of each sample in the current model is calculated and used as an estimate of the residualrim=−∂Lyi,fxi/∂,fxi.② For a givenΓim, the leaf node Rmj, Rmj, j = 1,2,..,J, j is the number of leaf nodes③ For leaf nodes, calculatecmj=argminc∑Xi∈RmjLyi,fm−1xi+c.④ Update regression treefmx=fm−1x+∑j=1JcmjIx∈Rmj.(3) Output gradient lifting treef^x=fMx.


### 2.4. Naive Bayes

Naive Bayes algorithm takes Bayes algorithm as the premise and introduces the “independence” hypothesis, whose assumed attributes are independent of each other [18]. Under this assumption of independence, naive Bayes algorithm is especially suitable for solving multiattribute problems. Naive Bayes algorithm is currently recognized as a simple and effective probability classification method, and its classification process is as follows:(1)
Assume that each sample hasn attributes. Each sample is represented by an n-dimensional eigenvector d=d1,d2,d3,…,dn.(2)
Suppose there arem categories c=c1,c2,c3,…,cm. Given an unknown data sample d, the classification predicts that d belongs to the class with the maximum posterior probability, that is, if and only if pc|d>pc|d1≤j≤m and j≠i, The Bayesian classification assigns the sample to be classified to class ci, and the value of pci|d can be calculated by the conditional probability formula in probability theory, as shown in the following formula.(8)Pci|d=Pd|ciPciPd.(3)
Since the sample set is known and the value ofP(d) can be calculated, the maximum value of Pci|d can only be calculated by the maximum value of pd|cipci. Without knowing the prior probabilities of the classes, assume that each class is equally likely, so you just maximize (d|ci). Otherwise, maximize d|cici.(4)
In the case of multiple attributes, the overhead of calculating (d|ci) may be very large. In this case, we can make the naive assumption of class condition independence to reduce the overhead of calculating (d|ci). The classes of a given sample are labeled, assuming that the attributes are independent of each other.(9)Pd|ci=∏j=1aPdj|ci,whered1|ci,d2|ci,…,Pdj|ci can be computed from the sample set.(5)
When classifying classified sampled, calculate d|cici for each class ci in turn. If and only if d|cici>Pd|cjPj,1≤j≤m,j≠i, sample d to be classified is divided into class ci.


### 2.5. BP Neural Network

BP neural network is a multilayer feedforward neural network trained according to error reverse propagation algorithm. The training process of BP neural network is divided into two parts: one is signal forward propagation, and the other is error reverse propagation, as shown in Figure2. Among them, BP neural network has many advantages such as strong nonlinear mapping ability, generalization ability, and fault tolerance ability due to its error back propagation learning process.Figure 2
Multisource data-based student mental health problem recognition algorithm framework.BP neural network consists of three parts: input layer, hidden layer, and output layer. Among them, the number of training sample attributes determines the number of neurons in the input layer, and the number of target classification determines the number of neurons in the output layer. For example, for a binary classification problem, there are only two neurons in the output layer. Users can freely define the number of hidden layers and the number of neurons in each hidden layer. The lines between each layer represent the weights.BP neural network has the following advantages: first, it has strong adaptability and self-learning ability, which can continuously learn and correct path weight and save learning content during training. Second, the nonlinear mapping and fault tolerance ability can better solve the internal mechanism of the more complex nonlinear mapping. However, BP neural network has some defects, such as slow training speed, no corresponding standard for hidden layers, and number of neurons.


### 2.6. Pearson’s Correlation Coefficient

Pearson’s correlation coefficient is used to measure the linear correlation between two variables in most cases. It is defined as the quotient of covariance and standard deviation between two variables, and its calculation is shown in the following formula.(10)ρX,Y=covX,YσX,Y=EXY−EXEYEXZ−E2XEYZ−E2Y,where X and Y represent two random variables, cov (X, Y) represents the covariance between X and Y, σX,Y represents the standard deviation between X and Y, and E represents statistical mathematical expectation.Pearson’s correlation coefficient ranges from −1 to 1. A positive value means a positive correlation between two variables (1 means a complete positive correlation), a negative value means a negative correlation between two variables (−1 means a complete negative correlation), and a 0 value means there is no linear correlation between two variables. When comparing the correlation between feature and target problem, the larger the absolute value of correlation coefficient is, the more relevant the feature is to target problem.


## 2.1.k-Means Clustering

The main idea ofk-means clustering algorithm: firstly, select K sample points randomly from the sample set and take them as the center of the cluster. Then, according to the distance between each sample and the k centroids, it is divided into the nearest cluster, and then the centroids of each cluster are recalculated [16]. Euclidean distance is used in this paper, and the calculation formula is shown as(1)dx,Ci=∑j=1mxj−cij2,where x is the data object, Ci is the ith cluster center, m is the dimension of the data object, xi, Cij are the j attribute values of x and Ci. The calculation formula of error square and SSE of the whole data set is shown as(2)SSE=∑i=1k∑x∈Cidx,Ci2.


## 2.2. Decision Tree Algorithm

The different decision tree algorithms according to different split attribute algorithms are as follows. ID3 algorithm selects the optimal attribute for splitting by calculating the information gain, and the attribute with the maximum information gain after partitioning is the optimal attribute [17]. The information gain is calculated on the basis of information entropy, which is shown as(3)EntropyD=−∑i=1mpilog2pi.Among them,m is the number of categories in a data set D, and pi is the first i category of probability. The smaller the value of (D) is, the higher the purity of Dis.If attributea in the data set is used, the possible values of a are v=a1,a2,a3,…,av, which can be calculated according to formula (4) to attribute a classified information entropy Dv, because the various values of a sample are different, add weight to each branch node| Dv |/| D |, when dividing the data set with property a, can according to the formula to calculate the sample set of type D information gain.(4)GainD,a=EntropyD=−∑v=1VEntropyDv.However, the information gain tends to favor attributes with more values. In order to improve this defect, the famous C4.5 algorithm is proposed [7], which uses the information gain rate when selecting attributes, as shown in formula (5). The detailed attribute selection process is as follows: firstly, the information gain of the attribute is calculated, and the attribute whose information gain is higher than the average value is selected, and then the highest gain rate is selected from these attributes for classification.(5)Gain_ratioD,a=GainD,aSIa.(6)SIa=−∑v=1VDvDlog2DvD.CART algorithm uses Gini index to select the optimal splitting attribute, and the calculation speed is faster than the information gain rate [13]. The purity of dataset D can be measured by Gini index, as shown in (7). The smaller (D) is, the higher the purity of the data set is. Therefore, which attribute is the optimal splitting attribute can be judged according to the size of Gini index.(7)GiniD=1−∑i=1npi2.The idea of decision tree algorithm is simple, easy to understand, and easy to extract rules. Insensitivity to data can process both nominal and numerical data and can process unrelated features. However, it also has some disadvantages. First, it is easy to produce overfitting, and second, it is easy to ignore the correlation between attributes.


## 2.3. Random Forest Algorithm

The random forest algorithm takes decision tree-based classifier and combines Bagging construction with random attribute selection. Its workflow is shown in Figure1. Specifically, random forest determines the category of samples by voting, and each base classifier has one vote to determine the category of samples according to the principle of majority rule. The randomness of the random forest in random attribute selection, for each node base classifier, randomly selected from the set from the current node attributes first k attribute a subset, and then according to the attribute selection algorithm from subset to calculate the optimal split attribute, rather than the traditional decision tree from the current node, find out the best in all of the attributes of the attribute. The parameter k is introduced to reflect the randomness of the random forest Algorithm 1.Figure 1
Random forest workflow.Algorithm 1:
(i)
Input: data setT = {(x1, y1), (x2, y2),…, (xm, ym)}, loss function L(ii)
Output: Additive modelf⌢x = fM(x)(1) Initialize the base classifierf0=x=argminγ∑i=1NLyi,γ(2) Each base classifier needs to perform the following operations:① According to the loss function, the negative gradient of each sample in the current model is calculated and used as an estimate of the residualrim=−∂Lyi,fxi/∂,fxi.② For a givenΓim, the leaf node Rmj, Rmj, j = 1,2,..,J, j is the number of leaf nodes③ For leaf nodes, calculatecmj=argminc∑Xi∈RmjLyi,fm−1xi+c.④ Update regression treefmx=fm−1x+∑j=1JcmjIx∈Rmj.(3) Output gradient lifting treef^x=fMx.


## 2.4. Naive Bayes

Naive Bayes algorithm takes Bayes algorithm as the premise and introduces the “independence” hypothesis, whose assumed attributes are independent of each other [18]. Under this assumption of independence, naive Bayes algorithm is especially suitable for solving multiattribute problems. Naive Bayes algorithm is currently recognized as a simple and effective probability classification method, and its classification process is as follows:(1)
Assume that each sample hasn attributes. Each sample is represented by an n-dimensional eigenvector d=d1,d2,d3,…,dn.(2)
Suppose there arem categories c=c1,c2,c3,…,cm. Given an unknown data sample d, the classification predicts that d belongs to the class with the maximum posterior probability, that is, if and only if pc|d>pc|d1≤j≤m and j≠i, The Bayesian classification assigns the sample to be classified to class ci, and the value of pci|d can be calculated by the conditional probability formula in probability theory, as shown in the following formula.(8)Pci|d=Pd|ciPciPd.(3)
Since the sample set is known and the value ofP(d) can be calculated, the maximum value of Pci|d can only be calculated by the maximum value of pd|cipci. Without knowing the prior probabilities of the classes, assume that each class is equally likely, so you just maximize (d|ci). Otherwise, maximize d|cici.(4)
In the case of multiple attributes, the overhead of calculating (d|ci) may be very large. In this case, we can make the naive assumption of class condition independence to reduce the overhead of calculating (d|ci). The classes of a given sample are labeled, assuming that the attributes are independent of each other.(9)Pd|ci=∏j=1aPdj|ci,whered1|ci,d2|ci,…,Pdj|ci can be computed from the sample set.(5)
When classifying classified sampled, calculate d|cici for each class ci in turn. If and only if d|cici>Pd|cjPj,1≤j≤m,j≠i, sample d to be classified is divided into class ci.


## 2.5. BP Neural Network

BP neural network is a multilayer feedforward neural network trained according to error reverse propagation algorithm. The training process of BP neural network is divided into two parts: one is signal forward propagation, and the other is error reverse propagation, as shown in Figure2. Among them, BP neural network has many advantages such as strong nonlinear mapping ability, generalization ability, and fault tolerance ability due to its error back propagation learning process.Figure 2
Multisource data-based student mental health problem recognition algorithm framework.BP neural network consists of three parts: input layer, hidden layer, and output layer. Among them, the number of training sample attributes determines the number of neurons in the input layer, and the number of target classification determines the number of neurons in the output layer. For example, for a binary classification problem, there are only two neurons in the output layer. Users can freely define the number of hidden layers and the number of neurons in each hidden layer. The lines between each layer represent the weights.BP neural network has the following advantages: first, it has strong adaptability and self-learning ability, which can continuously learn and correct path weight and save learning content during training. Second, the nonlinear mapping and fault tolerance ability can better solve the internal mechanism of the more complex nonlinear mapping. However, BP neural network has some defects, such as slow training speed, no corresponding standard for hidden layers, and number of neurons.


## 2.6. Pearson’s Correlation Coefficient

Pearson’s correlation coefficient is used to measure the linear correlation between two variables in most cases. It is defined as the quotient of covariance and standard deviation between two variables, and its calculation is shown in the following formula.(10)ρX,Y=covX,YσX,Y=EXY−EXEYEXZ−E2XEYZ−E2Y,where X and Y represent two random variables, cov (X, Y) represents the covariance between X and Y, σX,Y represents the standard deviation between X and Y, and E represents statistical mathematical expectation.Pearson’s correlation coefficient ranges from −1 to 1. A positive value means a positive correlation between two variables (1 means a complete positive correlation), a negative value means a negative correlation between two variables (−1 means a complete negative correlation), and a 0 value means there is no linear correlation between two variables. When comparing the correlation between feature and target problem, the larger the absolute value of correlation coefficient is, the more relevant the feature is to target problem.


## 3. Student Mental Health Problem Identification Algorithm Based on Multisource Data

The experimental process of identifying students with psychological and emotional problems based on multisource data includes data acquisition and preprocessing, feature extraction, model training, and recognition. In the experiment, students’ consumption data, access control data, network data, historical performance data, and psychological center data were collected.


### 3.1. Algorithm Framework

The overall framework of the student mental health problem recognition algorithm based on multisource data is shown in Figure2. The whole algorithm process is divided into three parts, including data acquisition and preprocessing, feature extraction, and model training and recognition. In the stage of data acquisition and preprocessing, we obtained four data sources, namely, network log, access control data, achievement data, and consumption data. In the feature extraction stage, the relevant features such as students’ online pattern and consumption abnormal score are extracted from the four data sources. The optimal classifier is selected from five common classification algorithms.


#### 3.1.1. Data Acquisition and Preprocessing

After applying to relevant departments and obtaining students’ informed consent, this study obtained a variety of behavioral data of students, including students’ consumption data, historical performance data, network logs, access control and card swiping data, and psychological state data.(1) Consumption Data. There will be a record every time students swipe the campus card. There are three tables of consumption data, namely, consumption flow chart, student account information table, and shop account information table. According to the shop account, connect the shop account information table with the consumption table and the student account information table, and the results are shown in Table 1.Table 1
The three tables join in the consumption data.
Student IDConsumption timeCharge timeTransaction amountShop’s accountShop’s name2021∗∗∗∗202104212021/4/218 : 09 : 59−51050229Noodle section on the first floor of the third restaurant2020∗∗∗∗202104172021/4/1713 : 46 : 11−31574702Service building food street2019∗∗∗∗202104252021/4/2518 : 07 : 22−2.51050253The third restaurant, first floor malatang(2) Access Control Data. At present, college students can enter and leave dormitories only after swiping their card through the access control system using a Metro Card Every time a student swipes the card, an entry-and-exit record will be generated, and these records are stored in the access control information table, as shown in Table 2.Table 2
Access control information table.
Date of credit cardCharge timeStudent IDState of chargeProfessionalLocationDormitory buildingDormitory room no.202104179 : 11 : 272020∗∗∗∗3Mechanical engineering933092021060610 : 52 : 0″2019∗∗∗∗3Transportation process311162021042521 : 55 : 92018∗∗∗∗1Materials and engineering71127The access control information not only reflects the time trajectory of students entering and leaving the dormitory, but also calculates the duration of students in the dormitory according to their entering and leaving states. Students usually go in and out of dormitories with friends, and digging in this direction may also reveal interesting information, such as friend relationships.(3) Students’ Network Log Records. Table 3 shows the network log information. Network logs record students’ online activities, including online time and browsing content. How to dig out the patterns and characteristics of students’ online behavior from these records is a problem we need to solve.Table 3
Network log original table.
Time onlineURLStudent IDULONG source IPSource portULONG destination IPDestination port2021/4/218 : 16 : 54vcheck.f.360cn/checker2020∗∗∗∗172.24.8.11880221.228.204.185345322021/4/217 : 02 : 44rq.wh.cmam.111com/res”2019∗∗∗∗172.20.52.152443203.248.210.232565472021/4/2517 : 32 : 25https://www.imooc.com/wenda2018∗∗∗∗1172.24.8.23880117.121.10141-75362With the approval of the school network center and the informed consent of the students, we obtained the log files of the students’ Internet access. We understand and analyze the network log; the format of the network log looks very simple, but the information it contains is very complex. The URL is divided into seven types, respectively: (1) comprehensive, (2) adult, (3) entertainment, (4) news, (5) publicity, (6) shopping, and (7) learning.(4) Students’ Historical Performance Data. There is a significant negative correlation between mild, moderate, and severe mood disorders and academic performance [19], and students’ historical performance data reflect their past learning status and process. With the approval of the faculty and the informed consent of the student, this table details the students for the first time to attend this exam year students (XN), the first time to attend the exam of semester exam (XQ), students take the exam last time last year (QDXN), students take part in this exam semester (QDXQ), students, student id (XH), course name (KCMC), test scores (KS CJ), credits (XF), GRADE points (JD), grade points (XFJD), and credit acquisition methods (QDFS), including preliminary courses, retakes, and make-up exams, as shown in Table 4. Each record in the student history grade table reflects the student’s learning of a certain course, and the student’s comprehensive learning situation can be understood through the student number.Table 4
Student history score table.
XNXQQDXNQDXQXHKCMCXFKSCJJDXFJDQDFS20190201902019∗∗∗∗Advanced mathematics1Pass11Early repair20200202102020∗∗∗∗C+ language0000Early repair20181201912018∗∗∗∗Linear algebra05400Rebuild20191201912019∗∗∗∗Linear algebra16512Supplementary examinationIn the analysis and understanding of the student history score table, we found that the scoring method of the examination score (KSCJ) is not uniform; some courses use the hundred-mark system, while some use the five-level system [19]. For the convenience of calculation and analysis, we change the five-grade system into a percentage system, and the corresponding relationship is as follows: excellent (95), good (85), medium (75), pass (60), and fail (50).It is found that there are missing values in the grade point column of the student’s history grade table. Since credits are the product of grade points multiplied by course credits, a loss of grade points results in loss of corresponding credits. By observing the existing GPA, find out the calculation rule of GPA, whereCGPAi stands for GPA of the course i, Scorei stands for GPA of the course i, and the corresponding relationship between the calculated GPA and GPA is shown in Table 5. Next, according to the formula to calculate the credit grade point of the problem, CGPAi stands for the first i course credit grade point and Crediti stands for the first i course credits.(11)GPAi=Scorei−5010,CGPAi=Crediti×GPAi.Table 5
Conversion relationship between grade points.
DesignationConversion relationshipResults>908988……6160＜Grade point43.93.8……1.110(5) Psychological State Data. With the approval of the psychological center and the informed consent of the students, the psychological state table of the students was obtained. Each record in the table contains the student’s student ID, gender, department, grade, class, attention level, and update time. The concern level includes mild, moderate, and severe. “Mild” means suffering from mild mental health problems; “moderate” means having moderate mental health problems; and “severe” means having severe mental health problems [11].In this study, we targeted a dichotomous problem, namely, students with mental health problems and normal students. Students whose concern level is light, medium, and heavy in the psychological state table of students were taken as positive samples, and other students who were not reported were taken as normal students.


#### 3.1.2. Feature Extraction

This section mainly describes the process of extracting student behavior characteristics from data sources. The behavior of students on campus is rich and colorful. We divide the behavior characteristics of students into four types: consumption characteristics, access control characteristics, Internet access characteristics, and performance characteristics [9].(1) Consumption Characteristics. Some studies have found that people with mental health problems will have eating disorders, especially depression [19]. Based on this fact, the consumption records of students in the canteen were extracted through the shop names to analyze their eating patterns. Pay special attention to students’ breakfast/lunch/dinner routines. Set breakfast from 6 to 9, lunch from 11 to 13, and dinner from 17 to 19 : 30. Since there are often multiple records for each meal, use the time of the first swipe as the meal time. For example, if there are three records in a breakfast, the time of occurrence is 7 : 20, 7 : 21, and 7 : 22, use 7 : 20 as the breakfast time. The regularity of a behavior can be considered repeatable and will be measured by entropy of the probability that the behavior occurs at a particular time interval. Assuming that there are n time intervals T=t1,t2,t3,…,tn, for any given student, the probability pvT=ti of behavior v∈V  = {breakfast, lunch, dinner} occurring within time interval ti is calculated according to formula (12), where nvti represents the frequency of behavior v occurring within time interval ti. Then, calculate the entropy, which is calculated by formula (13). Assume that for the three behaviors of morning/afternoon/dinner, each time interval span is half an hour.(12)PvT=ti=nvti∑i=1nnvti,(13)Ev=−∑i=1nPvT=tilogPvT=ti.The b_entropy, l_entropy, and d_entropy values for breakfast/lunch/dinner can be calculated from formulas 12 and 13. Meanwhile, according to formula (12), the smaller the entropy value of a behavior is, the more concentrated its probability distribution is over time, and the higher its regularity is. If one student only goes to the canteen occasionally during a concentrated period of time, while the other student goes to the canteen frequently, although the regularity of the two students’ dining in the canteen is not the same, they will also have similar entropy values. In order to better distinguish the two types of students, the number of breakfasts/luncheons/dinners for each student was calculated separately. k-means clustering algorithm is used to cluster entropy and meal times. It is considered that students have three common dining behaviors: less frequent dining, poor dining regularity, and good dining regularity. Therefore, the number of clustering k is set as 3. The clustering results are shown in Figure 3.Figure 3
Clustering results based on entropy and frequency of breakfast, lunch, dinner.The goal was to find students with abnormal eating habits. It is assumed that the smaller the cluster a student is in, and the further away from the center of the cluster, the higher the abnormal score (20) according to the formula to calculate the abnormal scores for students, which is ci student of n in the cluster centroid of Ci, said all the students, | ci | clustering Ci number of students, | C | represents all the students, students n the distance to the center of mass of n,cici said. In this experiment, Euclidean distance is used to calculate the distance.(14)AS=Dn,ci∗1−CiC.(2) Characteristics of Access Control. It is found that the more difficult the interpersonal communication is, the worse the mental health level is, and the stronger the interpersonal communication ability is, the better the mental health level is [5]. The dormitories of undergraduate students in colleges and universities are usually divided according to classes, and students in the same dormitory generally have the same entry and exit schedule. The interpersonal relationship of students in the dormitory can be reflected by calculating the times of students and roommates entering and leaving the dormitory together, which is called card swiping in front and back foot. The rule is as follows: if two students are roommates, the difference in credit card time is less than 20 seconds, and both students enter or leave the dormitory at the same time. Further analysis of the card swiping data from front and back showed that some students’ values were less than 10 or even 0.(3) Characteristics of Internet Access The overall framework of the one-dimensional convolutional neural network designed in this study consists of five neural network layers. In the training of the model, the input of each student is a network sequence, that is, a one-dimensional vector. Since the length of the network sequence is inconsistent, 0 is used to fill it. The operation of the convolution layer is shown in formula (15), where xji is the feature graph of the j convolution operator of the l layer, xil−1 represents the input, kijl represents the j convolution kernel of the l layer, bjl represents the bias of the j convolution operator, f(·) represents the activation function, and ∗ represents the multiplication operation.(15)xjl=f∑i∈Mjxil−1∗kijl+bjl.The second and fourth neural network layers adopt the pooling layer, and the pooling mode is divided into average pooling and maximum pooling. In this study, the pooling mode is maximum pooling. The operation of the pooling layer is shown in formula (16), where xji, wji, bji, downxji represents the input, weight matrix, bias, and downsampling function, respectively.(16)x^jl=fwjldownxil+bjl.The fifth layer uses a full connection layer, and the operation of the full connection layer is shown as follows:(17)spat=fw5∗x4+b5.For parameter setting, the number of convolution kernels of the two convolution layers is 16 and 32, respectively. ReLU was used as the activation function and Adam as the optimization algorithm. Additionally, to prevent overfitting, we use three dropout layers with parameters 0.15, 0.15, and 0.5. In the model training stage, 70 positive samples and 70 negative samples were used to train the model. In the feature extraction stage, all the experimental samples were input into the trained 1D-CNN model, and finally the results of the full connection layerspat were output as the online mode.(4) Performance Characteristics. (1) Grade point average students’ mental health problems are often caused by external factors, and grade pressure is one of the external factors, so it is necessary to extract grade-related characteristics to reflect students’ performance. GPA plays a decisive role in the school’s evaluation and award, and the calculation formula is as follows:(18)GPAavg=∑i=1nCGPAi∑i−1nSorei.(2) Failing credits for college students: failing credits are the best characteristic of performance pressure. Failing credits are counted by traversing a student’s history score sheet and counting the corresponding credits as failing credits if the QDFS value is a make-up exam. Two characteristics, GPA and failing credits, are extracted from historical achievement data. Finally, a total of 69 features were extracted from consumption data, access control data, and network logs and historical performance data.


#### 3.1.3. Model Training and Recognition

The research objective of this paper is a binary classification problem. Five common classification algorithms are selected as candidate algorithms, including random forest (RT), gradient ascending tree (GBDT), Naive Bayes (NB), neural network (NN), and decision tree (DT). We hope to select a classification algorithm with the best performance as the classifier of the algorithm.The data set is divided into training set, verification set, and test set, and each classification algorithm is trained with the training set, and then each classification algorithm is evaluated with the verification set. Obfuscation matrix is an index to evaluate model performance, which is mainly used to judge the performance of classifier. The confusion matrix has four basic elements, which are True Positive (TP), False Negative (FN), False Positive (FP), and True Negative (TN). The meanings of these four elements will be introduced in detail below.However, the obfuscation matrix is only a statistical quantity. When the sample number is very large, it is difficult to evaluate the performance of the model only by calculating the quantity. Therefore, the confusion matrix extends some evaluation indexes based on the statistical quantity. In educational data research, there are five commonly used evaluation indicators, including accuracy, precision, recall,F1-measure, and AUC (area under curve) [19]. In this experiment, precision, recall, and F1-measure were selected as evaluation indexes.Precision refers to the proportion of students who are truly positive samples among the students who are predicted to be positive samples, and its calculation formula is shown as follows:(19)Precision=TPTP+FP.Recall refers to the proportion of students who are predicted to be positive samples among students who are real and positive samples, and its calculation formula is shown as follows:(20)Recall=TPTP+FN.Precision and recall are two important indicators. However, when evaluating the performance of several models, precision of one model is often higher than that of other models, but recall is lower than that of other models. Therefore, the optimal model cannot be selected. A comprehensive indexF-measure was introduced, and precision and recall were weighted and averaged. The calculation formula is shown as (21). The larger the F-measure is, the better the model performance is. When α is equal to 1, it is commonly used F1-measure, and F1-measure is used in this study.(21)F−Measure=α2+1Precision∗Recallα2∗Precision+Recall.The training process of the model is the process of parameter selection; how to choose the optimal parameter is a key problem. In this algorithm, the way of permutation and combination is used to select the optimal parameter combination. For each classification algorithm, we adjust only a few important parameters and use the default values for the rest parameters. After trying different parameter combinations, the optimal parameter combinations of each candidate classification algorithm are selected.


## 3.1. Algorithm Framework

The overall framework of the student mental health problem recognition algorithm based on multisource data is shown in Figure2. The whole algorithm process is divided into three parts, including data acquisition and preprocessing, feature extraction, and model training and recognition. In the stage of data acquisition and preprocessing, we obtained four data sources, namely, network log, access control data, achievement data, and consumption data. In the feature extraction stage, the relevant features such as students’ online pattern and consumption abnormal score are extracted from the four data sources. The optimal classifier is selected from five common classification algorithms.


### 3.1.1. Data Acquisition and Preprocessing

After applying to relevant departments and obtaining students’ informed consent, this study obtained a variety of behavioral data of students, including students’ consumption data, historical performance data, network logs, access control and card swiping data, and psychological state data.(1) Consumption Data. There will be a record every time students swipe the campus card. There are three tables of consumption data, namely, consumption flow chart, student account information table, and shop account information table. According to the shop account, connect the shop account information table with the consumption table and the student account information table, and the results are shown in Table 1.Table 1
The three tables join in the consumption data.
Student IDConsumption timeCharge timeTransaction amountShop’s accountShop’s name2021∗∗∗∗202104212021/4/218 : 09 : 59−51050229Noodle section on the first floor of the third restaurant2020∗∗∗∗202104172021/4/1713 : 46 : 11−31574702Service building food street2019∗∗∗∗202104252021/4/2518 : 07 : 22−2.51050253The third restaurant, first floor malatang(2) Access Control Data. At present, college students can enter and leave dormitories only after swiping their card through the access control system using a Metro Card Every time a student swipes the card, an entry-and-exit record will be generated, and these records are stored in the access control information table, as shown in Table 2.Table 2
Access control information table.
Date of credit cardCharge timeStudent IDState of chargeProfessionalLocationDormitory buildingDormitory room no.202104179 : 11 : 272020∗∗∗∗3Mechanical engineering933092021060610 : 52 : 0″2019∗∗∗∗3Transportation process311162021042521 : 55 : 92018∗∗∗∗1Materials and engineering71127The access control information not only reflects the time trajectory of students entering and leaving the dormitory, but also calculates the duration of students in the dormitory according to their entering and leaving states. Students usually go in and out of dormitories with friends, and digging in this direction may also reveal interesting information, such as friend relationships.(3) Students’ Network Log Records. Table 3 shows the network log information. Network logs record students’ online activities, including online time and browsing content. How to dig out the patterns and characteristics of students’ online behavior from these records is a problem we need to solve.Table 3
Network log original table.
Time onlineURLStudent IDULONG source IPSource portULONG destination IPDestination port2021/4/218 : 16 : 54vcheck.f.360cn/checker2020∗∗∗∗172.24.8.11880221.228.204.185345322021/4/217 : 02 : 44rq.wh.cmam.111com/res”2019∗∗∗∗172.20.52.152443203.248.210.232565472021/4/2517 : 32 : 25https://www.imooc.com/wenda2018∗∗∗∗1172.24.8.23880117.121.10141-75362With the approval of the school network center and the informed consent of the students, we obtained the log files of the students’ Internet access. We understand and analyze the network log; the format of the network log looks very simple, but the information it contains is very complex. The URL is divided into seven types, respectively: (1) comprehensive, (2) adult, (3) entertainment, (4) news, (5) publicity, (6) shopping, and (7) learning.(4) Students’ Historical Performance Data. There is a significant negative correlation between mild, moderate, and severe mood disorders and academic performance [19], and students’ historical performance data reflect their past learning status and process. With the approval of the faculty and the informed consent of the student, this table details the students for the first time to attend this exam year students (XN), the first time to attend the exam of semester exam (XQ), students take the exam last time last year (QDXN), students take part in this exam semester (QDXQ), students, student id (XH), course name (KCMC), test scores (KS CJ), credits (XF), GRADE points (JD), grade points (XFJD), and credit acquisition methods (QDFS), including preliminary courses, retakes, and make-up exams, as shown in Table 4. Each record in the student history grade table reflects the student’s learning of a certain course, and the student’s comprehensive learning situation can be understood through the student number.Table 4
Student history score table.
XNXQQDXNQDXQXHKCMCXFKSCJJDXFJDQDFS20190201902019∗∗∗∗Advanced mathematics1Pass11Early repair20200202102020∗∗∗∗C+ language0000Early repair20181201912018∗∗∗∗Linear algebra05400Rebuild20191201912019∗∗∗∗Linear algebra16512Supplementary examinationIn the analysis and understanding of the student history score table, we found that the scoring method of the examination score (KSCJ) is not uniform; some courses use the hundred-mark system, while some use the five-level system [19]. For the convenience of calculation and analysis, we change the five-grade system into a percentage system, and the corresponding relationship is as follows: excellent (95), good (85), medium (75), pass (60), and fail (50).It is found that there are missing values in the grade point column of the student’s history grade table. Since credits are the product of grade points multiplied by course credits, a loss of grade points results in loss of corresponding credits. By observing the existing GPA, find out the calculation rule of GPA, whereCGPAi stands for GPA of the course i, Scorei stands for GPA of the course i, and the corresponding relationship between the calculated GPA and GPA is shown in Table 5. Next, according to the formula to calculate the credit grade point of the problem, CGPAi stands for the first i course credit grade point and Crediti stands for the first i course credits.(11)GPAi=Scorei−5010,CGPAi=Crediti×GPAi.Table 5
Conversion relationship between grade points.
DesignationConversion relationshipResults>908988……6160＜Grade point43.93.8……1.110(5) Psychological State Data. With the approval of the psychological center and the informed consent of the students, the psychological state table of the students was obtained. Each record in the table contains the student’s student ID, gender, department, grade, class, attention level, and update time. The concern level includes mild, moderate, and severe. “Mild” means suffering from mild mental health problems; “moderate” means having moderate mental health problems; and “severe” means having severe mental health problems [11].In this study, we targeted a dichotomous problem, namely, students with mental health problems and normal students. Students whose concern level is light, medium, and heavy in the psychological state table of students were taken as positive samples, and other students who were not reported were taken as normal students.


### 3.1.2. Feature Extraction

This section mainly describes the process of extracting student behavior characteristics from data sources. The behavior of students on campus is rich and colorful. We divide the behavior characteristics of students into four types: consumption characteristics, access control characteristics, Internet access characteristics, and performance characteristics [9].(1) Consumption Characteristics. Some studies have found that people with mental health problems will have eating disorders, especially depression [19]. Based on this fact, the consumption records of students in the canteen were extracted through the shop names to analyze their eating patterns. Pay special attention to students’ breakfast/lunch/dinner routines. Set breakfast from 6 to 9, lunch from 11 to 13, and dinner from 17 to 19 : 30. Since there are often multiple records for each meal, use the time of the first swipe as the meal time. For example, if there are three records in a breakfast, the time of occurrence is 7 : 20, 7 : 21, and 7 : 22, use 7 : 20 as the breakfast time. The regularity of a behavior can be considered repeatable and will be measured by entropy of the probability that the behavior occurs at a particular time interval. Assuming that there are n time intervals T=t1,t2,t3,…,tn, for any given student, the probability pvT=ti of behavior v∈V  = {breakfast, lunch, dinner} occurring within time interval ti is calculated according to formula (12), where nvti represents the frequency of behavior v occurring within time interval ti. Then, calculate the entropy, which is calculated by formula (13). Assume that for the three behaviors of morning/afternoon/dinner, each time interval span is half an hour.(12)PvT=ti=nvti∑i=1nnvti,(13)Ev=−∑i=1nPvT=tilogPvT=ti.The b_entropy, l_entropy, and d_entropy values for breakfast/lunch/dinner can be calculated from formulas 12 and 13. Meanwhile, according to formula (12), the smaller the entropy value of a behavior is, the more concentrated its probability distribution is over time, and the higher its regularity is. If one student only goes to the canteen occasionally during a concentrated period of time, while the other student goes to the canteen frequently, although the regularity of the two students’ dining in the canteen is not the same, they will also have similar entropy values. In order to better distinguish the two types of students, the number of breakfasts/luncheons/dinners for each student was calculated separately. k-means clustering algorithm is used to cluster entropy and meal times. It is considered that students have three common dining behaviors: less frequent dining, poor dining regularity, and good dining regularity. Therefore, the number of clustering k is set as 3. The clustering results are shown in Figure 3.Figure 3
Clustering results based on entropy and frequency of breakfast, lunch, dinner.The goal was to find students with abnormal eating habits. It is assumed that the smaller the cluster a student is in, and the further away from the center of the cluster, the higher the abnormal score (20) according to the formula to calculate the abnormal scores for students, which is ci student of n in the cluster centroid of Ci, said all the students, | ci | clustering Ci number of students, | C | represents all the students, students n the distance to the center of mass of n,cici said. In this experiment, Euclidean distance is used to calculate the distance.(14)AS=Dn,ci∗1−CiC.(2) Characteristics of Access Control. It is found that the more difficult the interpersonal communication is, the worse the mental health level is, and the stronger the interpersonal communication ability is, the better the mental health level is [5]. The dormitories of undergraduate students in colleges and universities are usually divided according to classes, and students in the same dormitory generally have the same entry and exit schedule. The interpersonal relationship of students in the dormitory can be reflected by calculating the times of students and roommates entering and leaving the dormitory together, which is called card swiping in front and back foot. The rule is as follows: if two students are roommates, the difference in credit card time is less than 20 seconds, and both students enter or leave the dormitory at the same time. Further analysis of the card swiping data from front and back showed that some students’ values were less than 10 or even 0.(3) Characteristics of Internet Access The overall framework of the one-dimensional convolutional neural network designed in this study consists of five neural network layers. In the training of the model, the input of each student is a network sequence, that is, a one-dimensional vector. Since the length of the network sequence is inconsistent, 0 is used to fill it. The operation of the convolution layer is shown in formula (15), where xji is the feature graph of the j convolution operator of the l layer, xil−1 represents the input, kijl represents the j convolution kernel of the l layer, bjl represents the bias of the j convolution operator, f(·) represents the activation function, and ∗ represents the multiplication operation.(15)xjl=f∑i∈Mjxil−1∗kijl+bjl.The second and fourth neural network layers adopt the pooling layer, and the pooling mode is divided into average pooling and maximum pooling. In this study, the pooling mode is maximum pooling. The operation of the pooling layer is shown in formula (16), where xji, wji, bji, downxji represents the input, weight matrix, bias, and downsampling function, respectively.(16)x^jl=fwjldownxil+bjl.The fifth layer uses a full connection layer, and the operation of the full connection layer is shown as follows:(17)spat=fw5∗x4+b5.For parameter setting, the number of convolution kernels of the two convolution layers is 16 and 32, respectively. ReLU was used as the activation function and Adam as the optimization algorithm. Additionally, to prevent overfitting, we use three dropout layers with parameters 0.15, 0.15, and 0.5. In the model training stage, 70 positive samples and 70 negative samples were used to train the model. In the feature extraction stage, all the experimental samples were input into the trained 1D-CNN model, and finally the results of the full connection layerspat were output as the online mode.(4) Performance Characteristics. (1) Grade point average students’ mental health problems are often caused by external factors, and grade pressure is one of the external factors, so it is necessary to extract grade-related characteristics to reflect students’ performance. GPA plays a decisive role in the school’s evaluation and award, and the calculation formula is as follows:(18)GPAavg=∑i=1nCGPAi∑i−1nSorei.(2) Failing credits for college students: failing credits are the best characteristic of performance pressure. Failing credits are counted by traversing a student’s history score sheet and counting the corresponding credits as failing credits if the QDFS value is a make-up exam. Two characteristics, GPA and failing credits, are extracted from historical achievement data. Finally, a total of 69 features were extracted from consumption data, access control data, and network logs and historical performance data.


### 3.1.3. Model Training and Recognition

The research objective of this paper is a binary classification problem. Five common classification algorithms are selected as candidate algorithms, including random forest (RT), gradient ascending tree (GBDT), Naive Bayes (NB), neural network (NN), and decision tree (DT). We hope to select a classification algorithm with the best performance as the classifier of the algorithm.The data set is divided into training set, verification set, and test set, and each classification algorithm is trained with the training set, and then each classification algorithm is evaluated with the verification set. Obfuscation matrix is an index to evaluate model performance, which is mainly used to judge the performance of classifier. The confusion matrix has four basic elements, which are True Positive (TP), False Negative (FN), False Positive (FP), and True Negative (TN). The meanings of these four elements will be introduced in detail below.However, the obfuscation matrix is only a statistical quantity. When the sample number is very large, it is difficult to evaluate the performance of the model only by calculating the quantity. Therefore, the confusion matrix extends some evaluation indexes based on the statistical quantity. In educational data research, there are five commonly used evaluation indicators, including accuracy, precision, recall,F1-measure, and AUC (area under curve) [19]. In this experiment, precision, recall, and F1-measure were selected as evaluation indexes.Precision refers to the proportion of students who are truly positive samples among the students who are predicted to be positive samples, and its calculation formula is shown as follows:(19)Precision=TPTP+FP.Recall refers to the proportion of students who are predicted to be positive samples among students who are real and positive samples, and its calculation formula is shown as follows:(20)Recall=TPTP+FN.Precision and recall are two important indicators. However, when evaluating the performance of several models, precision of one model is often higher than that of other models, but recall is lower than that of other models. Therefore, the optimal model cannot be selected. A comprehensive indexF-measure was introduced, and precision and recall were weighted and averaged. The calculation formula is shown as (21). The larger the F-measure is, the better the model performance is. When α is equal to 1, it is commonly used F1-measure, and F1-measure is used in this study.(21)F−Measure=α2+1Precision∗Recallα2∗Precision+Recall.The training process of the model is the process of parameter selection; how to choose the optimal parameter is a key problem. In this algorithm, the way of permutation and combination is used to select the optimal parameter combination. For each classification algorithm, we adjust only a few important parameters and use the default values for the rest parameters. After trying different parameter combinations, the optimal parameter combinations of each candidate classification algorithm are selected.


## 3.1.1. Data Acquisition and Preprocessing

After applying to relevant departments and obtaining students’ informed consent, this study obtained a variety of behavioral data of students, including students’ consumption data, historical performance data, network logs, access control and card swiping data, and psychological state data.(1) Consumption Data. There will be a record every time students swipe the campus card. There are three tables of consumption data, namely, consumption flow chart, student account information table, and shop account information table. According to the shop account, connect the shop account information table with the consumption table and the student account information table, and the results are shown in Table 1.Table 1
The three tables join in the consumption data.
Student IDConsumption timeCharge timeTransaction amountShop’s accountShop’s name2021∗∗∗∗202104212021/4/218 : 09 : 59−51050229Noodle section on the first floor of the third restaurant2020∗∗∗∗202104172021/4/1713 : 46 : 11−31574702Service building food street2019∗∗∗∗202104252021/4/2518 : 07 : 22−2.51050253The third restaurant, first floor malatang(2) Access Control Data. At present, college students can enter and leave dormitories only after swiping their card through the access control system using a Metro Card Every time a student swipes the card, an entry-and-exit record will be generated, and these records are stored in the access control information table, as shown in Table 2.Table 2
Access control information table.
Date of credit cardCharge timeStudent IDState of chargeProfessionalLocationDormitory buildingDormitory room no.202104179 : 11 : 272020∗∗∗∗3Mechanical engineering933092021060610 : 52 : 0″2019∗∗∗∗3Transportation process311162021042521 : 55 : 92018∗∗∗∗1Materials and engineering71127The access control information not only reflects the time trajectory of students entering and leaving the dormitory, but also calculates the duration of students in the dormitory according to their entering and leaving states. Students usually go in and out of dormitories with friends, and digging in this direction may also reveal interesting information, such as friend relationships.(3) Students’ Network Log Records. Table 3 shows the network log information. Network logs record students’ online activities, including online time and browsing content. How to dig out the patterns and characteristics of students’ online behavior from these records is a problem we need to solve.Table 3
Network log original table.
Time onlineURLStudent IDULONG source IPSource portULONG destination IPDestination port2021/4/218 : 16 : 54vcheck.f.360cn/checker2020∗∗∗∗172.24.8.11880221.228.204.185345322021/4/217 : 02 : 44rq.wh.cmam.111com/res”2019∗∗∗∗172.20.52.152443203.248.210.232565472021/4/2517 : 32 : 25https://www.imooc.com/wenda2018∗∗∗∗1172.24.8.23880117.121.10141-75362With the approval of the school network center and the informed consent of the students, we obtained the log files of the students’ Internet access. We understand and analyze the network log; the format of the network log looks very simple, but the information it contains is very complex. The URL is divided into seven types, respectively: (1) comprehensive, (2) adult, (3) entertainment, (4) news, (5) publicity, (6) shopping, and (7) learning.(4) Students’ Historical Performance Data. There is a significant negative correlation between mild, moderate, and severe mood disorders and academic performance [19], and students’ historical performance data reflect their past learning status and process. With the approval of the faculty and the informed consent of the student, this table details the students for the first time to attend this exam year students (XN), the first time to attend the exam of semester exam (XQ), students take the exam last time last year (QDXN), students take part in this exam semester (QDXQ), students, student id (XH), course name (KCMC), test scores (KS CJ), credits (XF), GRADE points (JD), grade points (XFJD), and credit acquisition methods (QDFS), including preliminary courses, retakes, and make-up exams, as shown in Table 4. Each record in the student history grade table reflects the student’s learning of a certain course, and the student’s comprehensive learning situation can be understood through the student number.Table 4
Student history score table.
XNXQQDXNQDXQXHKCMCXFKSCJJDXFJDQDFS20190201902019∗∗∗∗Advanced mathematics1Pass11Early repair20200202102020∗∗∗∗C+ language0000Early repair20181201912018∗∗∗∗Linear algebra05400Rebuild20191201912019∗∗∗∗Linear algebra16512Supplementary examinationIn the analysis and understanding of the student history score table, we found that the scoring method of the examination score (KSCJ) is not uniform; some courses use the hundred-mark system, while some use the five-level system [19]. For the convenience of calculation and analysis, we change the five-grade system into a percentage system, and the corresponding relationship is as follows: excellent (95), good (85), medium (75), pass (60), and fail (50).It is found that there are missing values in the grade point column of the student’s history grade table. Since credits are the product of grade points multiplied by course credits, a loss of grade points results in loss of corresponding credits. By observing the existing GPA, find out the calculation rule of GPA, whereCGPAi stands for GPA of the course i, Scorei stands for GPA of the course i, and the corresponding relationship between the calculated GPA and GPA is shown in Table 5. Next, according to the formula to calculate the credit grade point of the problem, CGPAi stands for the first i course credit grade point and Crediti stands for the first i course credits.(11)GPAi=Scorei−5010,CGPAi=Crediti×GPAi.Table 5
Conversion relationship between grade points.
DesignationConversion relationshipResults>908988……6160＜Grade point43.93.8……1.110(5) Psychological State Data. With the approval of the psychological center and the informed consent of the students, the psychological state table of the students was obtained. Each record in the table contains the student’s student ID, gender, department, grade, class, attention level, and update time. The concern level includes mild, moderate, and severe. “Mild” means suffering from mild mental health problems; “moderate” means having moderate mental health problems; and “severe” means having severe mental health problems [11].In this study, we targeted a dichotomous problem, namely, students with mental health problems and normal students. Students whose concern level is light, medium, and heavy in the psychological state table of students were taken as positive samples, and other students who were not reported were taken as normal students.


## 3.1.2. Feature Extraction

This section mainly describes the process of extracting student behavior characteristics from data sources. The behavior of students on campus is rich and colorful. We divide the behavior characteristics of students into four types: consumption characteristics, access control characteristics, Internet access characteristics, and performance characteristics [9].(1) Consumption Characteristics. Some studies have found that people with mental health problems will have eating disorders, especially depression [19]. Based on this fact, the consumption records of students in the canteen were extracted through the shop names to analyze their eating patterns. Pay special attention to students’ breakfast/lunch/dinner routines. Set breakfast from 6 to 9, lunch from 11 to 13, and dinner from 17 to 19 : 30. Since there are often multiple records for each meal, use the time of the first swipe as the meal time. For example, if there are three records in a breakfast, the time of occurrence is 7 : 20, 7 : 21, and 7 : 22, use 7 : 20 as the breakfast time. The regularity of a behavior can be considered repeatable and will be measured by entropy of the probability that the behavior occurs at a particular time interval. Assuming that there are n time intervals T=t1,t2,t3,…,tn, for any given student, the probability pvT=ti of behavior v∈V  = {breakfast, lunch, dinner} occurring within time interval ti is calculated according to formula (12), where nvti represents the frequency of behavior v occurring within time interval ti. Then, calculate the entropy, which is calculated by formula (13). Assume that for the three behaviors of morning/afternoon/dinner, each time interval span is half an hour.(12)PvT=ti=nvti∑i=1nnvti,(13)Ev=−∑i=1nPvT=tilogPvT=ti.The b_entropy, l_entropy, and d_entropy values for breakfast/lunch/dinner can be calculated from formulas 12 and 13. Meanwhile, according to formula (12), the smaller the entropy value of a behavior is, the more concentrated its probability distribution is over time, and the higher its regularity is. If one student only goes to the canteen occasionally during a concentrated period of time, while the other student goes to the canteen frequently, although the regularity of the two students’ dining in the canteen is not the same, they will also have similar entropy values. In order to better distinguish the two types of students, the number of breakfasts/luncheons/dinners for each student was calculated separately. k-means clustering algorithm is used to cluster entropy and meal times. It is considered that students have three common dining behaviors: less frequent dining, poor dining regularity, and good dining regularity. Therefore, the number of clustering k is set as 3. The clustering results are shown in Figure 3.Figure 3
Clustering results based on entropy and frequency of breakfast, lunch, dinner.The goal was to find students with abnormal eating habits. It is assumed that the smaller the cluster a student is in, and the further away from the center of the cluster, the higher the abnormal score (20) according to the formula to calculate the abnormal scores for students, which is ci student of n in the cluster centroid of Ci, said all the students, | ci | clustering Ci number of students, | C | represents all the students, students n the distance to the center of mass of n,cici said. In this experiment, Euclidean distance is used to calculate the distance.(14)AS=Dn,ci∗1−CiC.(2) Characteristics of Access Control. It is found that the more difficult the interpersonal communication is, the worse the mental health level is, and the stronger the interpersonal communication ability is, the better the mental health level is [5]. The dormitories of undergraduate students in colleges and universities are usually divided according to classes, and students in the same dormitory generally have the same entry and exit schedule. The interpersonal relationship of students in the dormitory can be reflected by calculating the times of students and roommates entering and leaving the dormitory together, which is called card swiping in front and back foot. The rule is as follows: if two students are roommates, the difference in credit card time is less than 20 seconds, and both students enter or leave the dormitory at the same time. Further analysis of the card swiping data from front and back showed that some students’ values were less than 10 or even 0.(3) Characteristics of Internet Access The overall framework of the one-dimensional convolutional neural network designed in this study consists of five neural network layers. In the training of the model, the input of each student is a network sequence, that is, a one-dimensional vector. Since the length of the network sequence is inconsistent, 0 is used to fill it. The operation of the convolution layer is shown in formula (15), where xji is the feature graph of the j convolution operator of the l layer, xil−1 represents the input, kijl represents the j convolution kernel of the l layer, bjl represents the bias of the j convolution operator, f(·) represents the activation function, and ∗ represents the multiplication operation.(15)xjl=f∑i∈Mjxil−1∗kijl+bjl.The second and fourth neural network layers adopt the pooling layer, and the pooling mode is divided into average pooling and maximum pooling. In this study, the pooling mode is maximum pooling. The operation of the pooling layer is shown in formula (16), where xji, wji, bji, downxji represents the input, weight matrix, bias, and downsampling function, respectively.(16)x^jl=fwjldownxil+bjl.The fifth layer uses a full connection layer, and the operation of the full connection layer is shown as follows:(17)spat=fw5∗x4+b5.For parameter setting, the number of convolution kernels of the two convolution layers is 16 and 32, respectively. ReLU was used as the activation function and Adam as the optimization algorithm. Additionally, to prevent overfitting, we use three dropout layers with parameters 0.15, 0.15, and 0.5. In the model training stage, 70 positive samples and 70 negative samples were used to train the model. In the feature extraction stage, all the experimental samples were input into the trained 1D-CNN model, and finally the results of the full connection layerspat were output as the online mode.(4) Performance Characteristics. (1) Grade point average students’ mental health problems are often caused by external factors, and grade pressure is one of the external factors, so it is necessary to extract grade-related characteristics to reflect students’ performance. GPA plays a decisive role in the school’s evaluation and award, and the calculation formula is as follows:(18)GPAavg=∑i=1nCGPAi∑i−1nSorei.(2) Failing credits for college students: failing credits are the best characteristic of performance pressure. Failing credits are counted by traversing a student’s history score sheet and counting the corresponding credits as failing credits if the QDFS value is a make-up exam. Two characteristics, GPA and failing credits, are extracted from historical achievement data. Finally, a total of 69 features were extracted from consumption data, access control data, and network logs and historical performance data.


## 3.1.3. Model Training and Recognition

The research objective of this paper is a binary classification problem. Five common classification algorithms are selected as candidate algorithms, including random forest (RT), gradient ascending tree (GBDT), Naive Bayes (NB), neural network (NN), and decision tree (DT). We hope to select a classification algorithm with the best performance as the classifier of the algorithm.The data set is divided into training set, verification set, and test set, and each classification algorithm is trained with the training set, and then each classification algorithm is evaluated with the verification set. Obfuscation matrix is an index to evaluate model performance, which is mainly used to judge the performance of classifier. The confusion matrix has four basic elements, which are True Positive (TP), False Negative (FN), False Positive (FP), and True Negative (TN). The meanings of these four elements will be introduced in detail below.However, the obfuscation matrix is only a statistical quantity. When the sample number is very large, it is difficult to evaluate the performance of the model only by calculating the quantity. Therefore, the confusion matrix extends some evaluation indexes based on the statistical quantity. In educational data research, there are five commonly used evaluation indicators, including accuracy, precision, recall,F1-measure, and AUC (area under curve) [19]. In this experiment, precision, recall, and F1-measure were selected as evaluation indexes.Precision refers to the proportion of students who are truly positive samples among the students who are predicted to be positive samples, and its calculation formula is shown as follows:(19)Precision=TPTP+FP.Recall refers to the proportion of students who are predicted to be positive samples among students who are real and positive samples, and its calculation formula is shown as follows:(20)Recall=TPTP+FN.Precision and recall are two important indicators. However, when evaluating the performance of several models, precision of one model is often higher than that of other models, but recall is lower than that of other models. Therefore, the optimal model cannot be selected. A comprehensive indexF-measure was introduced, and precision and recall were weighted and averaged. The calculation formula is shown as (21). The larger the F-measure is, the better the model performance is. When α is equal to 1, it is commonly used F1-measure, and F1-measure is used in this study.(21)F−Measure=α2+1Precision∗Recallα2∗Precision+Recall.The training process of the model is the process of parameter selection; how to choose the optimal parameter is a key problem. In this algorithm, the way of permutation and combination is used to select the optimal parameter combination. For each classification algorithm, we adjust only a few important parameters and use the default values for the rest parameters. After trying different parameter combinations, the optimal parameter combinations of each candidate classification algorithm are selected.


## 4. Experiment and Result Analysis

### 4.1. Experimental Data

Among the 280 undergraduates who participated in the survey, 70 students were assessed as students with mental health problems by experts at the university’s psychological center in May and June 2019. Their mental health levels were classified as mild, moderate, or severe. In addition, 210 undergraduates were randomly selected from the entire school. Finally, the proportion of students at each mental state level is shown in Figure4.Figure 4
Proportion of each mental state in the data set.Students were divided into two groups, with a positive sample for mild, moderate, and severe cases, and a negative sample for students without mental health problems. The label has high credibility and avoids the drawbacks of concealing facts in questionnaires. In order to protect students’ privacy, the student id was encrypted throughout the experiment. As the psychological state is a short-term state, generally lasting from half a month to one month, only the consumption data access control data and network logs in April 2021 are used.


### 4.2. Training Set and Test Set

The essence of deep learning is the process of model selection. However, only parameters of the model are unknown. By using various tuning methods, an optimal value can be obtained, which enables the model to map independent variables to dependent variables well. In practice, it is not always easy to sample data evenly. So, the actual process is random. In this experiment, the data set sample is 280 students, among which 70 students are positive samples and 210 students are negative samples; that is to say, the ratio of positive samples to negative samples is 1 : 3. In order to make the sample ratio of the training set and the test set 1 : 3, 49 and 147 students were randomly selected from the positive and negative samples of the data set, respectively, as the training set, and 25% of the data were used as the verification set, and the positive and negative sample ratio was 1 : 3. Meanwhile, the ratio of positive and negative samples in the test set was 1 : 3.


### 4.3. Comparison and Analysis of Experimental Results

The extracted features are input into the classification algorithm for model training and prediction. Five common machine learning classification algorithms, including random forest (RT), gradient ascending tree (GBDT), Naive Bayes (NB), neural network (NN), and decision tree (DT), are compared. The experimental results are shown in Table6.Table 6
Results of five classification algorithms to identify students with psychological problems.
Sorting algorithmsPrecisionRecallF1-measureRT0.680.530.65GBDT0.650.520.62NB0.620.500.60NN0.650.500.63DT0.680.580.69First of all, it can be obviously observed that in all models, precision is higher than recall, and recall is only 0.58 at its highest, indicating that few samples can be correctly identified. Secondly, decision tree has the best comprehensive performance, especially recall. Therefore, we choose decision tree as the classifier of mental health recognition algorithm based on multisource data.To verify the generalization ability of the algorithm, we input the test data set into our algorithm and obtain the following experimental results: precision 0.68, recall 0.56, andF1-measure 0.67. Based on the test set experiment results, our algorithm was able to identify 56 percent of students with mental health problems. Table 7 lists 20 characteristics with high Pearson’s correlations.Table 7
The top 20 most relevant features.
Characteristics of the categoryCharacteristicSignalmentCoefficient of associationEntrance guardGetup std 1Standard deviation of Monday morning0.2627Entrance guardReststayroomTime spent in the dormitory on days off-0.2290Entrance guardSwipe_numCredit card number−0.2159Entrance guardgetup_mean6Saturday morning average0.2014Entrance guardlast_count5Number of Friday nights0.1990Entrance guardgetup_mean1Monday morning average0.1915Entrance guardgetup_count7Number of early Sundays0.1830Entrance guardgetup_mean4Thursday morning average0.1780Entrance guardgetup_mean3Wednesday morning average0.1766Entrance guardgetup_std3Standard deviation of Wednesday morning0.1761Consumelunch_meanThe average amount spent on lunch0.1825Entrance guardWork stay roomTime spent in the dormitory on weekdays−0.1564Entrance guardlast_std6Saturday night is standard deviation0.1540Entrance guardFeetcardSwipe cards front and back0.1440Consumerest_consumeRest day consumption amount−0.1424ConsumeWork consumeConsumption amount on working days−0.1314ScoreGPA avgGrade point average−0.1244Scoreguake_countFailing credit0.1218Consumeabnormal_scoreAbnormal scores0.1209NetworkcnnThe internet features−0.1149It can be seen from the table that 7 of the first 8 positive correlation characteristics are related to early rise. In general, students’ courses are arranged by week, and students have the same class time every week. The larger standard deviation or average value of early rise may be caused by lateness or truancy. There was a positive correlation with mental health problems. Working day and day of rest time to stay in the dormitory all show the negative correlation. There is a negative correlation between the time spent in the dormitory on weekdays and rest days. The students spend more time in the dormitory and less time in club activities, student work, and dinner parties. These students have poor interpersonal communication and are more likely to have mental health problems, consistent with people's intuitive feelings. This kind of students have generally poor interpersonal, namely, interpersonal communication; the worse the student, the more possible mental health problems, which is consistent and intuitive feeling of people. Students who spend more money in the canteen on weekdays and holidays may seldom participate in dinner parties, which may also reflect poor interpersonal communication. In addition, the correlation coefficient of students’ swiping times is high and negative. On the one hand, students who swiped cards less often participated in fewer activities and had poorer interpersonal communication. On the other hand, students who swipe their credit cards only a few times a month should live off-campus and be the focus of attention. The insomnia rate (correlation coefficient 0.1058), the number of takeout orders (correlation coefficient 0.1024), GPA_avg, and failed credits were all weakly correlated, but still valuable for analysis.Through the above analysis, some characteristics related to mental health problems are obtained, and the impact on mental health is in line with common sense. Moreover, these related features come from multiple data sources, which shows that the use of multisource data can improve the recognition effect from one aspect.


## 4.1. Experimental Data

Among the 280 undergraduates who participated in the survey, 70 students were assessed as students with mental health problems by experts at the university’s psychological center in May and June 2019. Their mental health levels were classified as mild, moderate, or severe. In addition, 210 undergraduates were randomly selected from the entire school. Finally, the proportion of students at each mental state level is shown in Figure4.Figure 4
Proportion of each mental state in the data set.Students were divided into two groups, with a positive sample for mild, moderate, and severe cases, and a negative sample for students without mental health problems. The label has high credibility and avoids the drawbacks of concealing facts in questionnaires. In order to protect students’ privacy, the student id was encrypted throughout the experiment. As the psychological state is a short-term state, generally lasting from half a month to one month, only the consumption data access control data and network logs in April 2021 are used.


## 4.2. Training Set and Test Set

The essence of deep learning is the process of model selection. However, only parameters of the model are unknown. By using various tuning methods, an optimal value can be obtained, which enables the model to map independent variables to dependent variables well. In practice, it is not always easy to sample data evenly. So, the actual process is random. In this experiment, the data set sample is 280 students, among which 70 students are positive samples and 210 students are negative samples; that is to say, the ratio of positive samples to negative samples is 1 : 3. In order to make the sample ratio of the training set and the test set 1 : 3, 49 and 147 students were randomly selected from the positive and negative samples of the data set, respectively, as the training set, and 25% of the data were used as the verification set, and the positive and negative sample ratio was 1 : 3. Meanwhile, the ratio of positive and negative samples in the test set was 1 : 3.


## 4.3. Comparison and Analysis of Experimental Results

The extracted features are input into the classification algorithm for model training and prediction. Five common machine learning classification algorithms, including random forest (RT), gradient ascending tree (GBDT), Naive Bayes (NB), neural network (NN), and decision tree (DT), are compared. The experimental results are shown in Table6.Table 6
Results of five classification algorithms to identify students with psychological problems.
Sorting algorithmsPrecisionRecallF1-measureRT0.680.530.65GBDT0.650.520.62NB0.620.500.60NN0.650.500.63DT0.680.580.69First of all, it can be obviously observed that in all models, precision is higher than recall, and recall is only 0.58 at its highest, indicating that few samples can be correctly identified. Secondly, decision tree has the best comprehensive performance, especially recall. Therefore, we choose decision tree as the classifier of mental health recognition algorithm based on multisource data.To verify the generalization ability of the algorithm, we input the test data set into our algorithm and obtain the following experimental results: precision 0.68, recall 0.56, andF1-measure 0.67. Based on the test set experiment results, our algorithm was able to identify 56 percent of students with mental health problems. Table 7 lists 20 characteristics with high Pearson’s correlations.Table 7
The top 20 most relevant features.
Characteristics of the categoryCharacteristicSignalmentCoefficient of associationEntrance guardGetup std 1Standard deviation of Monday morning0.2627Entrance guardReststayroomTime spent in the dormitory on days off-0.2290Entrance guardSwipe_numCredit card number−0.2159Entrance guardgetup_mean6Saturday morning average0.2014Entrance guardlast_count5Number of Friday nights0.1990Entrance guardgetup_mean1Monday morning average0.1915Entrance guardgetup_count7Number of early Sundays0.1830Entrance guardgetup_mean4Thursday morning average0.1780Entrance guardgetup_mean3Wednesday morning average0.1766Entrance guardgetup_std3Standard deviation of Wednesday morning0.1761Consumelunch_meanThe average amount spent on lunch0.1825Entrance guardWork stay roomTime spent in the dormitory on weekdays−0.1564Entrance guardlast_std6Saturday night is standard deviation0.1540Entrance guardFeetcardSwipe cards front and back0.1440Consumerest_consumeRest day consumption amount−0.1424ConsumeWork consumeConsumption amount on working days−0.1314ScoreGPA avgGrade point average−0.1244Scoreguake_countFailing credit0.1218Consumeabnormal_scoreAbnormal scores0.1209NetworkcnnThe internet features−0.1149It can be seen from the table that 7 of the first 8 positive correlation characteristics are related to early rise. In general, students’ courses are arranged by week, and students have the same class time every week. The larger standard deviation or average value of early rise may be caused by lateness or truancy. There was a positive correlation with mental health problems. Working day and day of rest time to stay in the dormitory all show the negative correlation. There is a negative correlation between the time spent in the dormitory on weekdays and rest days. The students spend more time in the dormitory and less time in club activities, student work, and dinner parties. These students have poor interpersonal communication and are more likely to have mental health problems, consistent with people's intuitive feelings. This kind of students have generally poor interpersonal, namely, interpersonal communication; the worse the student, the more possible mental health problems, which is consistent and intuitive feeling of people. Students who spend more money in the canteen on weekdays and holidays may seldom participate in dinner parties, which may also reflect poor interpersonal communication. In addition, the correlation coefficient of students’ swiping times is high and negative. On the one hand, students who swiped cards less often participated in fewer activities and had poorer interpersonal communication. On the other hand, students who swipe their credit cards only a few times a month should live off-campus and be the focus of attention. The insomnia rate (correlation coefficient 0.1058), the number of takeout orders (correlation coefficient 0.1024), GPA_avg, and failed credits were all weakly correlated, but still valuable for analysis.Through the above analysis, some characteristics related to mental health problems are obtained, and the impact on mental health is in line with common sense. Moreover, these related features come from multiple data sources, which shows that the use of multisource data can improve the recognition effect from one aspect.


## 5. Conclusion

This paper proposes a mental health problem recognition algorithm based on multisource data, trains five common classification algorithms, evaluates through the verification set, and establishes a recognition system to judge the psychological emotions of college students, and analyzes the results of the system verification test. The following conclusions can be drawn:(1)
Analysis of student behavior data can be used to identify students with mental health problems.(2)
Using a variety of behavioral data can improve the identification effect of students’ mental health problems and can identify 75% of students with mental health problems.To establish college students’ mental emotion recognition system, this paper through the prediction results can identify the students with risk of mental health problems and counselors for school administrators to better understand the students’ psychological condition, giving psychological help to the student as soon as possible and targeted intervention method provides the theory support, able to prevent the further deterioration of the psychological condition of students.



---

*Source: 6348681-2022-05-12.xml*