《Item-Based Collaborative Filtering Recommendation Algorithms 》

基于物品的协同过滤推荐算法

https://blog.csdn.net/BTUJACK/article/details/84674967

《 Factorization Meets the Neighborhood: a Multifaceted Collaborative Filtering Model 》

因式分解满足邻域:多层面协同过滤模型

https://blog.csdn.net/fangqingan_java/article/details/50762296

《Matrix factorization techniques for recommender systems》

推荐系统矩阵分解技术

https://zhuanlan.zhihu.com/p/28577447?group_id=881547532893851649

《Factorization Machines with libFM》

带libFM的因数分解机器

从item-base到svd再到rbm,多种Collaborative Filtering(协同过滤算法)从原理到实现

https://blog.csdn.net/Dark_Scope/article/details/17228643

import numpy as np
import matplotlib.pyplot as plt
import math
number_of_bandits=10
number_of_arms=10
number_of_pulls=10000
epsilon=0.3
min_temp = 0.1
decay_rate=0.999def pick_arm(q_values,counts,strategy,success,failure):global epsilonif strategy=="random":return np.random.randint(0,len(q_values))if strategy=="greedy":best_arms_value = np.max(q_values)best_arms = np.argwhere(q_values==best_arms_value).flatten()return best_arms[np.random.randint(0,len(best_arms))]if strategy=="egreedy" or strategy=="egreedy_decay": if  strategy=="egreedy_decay": epsilon=max(epsilon*decay_rate,min_temp)if np.random.random() > epsilon:best_arms_value = np.max(q_values)best_arms = np.argwhere(q_values==best_arms_value).flatten()return best_arms[np.random.randint(0,len(best_arms))]else:return np.random.randint(0,len(q_values))if strategy=="ucb":total_counts = np.sum(counts)q_values_ucb = q_values + np.sqrt(np.reciprocal(counts+0.001)*2*math.log(total_counts+1.0))best_arms_value = np.max(q_values_ucb)best_arms = np.argwhere(q_values_ucb==best_arms_value).flatten()return best_arms[np.random.randint(0,len(best_arms))]if strategy=="thompson":sample_means = np.zeros(len(counts))for i in range(len(counts)):sample_means[i]=np.random.beta(success[i]+1,failure[i]+1)return np.argmax(sample_means)fig = plt.figure()
ax = fig.add_subplot(111)
for st in ["greedy","random","egreedy","egreedy_decay","ucb","thompson"]:best_arm_counts = np.zeros((number_of_bandits,number_of_pulls))for i in range(number_of_bandits):arm_means = np.random.rand(number_of_arms)best_arm = np.argmax(arm_means)q_values = np.zeros(number_of_arms)counts = np.zeros(number_of_arms)success=np.zeros(number_of_arms)failure=np.zeros(number_of_arms)for j in range(number_of_pulls):a = pick_arm(q_values,counts,st,success,failure)reward = np.random.binomial(1,arm_means[a])counts[a]+=1.0q_values[a]+= (reward-q_values[a])/counts[a]success[a]+=rewardfailure[a]+=(1-reward)best_arm_counts[i][j] = counts[best_arm]*100.0/(j+1)epsilon=0.3ys = np.mean(best_arm_counts,axis=0)xs = range(len(ys))ax.plot(xs, ys,label = st)plt.xlabel('Steps')
plt.ylabel('Optimal pulls')plt.tight_layout()
plt.legend()
plt.ylim((0,110))
plt.show()        ##################

相关代码:

