基于Spark和微服务架构的电影推荐系统设计与实现
2021-04-13史爱武李险贵
史爱武 李险贵



摘要:推荐系统广泛应用于人们生活的多个领域,日常生活中常见的有电商、电影、音乐和新闻推荐等。推荐系统根据用户的历史偏好主动推送相关的信息,节约了用户的时间,极大地提升了用户的体验。随着大数据技术的发展成熟,数据处理的速度变得更快。该文选取MovieLens电影数据集,并基于大数据分布式处理框架Spark和交替最小二乘法ALS等算法搭建数据处理平台,然后再结合Spring Boot和Spring Cloud等搭建电影后台服务,实现一个基于微服务架构的电影推荐系统。
关键词:推荐系统;Spark;ALS;微服务架构
Abstract: Recommendation system is widely used in many fields of people's life, such as e-commerce, movies, music and news recommendation and so on. Recommendation system actively pushes relevant information according to the user's historical preference, which saves the user's time and greatly improves the user's experience. With the development and maturity of big data technology, the speed of data processing becomes faster. This paper selects movielens movie data set, builds a data processing platform based on big data distributed processing framework Spark and alternating least squares algorithm ALS, and then builds movie background service combined with Spring Boot and Spring Cloud to realize a movie recommendation system based on microservice architecture.
Key words: recommendation system; Spark; ALS; microservice architecture
1 背景
大數据时代用户面临信息过载的问题,为了从海量数据中找到用户可能感兴趣的信息,由此产生了推荐系统。日常生活中常见的有电商、电影、音乐和新闻推荐等[1]。随着大数据技术如Spark、Flink等的发展成熟,其计算速度更快,可以更好地为广大群众服务。本文将基于Spark和微服务架构设计并实现一个简易的电影推荐系统。
2 相关技术
2.1 推荐策略
推荐系统的实质是对用户或者物品的本身属性即基本信息,或者是对用户的行为数据进行分析,通过特定的算法模型从海量数据中找到相关性,从而产生推荐的结果。常见的推荐策略有基于内容的推荐、协同过滤推荐和混合推荐等[2]。
基于内容的推荐,即根据物品自身的属性特征计算物品间的相关性或相似性,再基于用户的历史偏好记录为用户推荐相似的物品。基于协同过滤的推荐,即根据用户评分矩阵,用户和物品协同作战。……
