lstm

Siamese Model with LSTM network fails to train using tensorflow

十年热恋 提交于 2019-12-08 06:41:04
问题 Dataset Description The dataset contains a set of question pairs and a label which tells if the questions are same. e.g. "How do I read and find my YouTube comments?" , "How can I see all my Youtube comments?" , "1" The goal of the model is to identify if the given question pair is same or different. Approach I have created a Siamese network to identify if two questions are same. Following is the model: graph = tf.Graph() with graph.as_default(): embedding_placeholder = tf.placeholder(tf

Keras set output of intermediate layer to 0 or 1 based on threshold

ぐ巨炮叔叔 提交于 2019-12-08 06:39:31
I have a model that has "classification" and "regression" like parts. I merge them using multiplication layer. Before performing multiplication I want to set outputs of classification part to 0 or 1 based on threshold. I tried to use Lambda layer with custom function as below, however I am facing various errors, and I have no clue about those errors. Resolving them one by one as I go does not add to my understanding. Can anyone explain how to define custom Lambda layer function that modifies the values? My current Lambda layer function: (not working due to FailedPreconditionError: Attempting

Keras set output of intermediate layer to 0 or 1 based on threshold

江枫思渺然 提交于 2019-12-08 06:29:41
问题 I have a model that has "classification" and "regression" like parts. I merge them using multiplication layer. Before performing multiplication I want to set outputs of classification part to 0 or 1 based on threshold. I tried to use Lambda layer with custom function as below, however I am facing various errors, and I have no clue about those errors. Resolving them one by one as I go does not add to my understanding. Can anyone explain how to define custom Lambda layer function that modifies

《Adversarial Transfer Learning for Chinese Named Entity Recognition with Self-Attention Mechanism》阅读

≡放荡痞女 提交于 2019-12-08 05:47:05
《Adversarial Transfer Learning for Chinese Named Entity Recognition with Self-Attention Mechanism》 paper publisher: ACL 2018 方向:NER source code: https://github.com/CPF-NLPR/AT4ChineseNER 摘要 中文NER缺少大量的标注数据。。中文NER和中文分词中间含有大量的相似实体边界,两个任务之间也各有自己的特点。而现有的中文NER模型既没有从CWS中获取到有用的边界信息, 也没有过滤出分词任务的特殊信息。 本文创新点: 提出一种新的对抗迁移学习框架,充分利用共享任务之间的 边界信息同时过滤掉分词任务的特有信息以免干扰NER任务。此外,因为每个字符在进行实体预测时都可以提供非常重要的信息,所以本文还引入了self-attention机制,在预测实体类别时,利用自注意力机制捕捉两个实体之间的长期依赖关系。 引言 task-shared information: CWS和NER之间含有很多共同的信息, 比如希尔顿和离开都是一样的边界信息。 task-specific information:特有的信息。比如休斯顿机场,二者的边界并不一样,NER的边界更为粗粒度。 挑战 : (1

阅读笔记:Adversarial Multi-task Learning for Text Classification [ACL-2017]

一笑奈何 提交于 2019-12-08 05:45:25
【阅读笔记:Adversarial Multi-task Learning for Text Classification】 论文题目:Adversarial Multi-task Learning for Text Classification 作者:Pengfei Liu, Xipeng Qiu and Xuanjing Huang 出处:ACL 2017 论文主要相关:多任务学习、文本分类、情感分析 概要:常规的多任务学习通常单纯的共享某些参数,导致共用特征空间和私有特征空间中存在大量冗余的特征。作者提出了一种 对抗性多任务学习框架 ,缓解了共享特征空间和特定任务特征空间(私有潜在特征空间)之间的相互干扰的问题,并采用 对抗学习 确保共用特征空间中仅存在共用特征和任务无关的特征,辅以 正交约束 来去除私有和共用特征空间中冗余的特征。在16个任务的情感分析测试中,该框架比单任务学习平均效果提升了4.1%,比其他多任务学习框架(FS-MTL、 SP-MTL等)效果更好。并且实验结果表明模型的共享特征学习到的知识,容易被迁移到新任务的情感分析中。 一、待解决问题:特征噪声    1.1 Multi-task Learning   多任务学习是一种有效的借助其他相关任务的帮助来提升单个任务表现的方法

Is there a way to fix the dense layer shape when adding conv2d layer with lstm?

安稳与你 提交于 2019-12-08 05:09:47
问题 I am trying to fit my data into a conv2d+lstm layers but I got an error in the last dense layer i already tried to reshape but it gives me the same error .. and because I am new in python I couldn't understand how to fix my error My model is about combining cnn with lstm layer and i have 2892 training images and 1896 testing images with total 4788 images each image with size 128*128 And here is the final model summary Here some of my code cnn_model = Sequential() cnn_model.add(Conv2D(32, (3,

Tensorflow ValueError: Only call `sparse_softmax_cross_entropy_with_logits` with named arguments

我与影子孤独终老i 提交于 2019-12-08 03:54:44
问题 When calling the following method: losses = [tf.nn.sparse_softmax_cross_entropy_with_logits(logits, labels) for logits, labels in zip(logits_series,labels_series)] I receive the following ValueError: ValueError: Only call `sparse_softmax_cross_entropy_with_logits` with named arguments (labels=..., logits=..., ...) Against this: [tf.nn.sparse_softmax_cross_entropy_with_logits(logits, labels) According to the documentation for nn_ops.py I need to ensure that the logins and labels are

Increasing Label Error Rate (Edit Distance) and Fluctuating Loss?

别说谁变了你拦得住时间么 提交于 2019-12-08 03:28:29
I am training a handwriting recognition model of this architecture: { "network": [ { "layer_type": "l2_normalize" }, { "layer_type": "conv2d", "num_filters": 16, "kernel_size": 5, "stride": 1, "padding": "same" }, { "layer_type": "max_pool2d", "pool_size": 2, "stride": 2, "padding": "same" }, { "layer_type": "l2_normalize" }, { "layer_type": "dropout", "keep_prob": 0.5 }, { "layer_type": "conv2d", "num_filters": 32, "kernel_size": 5, "stride": 1, "padding": "same" }, { "layer_type": "max_pool2d", "pool_size": 2, "stride": 2, "padding": "same" }, { "layer_type": "l2_normalize" }, { "layer_type"

Can you manually set Tensorflow LSTM weights?

[亡魂溺海] 提交于 2019-12-08 03:12:09
问题 I'm exploring using recurrent neural networks to work on unsupervised problems. I would need to set the weights for each gate individually. Is there any way I can do so? Is there anything like this? LSTMCell.Weights['Forget'] = ForgetGateWeights 回答1: Similar question was raised in the issues section in tensorflow. Checkout this discussion https://github.com/tensorflow/tensorflow/issues/3115. 来源: https://stackoverflow.com/questions/42962281/can-you-manually-set-tensorflow-lstm-weights

LSTM architecture in Keras implementation?

萝らか妹 提交于 2019-12-08 01:28:35
问题 I am new to Keras and going through the LSTM and its implementation details in Keras documentation . It was going easy but suddenly I came through this SO post and the comment. It has confused me on what is the actual LSTM architecture: Here is the code: model = Sequential() model.add(LSTM(32, input_shape=(10, 64))) model.add(Dense(2)) As per my understanding, 10 denote the no. of time-steps and each one of them is fed to their respective LSTM cell ; 64 denote the no. of features for each