[Udemy] Recommender Systems and Deep Learning in Python
1. Welcome
主要讲四部分内容:
non-personized systems
popularity: 基于流行度或者最大利益化的推荐。 缺点也明显:你可能在特殊地方有些特殊需求, 或者你本来就是大多数人不一样
Association: 找出订单里一起下单的物品的相关性,一般有Aproiri, FP 等算法
collaborative filtering
matrix factorization (and its variant like probablistic matrix factorization), also known as SVD
Deep learning

2. Simple recommentation systems
基于popularity 的推荐要考虑时效性,比如一则新闻虽然曾经是爆炸性的阅读量很多,但是不合适出现新闻的推荐中,这就需要在popularity 和 age(时间老化) 之间做平衡.

具体地,Hacker News 网站用的公式为:也叫 rank formula

另一个具体的例子是Reddit:

如果平均值一样,那么需要考虑rating 个数,可以参考下面公式:

google 的 PageRank 算法是基于 Markov 模型的. Markov 模型就是NLP里面的unigram, bigram 的概念,基于前面的条件算出后面结果出现的概率.

怎么评估 Rank 结果

3. Collaborative Filtering
user-user CF - based on user-user similarity
item-item CF - based on item-item similarity
参考资料[2] 里面有具体的代码,不过不是矩阵实现,最好看我翻译的另一篇文章 Comprehensive Guide to build a Recommendation Engine from scratch (in Python) / 从0开始搭建推荐系统, 这里有矩阵实现, 更快而且我觉得更明白.
4. Matrix Factorization & Deep Leanring
4.1 Matrix Factorization
1. 先来个最basic 版的matrix factorization 的公式,就是把矩阵X分解成 X=WU. metric 用 Sum Squere Error.

2. 再考虑 bias, user bias 和 item bias


3. formulas: with regularization


4. MF with SVD, 确定是不能有missing data (MF 和SVD 很相似,MF有两个矩阵U和V, SVD 有3个 U,S,V)

5. Probabilistic Matrix Factorization, 没看懂,只能拷些图片在这里了



6. Bayesian Matrix Factorization, 也没看懂,讲者说是optional 就不看了
7. matrix factorization in Keres
# keras model
u = Input(shape=(1,))
m = Input(shape=(1,))
u_embedding = Embedding(N, K, embeddings_regularizer=l2(reg))(u) # (N, 1, K)
m_embedding = Embedding(M, K, embeddings_regularizer=l2(reg))(m) # (N, 1, K) # subsubmodel = Model([u, m], [u_embedding, m_embedding])
# user_ids = df_train.userId.values[0:5]
# movie_ids = df_train.movie_idx.values[0:5]
# print("user_ids.shape", user_ids.shape)
# p = subsubmodel.predict([user_ids, movie_ids])
# print("p[0].shape:", p[0].shape)
# print("p[1].shape:", p[1].shape)
# exit() u_bias = Embedding(N, 1, embeddings_regularizer=l2(reg))(u) # (N, 1, 1)
m_bias = Embedding(M, 1, embeddings_regularizer=l2(reg))(m) # (N, 1, 1)
x = Dot(axes=2)([u_embedding, m_embedding]) # (N, 1, 1) # submodel = Model([u, m], x)
# user_ids = df_train.userId.values[0:5]
# movie_ids = df_train.movie_idx.values[0:5]
# p = submodel.predict([user_ids, movie_ids])
# print("p.shape:", p.shape)
# exit() x = Add()([x, u_bias, m_bias])
x = Flatten()(x) # (N, 1)
model = Model(inputs=[u, m], outputs=x)
model.compile(
loss='mse',
# optimizer='adam',
# optimizer=Adam(lr=0.01),
optimizer=SGD(lr=0.08, momentum=0.9),
metrics=['mse'],
)
4. 2 Deep Learning
1. 在matrix factorization 上加了deep network, 形成的 deep learning. 前面讲的 matrix factorization 只是linear model, deep learning 会提供 non-linear 能力,所以理论上比只有前面棕色部分(matrix factorization部分)好

2. 还可以先分支网络,然后再合并,课程里叫 residual, 我觉得不是computer vision里面的 resnet 的概念.

3. 还可以用 AutoEncoder (AutoRec), 这个算法本来是用来复原图片的. model.fit(X, X) not model.fix(X, Y).

AutoRec 比deep learning 快,原因如下

AutoRec 算法要注意一个问题,因为这个算法是用来反推输入X的,输出就是预测的输入,所有网络可能会直接copy back, 有欺骗性。因此,我们不能直接用 test_set 来预测 test_set 的输出,而是用train_set 来预测test_set, 看下面代码


5. Retricted Boltzmann Machines (RBMs) for Collaborative Filtering
受限波兹曼机(RBMs)是波兹曼机的简化版,不是全部连接,只需要 visible nodes 和 hidden nodes 连接就行.

