# A Two-Phase Deep Learning-Based Recommender System: Enhanced by a Data Quality Inspector
## 3 Materials and Methods  
### System Overview  
The proposed framework was designed to counteract the following two problems: (a) how to produce high-quality data, to be used as a boosted input for recommenders, and (b) how to generate product recommendations with higher accuracy. Consequently, its architecture comprises two main phases: (1) a quality inspector that assures that a rating provided by a user is consistent with the textual review that the same user expressed to a specific product, and (2) a recommender system that takes the preprocessed and clean data produced by a quality inspector and generates suitable items recommendations. Thus, the main functionality is to enhance the performance, specifically the accuracy, of a collaborative filtering-based recommender engine. Figure 1 illustrates the overall view of the proposed two-phase deep learning-based framework.  
Notice that two databases, one for each phase, are employed: dataset A and dataset B. They have the same structure, identical features, and an equal total number of data rows, but have different records. The main motivations to work with two sets are: (a) to apply dataset A in the first phase mainly to determine the best algorithm to model a sentiment predictor, and (b) to exploit dataset B in the second phase mostly to run the complete proposed procedure, composed of a quality inspector plus a recommender engine, completely from zero with a sole database.  
The first phase aims to identify, through dataset A, the most accurate algorithm, for a sentiment predictor that predicts a rating from a textual review. In this study, it is assumed that the rating is an integer on a scale from 1 to 5. Accordingly, the core of the quality inspector is to check consistency between each review-rating record that a user gave to an item, determining whether it is high-quality or low-quality input data. Let \(r_{i}^{s}\) be the sentiment rating predicted by the predictor for record \(i\), \(r_{i}^{e}\) be the explicit rating for record \(i\), and \(k\) be the acceptable threshold defined by users. If  
\[|(r_{i}^{s}-r_{i}^{e})|\,\leq\,\,k \tag{1}\]  
the \(i\)-th review-rating pair is considered as high-quality data and will be conserved. On the other hand, if \(|r_{i}^{s}-r_{i}^{e}|>k\), the record is considered as inconsistent and will be discarded. The following equation is used to calculate the accuracy of the sentiment predictor:  
\[accuracy=|\{i:\,\,|\,(r_{i}^{s}-r_{i}^{e})|\,\leq\,k\}\,|/|\{i:i\in dataset\}| \tag{2}\]  
In the second phase, the best algorithm determined in the first phase is applied to create from scratch, with dataset B, the quality inspector that produces a pruned high-quality version of dataset B. Afterward, the explicit rating \(r_{i}^{e}\) will be integrated with the predicted sentiment rating \(r_{i}^{s}\) into an integrated preference rating \(r_{i}^{pref}\) as:  
\[r_{i}^{pref}=\alpha\times r_{i}^{e}+(1-\alpha)\times r_{i}^{s} \tag{3}\]  
where \(\alpha\) is a weight factor ranging between 0 and 1. This integrated preference rating combines knowledge from two sources: (1) a numeric explicit rating, and (2) a textual sentiment review, being a robust input for a recommender system. Finally, to know the performance of the proposed recommenders, the following metrics will be tested (a) RMSE, (b) F1 score, (c) accuracy, and (d) running time. Naturally, the model with the highest results in nearly all the indicators is considered as the best recommender engine.  
Figure 1: Overall view of the proposed framework.