# Dynamic Group Recommendation Based on the Attention Mechanism
## 3 Methods
### Density Peak Clustering Algorithm  
The idea of the DPC algorithm is to represent the distance of a certain number of points based on the local density. The more points around a point, the larger the local density. The clustering center has the following two characteristics: (1) The local density of data points is relatively large, which is surrounded by some data objects with low local density and (2) the points with high local density are relatively far away from other points with high local density. The local density and relative distance of the algorithm use \(\rho_{i}\) and \(\delta_{i}\) to represent these two features, respectively, and the clustering center is to select the point where \(\rho_{i}\) and \(\delta_{i}\) are relatively large. The processing flow of DPC algorithm can be summarized as the following steps: (1) Setting the cutoff distance \(d_{c}\), calculate the local density \(\rho_{i}\) and high-density distance \(\delta_{i}\) according to the set \(d_{c}\) distance value, and marking the point that has a  
Figure 1: Overview of the group recommended. higher density than each other point. (2) The density peak needs to be found in the decision graph, i.e., the clustering center. (3) Assign the remaining data points to the class where the density is higher than itself and the nearest point is located. For the local density \(\rho_{i}\) of the data object \(x_{i}\), there are two calculation methods: Cut-off kernel and Gaussian kernel. Cut-off kernel is defined as:  
\[\rho_{i}=\sum\
olimits_{j}x\Big{(}d_{ij}-d_{c}\Big{)}, \tag{1}\]  
where \(d_{ij}\) represents the certain distance between data points \(x_{i}\) and \(x_{j}\) and \(d_{c}\) is a preset value, which indicates that the cutoff distance (\(d_{c}>0\)). Generally, the first 2% of the distance between two data objects in ascending order is regarded as the cutoff distance and the \(\chi()\) function is defined as follows:  
\[\chi(x)=\left\{ \begin{array}{l}1\,\ x<0\\ 0\,\ x\geq 0\end{array} \right.. \tag{2}\]  
Gaussian kernel is defined as:  
\[\rho_{i}=\sum\limits_{j}e^{-\frac{(d_{ij})}{(d_{c})}^{2}}. \tag{3}\]  
The difference between the cut-off kernel and Gaussian kernel is that the cut-off kernel results are discrete values while Gaussian kernel results are continuous values. Relatively speaking, the conflicts generated by the latter (that is, different data points have the same local density) are less probable. Literature [35] adopted the cut-off kernel and Gaussian kernel local density calculation methods for classical data set path-based2 respectively, which proves that the DPC algorithm adopted Equation (3), Gaussian kernel, to measure the local density clustering effect better. For the relative distance of data point \(x_{i}\), there are the following calculation methods:  
\[\delta_{i}=min_{j:\rho_{j}>\rho_{i}}\Big{(}d_{ij}\Big{)}. \tag{4}\]  
From Equation (4), \(\delta_{i}\) indicates the relative distance, that is, for each data point \(x_{i}\), finds all data points \(x_{j}\), which are denser than the data point \(x_{i}\), and selects the smallest \(d_{ij}\) as \(\delta_{i}\). If data point \(x_{i}\) is the highest local density data point, \(\delta_{i}\) is defined as \(\delta_{i}=max_{j}\Big{(}d_{ij}\Big{)}\), which is the maximum distance from all data points to data point \(x_{i}\). The decision graph is an innovation in the DPC algorithm. For each data point \(x_{i}\) in the data set, it needs to calculate the local density \(\rho_{i}\) and relative distance \(\delta_{i}\) separately, Then, according to the calculated values, each data point is in the form of a binary pair \((\rho_{i},\delta_{i})\), and a two-dimensional planar decision diagram is drawn (with \(\rho_{i}\) as the horizontal axis and \(\delta_{i}\) as the vertical axis). Figure 2 is a distribution with 28 two-dimensional data points, and the data points are arranged in descending order of density.