Comments (1)
函数参数 x 和最后的列表解析式中的 x 意义是不同的。
simple_test_one_user 中的 x 为 (user 对所有 item 的评分,user)
item_scores 中的每一个 element 是 (item, item 对应的 score), 即在 item_sort = [x[0] for x in item_score] 中 x[0] 是指 item,x[1] 指 item 对应的 score。
所以这一部分代码的意思如下:
def simple_test_one_user(x):#
rating = x[0] # user 对所有 item 的评分
u = x[1] # user
test_items = list(all_items - set(user_pos_train[u])) # 删除user 已经购买过的 item
item_score=[]
for i in test_items:# test_items 中的元素是 item 和 item 对应的 score 组成的 pair,即(item_id, item_score)
item_score.append((i,rating[i]))
item_score = sorted(item_score,key=lambda x:x[1])# 将上述 pairs 按照 score 进行从小到大排序
item_score.reverse() # 将上述 pairs 按照 score 从大到小排序
item_sort = [x[0] for x in item_score]` # 取出按照 score 从大到小排序过后的所有 item
from tensorflow_practice.
Related Issues (20)
- 请问DKN各位可以运行吗?需要怎样的计算资源?
- Bug in RL/Policy_Gradient/RL_brain.py
- gbdt+lr问题
- DKN中数据预处理,TransE.cpp无法运行 HOT 2
- DCG的问题
- 这个变量应该设置成trainable=False
- 这块应该每次进来重新置0吧
- FFM这个实现有问题吧. 这个值每次都会被更新吧
- tensorflow_practice/basic/Basic-Transformer-Demo/训练问题
- A2C 数据集在百度网盘上被屏蔽了
- 数据集链接挂了 HOT 15
- deepfm篇您用的哪里的数据集 可以分享下么
- 有数据集的老哥分享一下 这个链接挂了 HOT 1
- dataset失效了 HOT 2
- 请问一下Rainbow里面环境的问题
- maddpg算法有一些问题
- 给所有需要data的朋友 HOT 1
- 请问FFM代码的tf.squeeze 为啥要把维度是一的数据删去,不是很明白
- AC算法的critic网络不对吧?应该用v计算td_error,r + gamma * q是啥?
- 数据集连接可以分享下吗
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tensorflow_practice.