## 4 Design
### Topic Data Quality Assessment Module
\[cov(y_{1},y_{2},w_{12}) = \frac{1}{w-1}{\sum_{d=1}^{w_{12}}}(y_{1d}-\overline{y}_{1}\,)\, (y_{2d}-\overline{y_{2}}) \tag{6}\] \[cov(y_{1},y_{3},w_{13}) = \frac{1}{w-1}{\sum_{d=1}^{w_{13}}}(y_{1d}-\overline{y_{1}}\,)\, (y_{3d}-\overline{y_{3}})\] (7) \[cov(y_{2},y_{3},w_{23}) = \frac{1}{w-1}{\sum_{d=1}^{w_{23}}}(y_{2d}-\overline{y_{2}}\,)\, (y_{3d}-\overline{y_{3}}) \tag{8}\]  
As the smart broker is only interested in relationship nature, that is, direct or inverse, the correlation is calculated and normalized as follows:  
\[a(\tau_{1},\tau_{2},w_{12})=\left(1+\frac{(cov(y_{1},y_{2},w_{12}))}{\left( \sigma_{y_{1}}.\sigma_{y_{2}}\right)}\right)/2 \tag{9}\]  
\[a(\tau_{1},\tau_{3},w_{13})=\left(1+\frac{(cov(y_{1},y_{3},w_{13}))}{\left( \sigma_{y_{1}}.\sigma_{y_{3}}\right)}\right)/2 \tag{10}\]  
\[(\tau_{2},\tau_{3},w_{23})=\left(1+\frac{(cov(y_{2},y_{3},w_{23}))}{\left( \sigma_{y_{2}}.\sigma_{y_{3}}\right)}\right)/2 \tag{11}\]  
Equations (7)-(9) provide the association coefficients \(a(\tau_{1},\tau_{2})\), \(a(\tau_{1},\tau_{3})\), and \(a(\tau_{2},\tau_{3})\), respectively, within a range of 0 to 1 for the grouped topics \(R=\{\tau_{1},\,\tau_{2},\,\tau_{3}\}\), respectively. These coefficients measure the strength of the association between the respective pairs of topics. The actual association coefficients \(a\big{(}\tau_{i},\tau_{j}\big{)}\) and the expected association \(v_{ij}\) are used to calculate the quality of the topic \(\tau_{1}\) as follows:  
\[q(\tau_{i})=\frac{\prod_{i\
eq j\,\wedge\,(i,j)\,\in\,R}\left(1-\left|a\big{(} \tau_{i},\tau_{j}\big{)}-v_{ij}\right|\right)}{\left(max\{(1-\left|a(\tau_{1}, \tau_{2})-v_{12}\right|),(1-\left|a(\tau_{2},\tau_{3})-v_{23}\right|),(1- \left|a(\tau_{1},\tau_{3})-v_{13}\right|)\}\right)^{2}} \tag{12}\]  
Equation (12) defines the quality of a given topic, for example, \(q(\tau_{1})\), by examining its relationship with other topics, for example, \(\tau_{2}\) and \(\tau_{3}\) using their expected correlation (\(v_{ij}\)) and the calculated association coefficients \(\big{(}a_{ij}\big{)}\). Figure 3 shows the topic relationships \(R=\{\tau_{1},\tau_{2},\tau_{3}\}\). For a group of three topics, the relationship is expected to be at \(v_{ij}\) for window \(w_{ij}\) for the respective pairs of topics. The quality calculated is the product of the ratio of the correlation difference for the relationships \(\left(1-\left|a\big{(}\tau_{i},\tau_{j}\big{)}-v_{ij}\right|\right)\) that contain the topic and the lowest correlation difference in the group \(R\). It is expected that the lowest correlation difference signifies the relationship of topics that still holds steady, that is, \(\tau_{2}\) and \(\tau_{3}\). The other two relationships change as \(\tau_{1}\) are getting corrupted values, which throws the correlation off track. Note that the quality is calculated based on the difference between the expected and current correlations \(\left(1-\left|a\big{(}\tau_{i},\tau_{j}\big{)}-v_{ij}\right|\right)\) and not the correlations themselves. The resulting value of \(q(\tau_{i})\) falls within the range of (0, 1), where 1 denotes perfect quality, indicating high accuracy in the data, while 0 signifies poor quality. This can be generalized to:  
\[q(\tau_{i})=\frac{\prod_{i\
eq j\bigwedge(i,j)\in R}\left(1-\left|a\left(\tau_{i },\tau_{j}\right)-v_{ij}\right|\right)}{\left(\underset{k\
eq k\wedge k\
eq j}{ \max}\left\{\left(1-\left|a\left(\tau_{k},\tau_{j}\right)-v_{kj}\right|\right) \right\}\right)^{|R|-1}} \tag{13}\]  
The denominator is raised to \(|R|-1\), where the \(|R|\) is the number of topics in the group \(R\). However, making a large group could negatively impact the quality score for its constituent topics compared to a smaller group. Hence, the smart broker should aim to use a static group size. In this paper, for \(\tau_{1}\) considers only two additional topics \(\tau_{2}\) and \(\tau_{3}\) calculating topic using Equation (12), where \(|a(\tau_{1},\tau_{2})-v_{12}|\) and \(|a(\tau_{1},\tau_{3})-v_{13}|\) are the minimum in the group, keeping its size to 3.