Comments (2)
不是非常理解你的思路。这段代码中probDistribution保存了点curElement所有邻接点的概率,这个概率是提前处理好的,总和为1的概率。
randomDouble选择了一个0-1之间的随机数。
然后剩下的过程类似于一个转盘的游戏,randomDouble是一个随机数指针,然后指到哪个邻接点的概率区间,就选择哪个邻接点,这个过程应该是充分利用了邻接点的概率分布,而且是完全随机的。
你说的方式np.random.choice(adj_nodes, node_distributions) 应该也是可行的,但二者的过程应该是完全等价的,效率问题要看np.random.choice函数的具体内部实现。
from sparrowrecsys.
应该是我理解错了,我试了下代码,老师的代码跟np.random.choice采样结果基本是一样的,而且速度要快40倍左右,相当意外了👍
from sparrowrecsys.
Related Issues (20)
- 直接运行scala文件报错 HOT 3
- DeepFM.py 运训报错 HOT 1
- 运行FeatureEngForRecModel.py报错
- 一些不合理的地方? HOT 6
- tensorflow/serving上线问题 HOT 2
- 运行时报错
- ERR wrong number of arguments for 'hset' command HOT 1
- 请教下关于FM如何处理序列的问题 HOT 1
- DIEN模型的loss为负数
- 执行FeatureEngineering 报错 HOT 1
- 向量文件写不进来
- 个性化推荐代码在哪里啊? HOT 2
- DIEN中 auxiliary_loss_layer实现疑问
- 提示程序包不存在 HOT 2
- WARNING:tensorflow:Layers in a Sequential model should only have a single input tensor, but we receive a <class 'collections.OrderedDict'> input
- 主页上面的的搜索框为什么失效呀,我输入什么内容搜索完都还是跳转回主页 HOT 1
- 如何设置用户推荐模型为“"nerualcf"”
- graph embedding中transitionCountMatrix的计算问题
- 抄袭问题 HOT 3
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 sparrowrecsys.