确实有点点难懂...
Others:
Explore-Exploit dilemma 概念: 比如,你在youtube上看视屏学炒鸡蛋,你看了很多视屏学会了炒鸡蛋,结果因为看的视屏多,在你学会了炒鸡蛋过后youtube还是老是给你推荐炒鸡蛋视屏,这就是explore-exploit dilemma, 数据越多结果越差.
Ref:
- [Udemy] Recommender Sytem and Deep Learning in Python
- https://github.com/mashuai191/machine_learning_examples/tree/master/recommenders
- 谷歌PageRank算法简单解释
[Udemy] Recommender Systems and Deep Learning in Python的更多相关文章
- Machine and Deep Learning with Python
Machine and Deep Learning with Python Education Tutorials and courses Supervised learning superstiti ...
- Conclusions about Deep Learning with Python
Conclusions about Deep Learning with Python Last night, I start to learn the python for deep learn ...
- Deep learning with Python 学习笔记(11)
总结 机器学习(machine learning)是人工智能的一个特殊子领域,其目标是仅靠观察训练数据来自动开发程序[即模型(model)].将数据转换为程序的这个过程叫作学习(learning) 深 ...
- Deep learning with Python 学习笔记(10)
生成式深度学习 机器学习模型能够对图像.音乐和故事的统计潜在空间(latent space)进行学习,然后从这个空间中采样(sample),创造出与模型在训练数据中所见到的艺术作品具有相似特征的新作品 ...
- Deep learning with Python 学习笔记(9)
神经网络模型的优化 使用 Keras 回调函数 使用 model.fit()或 model.fit_generator() 在一个大型数据集上启动数十轮的训练,有点类似于扔一架纸飞机,一开始给它一点推 ...
- Deep learning with Python 学习笔记(8)
Keras 函数式编程 利用 Keras 函数式 API,你可以构建类图(graph-like)模型.在不同的输入之间共享某一层,并且还可以像使用 Python 函数一样使用 Keras 模型.Ker ...
- Deep learning with Python 学习笔记(7)
介绍一维卷积神经网络 卷积神经网络能够进行卷积运算,从局部输入图块中提取特征,并能够将表示模块化,同时可以高效地利用数据.这些性质让卷积神经网络在计算机视觉领域表现优异,同样也让它对序列处理特别有效. ...
- Deep learning with Python 学习笔记(6)
本节介绍循环神经网络及其优化 循环神经网络(RNN,recurrent neural network)处理序列的方式是,遍历所有序列元素,并保存一个状态(state),其中包含与已查看内容相关的信息. ...
- Deep learning with Python 学习笔记(5)
本节讲深度学习用于文本和序列 用于处理序列的两种基本的深度学习算法分别是循环神经网络(recurrent neural network)和一维卷积神经网络(1D convnet) 与其他所有神经网络一 ...
随机推荐
- AcWing 154. 滑动窗口(模板)
(https://www.acwing.com/problem/content/156/) 给定一个大小为n≤106n≤106的数组. 有一个大小为k的滑动窗口,它从数组的最左边移动到最右边. 您只能 ...
- 如何设置 ComboBox 下拉列表的高度或间距
ComboBox 的下拉列表部分总是很挤,看起不舒服,但是设置了 ItemHeight 没用,怎么办呢? 首先设置一个较大的 ItemHeight 值,比如 20: 然后设置 ComboBox 的 D ...
- 阿里开源框架-JarsLink-【JAVA的模块化开发框架】
JarsLink (原名Titan) 是一个基于JAVA的模块化开发框架,它提供在运行时动态加载模块(一个JAR包).卸载模块和模块间调用的API. 需求背景 应用拆分的多或少都有问题.多则维护成本高 ...
- 2018-8-10-xaml-添加-region
title author date CreateTime categories xaml 添加 region lindexi 2018-08-10 19:16:51 +0800 2018-03-15 ...
- 07.SUSE Linux 系统本地yum源配置
SUSE Linux 系统 1.新建本地源存储目录root@suse:mkdir /mnt/SUSE_LOCAL_SOURCE 2.创建zypper本地源root@suse:zypper ar fil ...
- springboot通过继承OncePerRequestFilter,在拦截器中@Autowired 为null问题
springboot2版本以上环境 通过继承OncePerRequestFilter类,在重写doFilterInternal方法实现拦截的具体业务逻辑, 在实现的过程中,需要注入service方法, ...
- 文本框的pattern属性
代码实例: test.html <!DOCTYPE html><html lang="en"><head> <meta charset=& ...
- bzoj5015 [Snoi2017]礼物 矩阵快速幂+二项式展开
题目传送门 https://lydsy.com/JudgeOnline/problem.php?id=5015 题解 设 \(f_i\) 表示第 \(i\) 个朋友的礼物,\(s_i\) 表示从 \( ...
- sed 搜索并替换
find . -type f -exec sed -i "s/std=c++11/std=c++14/g" {} \; 搜索当前目录下的文件,把std=c++11替换成std=c+ ...
- hdu 4717: The Moving Points 【三分】
题目链接 第一次写三分 三分的基本模板 int SanFen(int l,int r) //找凸点 { ) { //mid为中点,midmid为四等分点 ; ; if( f(mid) > f(m ...
