当前位置:   article > 正文

计算机毕业设计Python+Spark+PyTroch游戏推荐系统 游戏可视化 游戏爬虫 神经网络混合CF推荐算法 协同过滤推荐算法 steam 大数据

计算机毕业设计Python+Spark+PyTroch游戏推荐系统 游戏可视化 游戏爬虫 神经网络混合CF推荐算法 协同过滤推荐算法 steam 大数据

毕业设计(论文)

基于SpringBoot的游戏防沉迷系统的设计与实现

  要

随着网络游戏市场的持续火爆,其最明显的负面影响----“网络游戏沉迷问题”已成为当前社会普遍关心的热点问题。根据2010年8月1日实施的《网络游戏管理暂行办法》,网络游戏用户需使用有效身份证件进行实名注册。为保证流畅游戏体验,享受健康游戏生活、保护未成年人身心健康,未满18岁的用户将受到防沉迷系统的限制,在全国范围内强制推行网络游戏防沉迷系统。而这些网络游戏防沉迷系统主要由游戏生产商推出,因此每款游戏防沉迷系统只针对一款游戏,不能解决青少年玩多款游戏而拥有过多的游戏时间的问题。因此,有必要设计一种针对终端用户的游戏沉迷监控系统,以解决上述问题。
  防沉迷软件的开发可以有效的掌控好未成年人的具体上网时间,合理的安排好时间的利用方向,使得劳逸结合。

本系统使用后台使用Springboot框架开发,数据库使用MySQL,完成系统功能模块的开发。

关键词:Springboot框架;防沉迷系统;MYSQL数据库

ABSTRACT

As the online game market continues to hot, its most obvious negative impact ---- "addiction to online games" has become a hot issue of general concern in the current society. According to the Interim Measures for the Administration of Online Games, which came into effect on August 1, 2010, users of online games need to register with their real names using valid id cards. Users under the age of 18 will be subject to a nationwide anti-addiction system to ensure smooth gaming experience, enjoy a healthy gaming life and protect the physical and mental health of minors. And these online game anti-addiction system is mainly launched by game manufacturers, so each game anti-addiction system is only for one game, can not solve the problem of teenagers playing multiple games and having too much game time. Therefore, it is necessary to design a game addiction monitoring system for end users to solve the above problems.

The development of anti-addiction software can effectively control the specific Internet time of minors, reasonable arrangement of the use of time direction, so that the combination of work and rest.

This system uses Springboot framework development background, database using MySQL, complete the development of system function modules.

Key words :Springboot framework; Anti-addiction system; The MYSQL database

目录

摘要...............................................

ABSTRACT

1 绪  论

1.1研究意义

1.2开发背景

2 相关技术介绍

2.1 Springboot技术

2.2 bootstrap

2.3 MYSQL数据库

2.4 springmvc

2.5 Spring

2.6 MyBatis

3 系统分析

3.1需求分析

3.2可行性分析

3.2.1经济可行性

3.2.2技术可行性

3.2.3操作可行性

3.2.4 法律可行性

3.3界面需求分析

1.输出设计

2.输入设计

4 系统设计

4.1概述

4.2系统功能设计

4.3数据库设计

4.3.1数据库设计原则

4.3.2数据库表设计

5 系统实现

5.1系统登录界面

5.2租号主页界面

5.3账号租用界面

5.4号主界面

6 系统测试

6.1系统测试的意义

6.2单元测试

6.2.1 黑盒测试

6.2.2 白盒测试

6.2.3模块接口测试

6.3性能测试

6.4测试分析

总 结

参考文献

致 谢

