princewen / tensorflow_practice Goto Github PK
View Code? Open in Web Editor NEWtensorflow实战练习,包括强化学习、推荐系统、nlp等
tensorflow实战练习,包括强化学习、推荐系统、nlp等
In line 90, why tf.norm(), maybe tf.square() ??
请问目录recommendation/GBDT+LR-Demo里,gbdt部分是在训练集上获得,LR是在测试集做的。是不是LR也得在训练集上做啊?
因为在虽说GBDT和LR是分开的两个阶段,但是作用的数据应该是一个啊,那自然是训练数据啊。
在RL/Basic-DRQN-Demo/DRQN.py 中,下面三行报错。
from helper import updateTargetGraph,updateTarget,processState,saveToCenter
from gridworld import gameEnv
env = gameEnv(partial=True,Size = 9)
train_source = source_int[batch_size:]
train_target = source_int[batch_size:] <<<<<<<<<
for i in range(len(full_data)):
u = full_data['user'][i]
t = full_data['user'][i]
应该改成
for i in range(len(full_data)):
u = full_data['user'][i]
t = full_data['item'][i]
第33,35行是不是没有意义
full_data['item'] = full_data['item'].map(lambda x:item_map[x])
item_set = set(full_data.item.unique())
是FM中使用的MovieLens100k Datase或者是NCF原来那篇paper中的数据集吗?
在tensorflow_practice/nlp/chat_bot_seq2seq_attention/predict.py 文件中,
from data_helpers import loadDataset, getBatches, sentence2enco
请问data_helpers这个文件在哪里,没有找到。恳请回复,万分感谢。
#代码中你说用的 td_error 的 actor-critic 算法,但实际算actor的gradient时,你用的是q而不是td_error, 修改如下
def learn(self, s, a, r, s_):
s, s_ = s[np.newaxis, :], s_[np.newaxis, :]
next_a = [[i] for i in range(N_A)]
s_ = np.tile(s_,[N_A,1])
q_ = self.sess.run(self.td_error, {self.s: s_,self.a:next_a})
q_ = np.max(q_,axis=0,keepdims=True)
q, _ = self.sess.run([self.q, self.train_op],
{self.s: s, self.q_: q_, self.r: r,self.a:[[a]]})
return q
发现一些小错啊?
比如:
train.py 中的
“model.restore(sess, ckpt.model_checkpoint_path)”
应改为:
"model.saver.restore(sess, ckpt.model_checkpoint_path)"
predict.py 中的
from data_helpers import loadDataset, getBatches, sentence2enco
应改为:
from data_loader import loadDataset, getBatches, sentence2enco
predict跑起来还有其它一屏又一屏的错,我只是想问一下楼主,是否真能跑起来?
basic-nfm-demo中的nfm文件类名有误,原文件是afm,应该为NFM,否则main运行报错
楼主麻烦问个问题~ SESSION-BASED RECOMMENDATIONS WITH RECURRENT NEURAL NETWORKS 这篇论文讲的模型,输入序列 x=[x1,x2,x3...xr-1,xr],是只有最后一个商品输入之后才有输出,还是输入x1, 有一个输出,预测x2, 再输入x2,预测x3
如题
你好,DIEN例子中,_like_rnncell这个API失效了,麻烦问下怎么改,换成什么了
我运行Basic-PNN-Demo/main.py出现如下错误:
y_train_pnn, y_test_pnn = run_base_model_pnn(dfTrain, dfTest, folds, pnn_params)
TypeError: 'NoneType' object is not iterable
望大佬解答
您好,您的代码的GMF和MLP融合的时候,concat(gmf,mlp)这部分,gmf的列是embdding_size,mlp的列维度是embdding_size/2.为什么要这样设置呢,直觉上应该是列的维度一致才可以,请指教一下。谢谢。
您好,我使用tf中的BeamSearchDecoder,出现了predict_id为-1的情况,请问您出现过这种情况吗?
有些demo中的数据没有,例如GBDT_LR中的data就没有
self.all_logits = tf.reduce_sum(tf.multiply(self.u_embedding,self.item_embeddings),1) + self.item_bias
这里是不是有问题?应该是self.i_embedding
emm in dis.py.131, the L2 regr has been add to calculate D loss , and maybe the equation is wrong?
self.loss = tf.reduce_mean(losses) + self.l2_reg_lambda + self.l2_loss
it should be:
self.loss = tf.reduce_mean(losses) + self.l2_reg_lambda * self.l2_loss
首先谢谢作者的贡献
v_s_ = r + GAMMA * v_s_ # 使用v(s) = r + v(s+1)计算target_v
tensorflow_practice/RL/Basic-A3C-Demo/A3C.py
Line 127 in 6fea88c
我有一个提供文献检索的系统,想做一下文献推荐方面的工作。但是我只记录了用户下载文献的信息,就是可用的信息只有:
1.用户信息(用户ID)
2:文献信息(标题、关键词、摘要......)
3:下载信息(用户下载了哪篇文献)
如何利用上面这些信息实现有效的文献推荐呢?还望能够提供一些建议,谢谢。
`def simple_test_one_user(x):
rating = x[0]
u = x[1]
test_items = list(all_items - set(user_pos_train[u]))
item_score=[]
for i in test_items:
item_score.append((i,rating[i]))
item_score = sorted(item_score,key=lambda x:x[1])
item_score.reverse()
item_sort = [x[0] for x in item_score]`
关于上面这段代码里的x是一个什么样的形式
item_score.append((i,rating[i])) item_sort = [x[0] for x in item_score]`` 从上面这两句里面看,x应该是{(i,rating[i])}的形式,i是不是items,后面的是评分,而一开始定义的
rating = x[0] ,u = x[1]`,所以这里不是太懂,x是什么 样的形式,x[0],x[1]又是代表什么,不知道能不能给解释下,谢谢
非常感谢作者的分享
我在用recommendation/Basic-DeepFM-model算法的时候,随着训练迭代次数的增加,train-result的分数越来越高,可以到92,而valid-result的分数越来越低,低至50 。跪求各位大佬的解答
output_layer = Dense(target_vocab_size,kernel_initializer=tf.truncated_normal_initializer(mean=0.1,stddev=0.1))
少一个input吧?
OSError: TransE_entity2vec_50.vec not found.
Will it work on Windows
您代码中的epsilon似乎只在建网络的时候加了,每次训练结束都没有抽样新的扰动,这是不是跟原文算法并不相符?
dataloader里 为什么要设dfv[col] = 1啊
你好,TransE_entity2vec_50.vec 这个是哪块生成的?看了下所有代码里面都不涉及生成这个,但是kg_preprocess.py需要读取。
我想请教下,FM那个模型,数据特征处理的核心**是啥?
Resource exhausted: OOM when allocating tensor with shape[312030,128,10,1] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
batch_size极小在4GRAM还是不行吗
ix[str(lis[t]) + str(k)] = ix.get(str(lis[t]) + str(k), len(ix)) 这样写才是正确的
Hi!
Thank you for your contribution.
I think the 'all_act' in this line should be 'self.all_act_prob'. Please correct me if I was wrong!
line 78 in RL_brain.py
您好,请问这句注释是不是说:
当训练时由docode_target得到的decode_Input包括go但不包括eos,形如[go_id, word1_id, word2_id, ...]
训练结束后计算loss时decode_target的每个句子包括eos但不包括go,形如[word1_id, word2_id, ..., eos_id]
另外,您的embedding遍历是所有词的词向量表,在tf.contrib.seq2seq.BeamSearchDecoder函数中,embedding是不是只要包括了decode_target的词向量即可呢?
非常感谢您的代码分享,谢谢您提供的学习机会!
祝好!
在181-182行,不理解为什么要声明reuse_variable? 博主能不能解答一下啊
ReadMe - 基础 - 卷积神经网络 的超链接失效了
https://github.com/princewen/tensorflow_practice/blob/master/basic/CNN.py
请问怎么使用自己的数据集,对自己的数据集进行扩充呢?
where get data for https://github.com/princewen/tensorflow_practice/tree/master/recommendation
请问MADDPG训练有效果吗?为什么我运行了一下没有效果?谢谢
您好,GBRT+LR有数据集吗?
file
https://github.com/princewen/tensorflow_practice/blob/master/nlp/RNN_dynamic_cell.py
line 75
logits = tf.reshape(tf.matmul(tf.reshape(rnn_outputs,[-1,batch_size]),W)+b,[batch_size,num_steps,num_classes])
此处reshape里面的batch_size是否应该改为state_size ? 因为例子里面batch_size和state_size都等于4,所以未报错,如果令batch_size=5,该行会抛出异常。
您好!
您的NCF的这段代码,创建迭代器,并迭代数据的操作。
#创建迭代器,可以读取不同数据,测试集/训练集
iterator = tf.data.Iterator.from_structure(train_data.output_types,
train_data.output_shapes)
我查了下资料发现这个迭代器每次获取数据的时候,都是从数据的前端获取数据。那这是不是意味着您的代码只利用了部分数据,不知道我的理解对不对?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.