## 3 Emotion-Aware PMRS  
In this section, we investigate the system architecture and the data flow design of the proposed EPMRS. The EPMRS system architecture is a cloud-based architecture containing three layers: user input layer, request handler layer and the EPMRS layer. All of the three layers presented in the EPMRS system architecture work independently on separate platforms. This independent functionality of the EPMRS system architecture allows us to upgrade or replace any of the three layers independently in response with respect to any technological requirements. Thus, the three-layer EPMRS system architecture provides reliability with well-defined interfaces. Figure 2 shows the three-layered EPMRS system architecture.  
* _User input_: This is the front-end layer of the EPMRS system architecture. This layer keeps track of the user's data. The user's data contains the user's music listening data, the user's current emotion, the user's login data, the time of the day, the geographical location, the user's click stream, the user's rating for the song, the ambience, etc. This user's data are given as input data to the request handler layer for further processing. This layer accepts the recommended songs list generated from the EPMRS layer from the request handler layer. The recommended songs' list is displayed to the user as part of the music recommendations.  
* _Request handler_: This layer acts as a middle layer between user input and the EPMRS layer. The user's data obtained from the user input layer is the input data to the EPMRS layer for providing music recommendations with respect to the user. This layer gets the recommended songs from the EPMRS layer and sends it to the user input layer.
* _EPMRS_: This layer is the core layer where the EPMRS is deployed. This layer is a cloud-based distributed storage and processing layer. In order to store a huge amount of user behaviors on large scale music (e.g., more than one million songs data), we use the Docker technology to provide cloud environment to the EPMRS. Each Docker container is an Apache spark node containing mongoDB as the database. The Apache spark with mongoDB provides the distributed data storage and processing in this layer. Along with users' data, this layer is also responsible for storing the music data. The music data is collected from the music website crawlers. We use Apache Nutch based music website crawlers to crawl the music data from the online music websites. The music data contains the metadata and the audio signal of the songs. The music data and the user's data are stored as part of the distributed storage in the EPMRS. After processing the user's data and the music data, the EPMRS generates the recommended songs list to the user. This recommended songs list is given as input to the request handler layer.  
Figure 2: The system architecture and the data flow for the EPMRS.  
According to the two types of data received at the EPMRS layer, the EPMRS uses two approaches: the WFE approach and the DCNN approach. We propose a WFE approach to extract the user's latent features presented in the user's data. The user's latent features extracted from the user's data contain the details about the user-to-song relationship with respect to the user's current emotion. The user's latent features are stored as part of the user data in the database. The DCNN approach classifies songs available in the crawled music data based on the metadata and the audio signal presented in the songs. The DCNN approach stores the songs according to their classification as part of the music data in the database. In Section 4, we discuss the mathematical model for the EPMRS.