[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) 与其他所有神经网络一 ...
随机推荐
- SCUT - 274 - CC B-Tree - 树形dp
https://scut.online/p/274 首先要判断是一颗树,并且找出树的直径. 是一棵树,首先边恰好有n-1条,其次要连通,这两个条件已经充分了,当然判环可以加速. 两次dfs找出直径,一 ...
- C# ListView添加DragDrop
先建立好ListView,ImageList,然后编写一个比较类在就是添加DragDrop事件了具体实现看代码吧 public partial class Form1 : Form { public ...
- SQL中的like '%%‘查询
一,我们正常使用like时,这是有两个条件的模糊查询 select *From Test where UserName like '%m%' and UserName like '%a%' 二,但这时 ...
- 27、前端知识点--webpack面试题(二)
webpack面试题总结 本文主要是对webpack面试会常被问到的问题做一些总结,且文章会不断持续更新 1.webpack打包原理 把所有依赖打包成一个 bundle.js 文件,通过代码分割成单元 ...
- VS2015-MFC基础教程-应用程序工程中文件的组成结构
VS2015应用程序向导生成框架程序后,我们可以在之前设置的Location下看到此文件夹中包含了几个文件和一个以工程名命名的子文件夹,这个子文件夹中又包含了若干个文件和一个res文件夹,创建工程时的 ...
- express 设置允许跨域访问
//demo const express = require('express'); const app = express(); //设置允许跨域访问该服务. app.all(’’, functio ...
- 一、Rabbit使用-安装教程
首先我去官网上面下载RabbitMQ安装包:https://www.rabbitmq.com/which-erlang.html 现在下载的版本是3.7.17 因为我erlong安装的是20.3
- VS 2019编辑含有资源文件.resx的项目时提示MSB3086 任务未能使用 SdkToolsPath 或注册表项找到“al.exe”
环境: Win10 X64, VS2019 错误提示: 错误 MSB3086 任务未能使用 SdkToolsPath“”或注册表项“HKEY_LOCAL_MACHINE\SOFTWARE\Micros ...
- python基础--3 列表
#list类#li是list类的一个对象li=[11,22,33,22,44] #参数#在原来值最后进行整个作为元素追加 # li.append((11,22,33))#对列表本身进行操作,appen ...
- 切面AOP的切点@Pointcut用法
格式: execution(modifiers-pattern? ret-type-pattern declaring-type-pattern? name-pattern(param-pattern ...