# -*- coding: utf-8 -*-
import numpy as np
from matplotlib import pylab as plt
#from mpltools import style # uncomment for prettier plots
#style.use(['ggplot'])'''
function definitions
'''
# generate all bernoulli rewards ahead of time
def generate_bernoulli_bandit_data(num_samples,K):CTRs_that_generated_data = np.tile(np.random.rand(K),(num_samples,1))true_rewards = np.random.rand(num_samples,K) < CTRs_that_generated_datareturn true_rewards,CTRs_that_generated_data# totally random
def random(estimated_beta_params):return np.random.randint(0,len(estimated_beta_params))# the naive algorithm
def naive(estimated_beta_params,number_to_explore=100):totals = estimated_beta_params.sum(1) # totalsif np.any(totals < number_to_explore): # if have been explored less than specifiedleast_explored = np.argmin(totals) # return the one least exploredreturn least_exploredelse: # return the best mean foreversuccesses = estimated_beta_params[:,0] # successesestimated_means = successes/totals # the current meansbest_mean = np.argmax(estimated_means) # the best meanreturn best_mean# the epsilon greedy algorithm
def epsilon_greedy(estimated_beta_params,epsilon=0.01):totals = estimated_beta_params.sum(1) # totalssuccesses = estimated_beta_params[:,0] # successesestimated_means = successes/totals # the current meansbest_mean = np.argmax(estimated_means) # the best meanbe_exporatory = np.random.rand() < epsilon # should we explore?if be_exporatory: # totally random, excluding the best_meanother_choice = np.random.randint(0,len(estimated_beta_params))while other_choice == best_mean:other_choice = np.random.randint(0,len(estimated_beta_params))return other_choiceelse: # take the best meanreturn best_mean# the UCB algorithm using
# (1 - 1/t) confidence interval using Chernoff-Hoeffding bound)
# for details of this particular confidence bound, see the UCB1-TUNED section, slide 18, of:
# http://lane.compbio.cmu.edu/courses/slides_ucb.pdf
def UCB(estimated_beta_params):t = float(estimated_beta_params.sum()) # total number of rounds so fartotals = estimated_beta_params.sum(1)successes = estimated_beta_params[:,0]estimated_means = successes/totals # sample meanestimated_variances = estimated_means - estimated_means**2    UCB = estimated_means + np.sqrt( np.minimum( estimated_variances + np.sqrt(2*np.log(t)/totals), 0.25 ) * np.log(t)/totals )return np.argmax(UCB)# the UCB algorithm - using fixed 95% confidence intervals
# see slide 8 for details:
# http://dept.stat.lsa.umich.edu/~kshedden/Courses/Stat485/Notes/binomial_confidence_intervals.pdf
def UCB_bernoulli(estimated_beta_params):totals = estimated_beta_params.sum(1) # totalssuccesses = estimated_beta_params[:,0] # successesestimated_means = successes/totals # sample meanestimated_variances = estimated_means - estimated_means**2UCB = estimated_means + 1.96*np.sqrt(estimated_variances/totals)return np.argmax(UCB)# the bandit algorithm
def run_bandit_dynamic_alg(true_rewards,CTRs_that_generated_data,choice_func):num_samples,K = true_rewards.shape# seed the estimated params (to avoid )prior_a = 1. # aka successes prior_b = 1. # aka failuresestimated_beta_params = np.zeros((K,2))estimated_beta_params[:,0] += prior_a # allocating the initial conditionsestimated_beta_params[:,1] += prior_bregret = np.zeros(num_samples) # one for each of the 3 algorithmsfor i in range(0,num_samples):# pulling a lever & updating estimated_beta_paramsthis_choice = choice_func(estimated_beta_params)# update parametersif true_rewards[i,this_choice] == 1:update_ind = 0else:update_ind = 1estimated_beta_params[this_choice,update_ind] += 1# updated expected regretregret[i] = np.max(CTRs_that_generated_data[i,:]) - CTRs_that_generated_data[i,this_choice]cum_regret = np.cumsum(regret)return cum_regretif __name__ == '__main__':'''main code'''# define number of samples and number of choicesnum_samples = 10000K = 5 # number of armsnumber_experiments = 100regret_accumulator = np.zeros((num_samples,5))for i in range(number_experiments):print "Running experiment:", i+1true_rewards,CTRs_that_generated_data = generate_bernoulli_bandit_data(num_samples,K)regret_accumulator[:,0] += run_bandit_dynamic_alg(true_rewards,CTRs_that_generated_data,random)regret_accumulator[:,1] += run_bandit_dynamic_alg(true_rewards,CTRs_that_generated_data,naive)regret_accumulator[:,2] += run_bandit_dynamic_alg(true_rewards,CTRs_that_generated_data,epsilon_greedy)regret_accumulator[:,3] += run_bandit_dynamic_alg(true_rewards,CTRs_that_generated_data,UCB)regret_accumulator[:,4] += run_bandit_dynamic_alg(true_rewards,CTRs_that_generated_data,UCB_bernoulli)plt.semilogy(regret_accumulator/number_experiments)plt.title('Simulated Bandit Performance for K = 5')plt.ylabel('Cumulative Expected Regret')plt.xlabel('Round Index')plt.legend(('Random','Naive','Epsilon-Greedy','(1 - 1/t) UCB','95% UCB'),loc='lower right')plt.show()

推荐系统入门必读论文相关推荐

  1. 11篇推荐系统入门必读经典论文(附下载链接)

    推荐系统入门必读的11片经典论文,包含了召回.排序.模型融合相关技术,本篇文章列举出了每篇论文的摘要,最后附上了下载链接. 01. Cheng et al. - 2016 - Wide & D ...

  2. 推荐系统入门必读:一文读懂推荐系统负采样

    ©作者 | 潘星宇 学校 | 中国人民大学硕士生 研究方向 | 推荐系统 推荐系统负采样作为推荐模型训练的重要一环,对模型的训练效果有着重要影响,也是推荐系统领域的一个重要研究分支.本文将从研究背景到 ...

  3. 工业界推荐系统必读论文:基于深度学习的推荐模型——DLRM

    作者丨纪厚业 单位丨北京邮电大学博士生 研究方向丨异质图神经网络及其应用 引言 推荐系统尤其是深度推荐系统已经在工业界得到了广泛应用,尤其是在电商场景下(如淘宝和京东的商品推荐).一个好的工业级推荐系 ...

  4. 【每周CV论文】深度学习文本检测与识别入门必读文章

    欢迎来到<每周CV论文推荐>.在这个专栏里,还是本着有三AI一贯的原则,专注于让大家能够系统性完成学习,所以我们推荐的文章也必定是同一主题的. 文本检测和识别是计算机视觉的一个非常重要的应 ...

  5. Github星标超3k的推荐系统入门资料合集(含教程、论文、代码、数据)

    本篇文章是对公众号<机器学习与推荐算法>历史文章的汇总以及对干货内容的梳理,力争把最全面的干货与最完整的知识体系以最清晰的方式呈现给大家,希望大家能够精准快速地获取到自己想学习的内容,尽到 ...

  6. 机器学习 TOP 10 必读论文 | 资源

    来源:AI科技大本营 编辑 | Donna Medium上的机器学习深度爱好者必关注的账号Mybridge照例对11月发表的学术论文进行了排名,整理出了10篇必读论文,建议收藏深读. 1. Alpha ...

  7. 机器学习 TOP 10 必读论文

    Medium上的机器学习深度爱好者必关注的账号Mybridge照例对11月发表的学术论文进行了排名,整理出了10篇必读论文,建议收藏深读. 1. Alpha Zero:用强化学习算法对中国象棋和国际象 ...

  8. Flink 基本原理与生产实践分享【入门必读,概念清晰】

    Flink 基本原理与生产实践分享[入门必读,概念清晰] https://zh.wikipedia.org/zh-hans/Apache_Flink Apache Flink是由Apache软件基金会 ...

  9. @即将开学的你,请收好这份必读论文清单

    在碎片化阅读充斥眼球的时代,越来越少的人会去关注每篇论文背后的探索和思考. 在这个栏目里,你会快速 get 每篇精选论文的亮点和痛点,时刻紧跟 AI 前沿成果. 点击本文底部的「阅读原文」即刻加入社区 ...

最新文章

  1. 单页面与多页面的区别及优缺点
  2. 阿里三面让我现场改造Spring框架,明天带他去爬山!
  3. 局域网屏幕共享软件 推荐_局域网共享软件,详细教您局域网共享软件如何使用...
  4. Python的Django框架中forms表单类的使用方法详解
  5. java util 中set,List 和Map的使用
  6. ORDER BY分类
  7. dicom worklist下载病例程序/dicom worklist scu (c#版本)
  8. LDN蓝牙双模键盘驱动和固件更新日志
  9. 电脑分屏操作,提高工作和学习效率
  10. a59s刷机包卡刷 oppo_OPPOA59S刷机包_线刷包_救砖包_官方ROM包_固件包下载- 线刷宝ROM中心...
  11. autojs字符串中提取数字
  12. Qt QtabWidget设置背景色 设置标题栏颜色
  13. Django:get() returned more than one Session -- it returned 8
  14. [每周心学]示弟立志说(附译文)
  15. 【Netty官方文档翻译】引用计数对象(reference counted objects)
  16. Python pyecharts地理数据可视化 绘制地理图表
  17. 释疑:SI-RNTI,C-RNTI,P-RNTI,RA-RNTI,SPS-RNTI
  18. N打头的股票是什么意思?
  19. html class函数,wordpress函数sanitize_html_class()用法示例
  20. 10 个超极好用的 VS Code 神级插件,每个程序员必备!

热门文章

  1. 【LeetCode】【HOT】4. 寻找两个正序数组的中位数(二分查找)
  2. Java的四种引用方式
  3. vue 路由懒加载,组件异步加载
  4. 使用mybatis-spring-boot-starter如何打印sql语句
  5. MySQL常用查询语句积累
  6. 营销心理学:如何挣女人的钱?
  7. C#框架提供的几种数据结构对单值查找的效率比较
  8. bootstrapTable表格表头换行
  9. 匹配IP的正则表达式
  10. JavaBeginnersTutorial 中文系列教程·翻译完成