核心算法代码分享如下:

  1. # coding=utf-8
  2. import random
  3. import sys
  4. import math
  5. from operator import itemgetter
  6. import pymysql
  7. from rate import Rate
  8. from tool import db
  9. """
  10. """
  11. class ItemBasedCF():
  12. # 初始化参数
  13. def __init__(self):
  14. self.n_sim_movie = 8
  15. self.n_rec_movie = 4
  16. self.trainSet = {}
  17. self.testSet = {}
  18. self.movie_sim_matrix = {}
  19. self.movie_popular = {}
  20. self.movie_count = 0
  21. print('Similar movie number = %d' % self.n_sim_movie)
  22. print('Recommneded movie number = %d' % self.n_rec_movie)
  23. def get_dataset(self, pivot=0.75):
  24. trainSet_len = 0
  25. testSet_len = 0
  26. # sql = ' select * from tb_rate'
  27. results = db.session.query(Rate).all()
  28. # print(results)
  29. for item in results:
  30. user, movie, rating = item.uid, item.iid, item.rate
  31. self.trainSet.setdefault(user, {})
  32. self.trainSet[user][movie] = rating
  33. trainSet_len += 1
  34. self.testSet.setdefault(user, {})
  35. self.testSet[user][movie] = rating
  36. testSet_len += 1
  37. # cnn.close()
  38. # db.session.close()
  39. print('Split trainingSet and testSet success!')
  40. print('TrainSet = %s' % trainSet_len)
  41. print('TestSet = %s' % testSet_len)
  42. # 读文件,返回文件的每一行
  43. def load_file(self, filename):
  44. with open(filename, 'r') as f:
  45. for i, line in enumerate(f):
  46. if i == 0: # 去掉文件第一行的title
  47. continue
  48. yield line.strip('\r\n')
  49. print('Load %s success!' % filename)
  50. # 计算电影之间的相似度
  51. def calc_movie_sim(self):
  52. for user, movies in self.trainSet.items():
  53. for movie in movies:
  54. if movie not in self.movie_popular:
  55. self.movie_popular[movie] = 0
  56. self.movie_popular[movie] += 1
  57. self.movie_count = len(self.movie_popular)
  58. print("Total movie number = %d" % self.movie_count)
  59. for user, movies in self.trainSet.items():
  60. for m1 in movies:
  61. for m2 in movies:
  62. if m1 == m2:
  63. continue
  64. self.movie_sim_matrix.setdefault(m1, {})
  65. self.movie_sim_matrix[m1].setdefault(m2, 0)
  66. self.movie_sim_matrix[m1][m2] += 1
  67. print("Build co-rated users matrix success!")
  68. # 计算电影之间的相似性 similarity matrix
  69. print("Calculating movie similarity matrix ...")
  70. for m1, related_movies in self.movie_sim_matrix.items():
  71. for m2, count in related_movies.items():
  72. # 注意0向量的处理,即某电影的用户数为0
  73. if self.movie_popular[m1] == 0 or self.movie_popular[m2] == 0:
  74. self.movie_sim_matrix[m1][m2] = 0
  75. else:
  76. self.movie_sim_matrix[m1][m2] = count / math.sqrt(self.movie_popular[m1] * self.movie_popular[m2])
  77. print('Calculate movie similarity matrix success!')
  78. # 针对目标用户U,找到K部相似的电影,并推荐其N部电影
  79. def recommend(self, user):
  80. K = self.n_sim_movie
  81. N = self.n_rec_movie
  82. rank = {}
  83. if user > len(self.trainSet):
  84. user = random.randint(1, len(self.trainSet))
  85. watched_movies = self.trainSet[user]
  86. for movie, rating in watched_movies.items():
  87. for related_movie, w in sorted(self.movie_sim_matrix[movie].items(), key=itemgetter(1), reverse=True)[:K]:
  88. if related_movie in watched_movies:
  89. continue
  90. rank.setdefault(related_movie, 0)
  91. rank[related_movie] += w * float(rating)
  92. return sorted(rank.items(), key=itemgetter(1), reverse=True)[:N]
  93. # 产生推荐并通过准确率、召回率和覆盖率进行评估
  94. def evaluate(self):
  95. print('Evaluating start ...')
  96. N = self.n_rec_movie
  97. # 准确率和召回率
  98. hit = 0
  99. rec_count = 0
  100. test_count = 0
  101. # 覆盖率
  102. all_rec_movies = set()
  103. for i, user in enumerate(self.trainSet):
  104. test_moives = self.testSet.get(user, {})
  105. rec_movies = self.recommend(user)
  106. for movie, w in rec_movies:
  107. if movie in test_moives:
  108. hit += 1
  109. all_rec_movies.add(movie)
  110. rec_count += N
  111. test_count += len(test_moives)
  112. precision = hit / (1.0 * rec_count)
  113. recall = hit / (1.0 * test_count)
  114. coverage = len(all_rec_movies) / (1.0 * self.movie_count)
  115. print('precisioin=%.4f\trecall=%.4f\tcoverage=%.4f' % (precision, recall, coverage))
  116. def rec_one(self,userId):
  117. print('推荐一个')
  118. rec_movies = self.recommend(userId)
  119. # print(rec_movies)
  120. return rec_movies
  121. # 推荐算法接口
  122. def recommend(userId):
  123. itemCF = ItemBasedCF()
  124. itemCF.get_dataset()
  125. itemCF.calc_movie_sim()
  126. reclist = []
  127. recs = itemCF.rec_one(userId)
  128. return recs
  129. if __name__ == '__main__':
  130. param1 = sys.argv[1]
  131. # param1 = "1"
  132. result = recommend(int(param1))
  133. list = []
  134. for r in result:
  135. list.append(dict(iid=r[0], rate=r[1]))
  136. print(list)

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/662967
推荐阅读
相关标签
  

闽ICP备14008679号