# A Method for Identifying the Mood States of Social Network Users Based on Cyber Psychometrics
## 3 Materials and Methods
### Prediction of Mood States of Weibo Users Using Multitask Regression  
Conventional network psychometric research usually adopts regression, neural networks and other methods to model every prediction task separately to fit the specific information of each regression task. Recent studies have shown that psychological variables are interrelated and that they play an important role in the joint prediction of different psychological variables [39]. Thus, this study adopted the multitask learning method to improve performance. The multitask learning method not only saved the specific information between tasks, but also integrated the information of multiple tasks to establish a more effective prediction model for the calculation of the different dimensions of mood states.  
In the process of predicting the Weibo users' mood states, the multitask regression method was introduced to build the calculation model. Aimed at predicting mood state variables from eight sentimental dimensions (seven sub-dimensions and one total score), this paper set eight learning tasks to build a regression model. In the regression model, the number of regression tasks was denoted as \(T\). For each task \(t\), there was an independent training set \(\left\{(x_{tn},y_{tn})\right\}\),where \(t=1,2,\ldots,T,n=1,2,\ldots,N\), and \(N\) is the number of instances, assuming that all tasks have the same number of instances. The learning function is \(f_{t}:R^{d}\to R\), and the training set is \(\left\{(x_{1}^{t},y_{1}^{t}),\left(x_{2}^{t},y_{2}^{t}\right),\ldots\left(x_ {N}^{t},y_{N}^{t}\right)\right\}\). The linear function is \(f_{t}(X)=w^{t}X\), where \(w^{t}\) represents the model coefficient in task \(t\), and \(X\) is the input column vector. The loss function is \(L^{t}\left(w^{t},X,y^{t}\right)\)., where \(W\) is a coefficient matrix with \(w^{t}\) as the row vector and \(w_{k}\) as the column vector so that \(w_{k}\) is the coefficient related to the feature \(k\).  
\[\mathbf{W}=\left[\begin{array}{ccc}w_{1}^{1}&\cdots&w_{K}^{1}\\ \vdots&\ddots&\vdots\\ w_{1}^{T}&\cdots&w_{K}^{T}\end{array}\right] \tag{4}\]  
To filter the global features, \(w_{k}\) is constrained as follows:  
\[\min_{w}\sum_{t=1}^{T}\ L^{t}\left(w^{t},X,y^{t}\right)+\lambda\sum_{k=1}^{K} \left\|w_{k}\right\|_{2}^{2} \tag{5}\]  
The linear least squares fit (LLSF) is used here to make the fitting. The loss function is denoted as:  
\[L^{t}\big{(}w^{t},X,y^{t}\big{)}=\sum_{n=1}^{N}\big{(}y_{n}^{t}-w^{t}\cdot x_ {n}\big{)}^{2} \tag{6}\]  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Symbol** & **Explanation** & **Features Contained** \\ \hline \(D_{i}\) & Basic information of users & Length of Weibo ID, gender, registration date, number of labels and length of personal profile \\ \hline \(S_{j}\) & Social characteristics of users & Number of followers, number of follows and number of total tweets \\ \hline \(T_{m}\) & Prosperities of users’ tweets & Average length of tweets, average times for the use of the @ signal, monthly average number of tweets and other related features \\ \hline \(M_{n}\) & Sequential sentiment-related features of blog text & Sentimental vector of tweets in five specific periods including 1 week, 1 month, 3 months, 6 months and 1 year \\ \hline \hline \end{tabular}
\end{table}
Table 3: Features Divided into Four Categories.  
Therefore, the objective function is:  
\[\mathbf{W}=argmin\ \sum_{t=1}^{T}\sum_{n=1}^{N}\left(y_{n}^{t}-w^{t}\cdot x_{n}\right)^{2 }+\lambda\sum_{k=1}^{K}\left\|w_{k}\right\|_{2}^{2} \tag{7}\]  
Finally, it can be concluded that:  
\[\mathbf{W}=\left(\lambda I+\sum_{n}x_{n}x_{n}^{\top}\right)^{-1}\left(\sum_{n}x_{ n}y_{n}^{\top}\right) \tag{8}\]  
The parameter \(\lambda>0\) is the regularization parameter, controlling the trade-off between the regression loss and the size of the weight vector, as measured by the \(\ell_{2}\) norm in Equations (5) and (7) [40,41]. The objective function is smooth and convex and can be minimized by standard method such as coordinate descent [41].