技术标签: 机器学习 纹身流 神经网络 凯拉斯 Conv-Neural网络
我试图修改可用的keras示例pretrate_word_embeddings 这里 我面临着以下问题:如果我减少了 MAX_SEQUENCE_LENGTH varibae例如 95 值我会收到以下错误:
回溯(最近调用最后):文件“C:\ Program Files \ Anaconda3 \ lib \ site-packages \ tensorflow \ python \ framework \ common \ common_shapes.py”,第670行,在_call_cpp_shape_fn_impl状态)文件“c:\ program files \ anaconda3 \ lib \ contextlib.py“,第66行, 出口 下一个(self.gen)文件“c:\ program files \ anaconda3 \ lib \ site-packages \ tensorflow \ python \ framework \ errors_impl.py”,line 469,line_exception_on_not_ok_status pywrap_tensorflow.tf_getcode(status))tensorflow.python.framework .errors_impl.invalidargumentError:通过输入形状从2个从2个从2个中减去5引起的负尺寸大小:[?,2,1,128],[5,1,128,128]。
如果我例如需要使用像推发等小消息时,我需要更改它。我使用tensorflow后端。
请帮我澄清1)问题是什么 MAX_SEQUENCE_LENGTH还2)是什么原因 Conv2D_2 在追踪而不是 Conv1D 我在模型中使用。
让我们通过网络定义并分析图层输出的形状 MAX_SEQUENCE_LENGTH=95:
sequence_input = Input(shape=(MAX_SEQUENCE_LENGTH,), dtype='int32')
embedded_sequences = embedding_layer(sequence_input)
# Output shape: (95, EMBEDDING_DIM)
x = Conv1D(128, 5, activation='relu')(embedded_sequences)
# Output shape: (91, 128) (because of valid border mode)
x = MaxPooling1D(5)(x)
# Output shape: (18, 128)
x = Conv1D(128, 5, activation='relu')(x)
# Output shape: (14, 128)
x = MaxPooling1D(5)(x)
# Output shape: (2, 128)
x = Conv1D(128, 5, activation='relu')(x)
# Output shape: (2 - 4??, 128) - PROBLEM!!
x = MaxPooling1D(35)(x) # In the easiest way - change 35 to 2.
x = Flatten()(x)
x = Dense(128, activation='relu')(x)
preds = Dense(100, activation='softmax')(x)
正如你可能看到这个问题在于最后一个 Conv1D 没有足够维度的层来施加卷积 valid 边界模式。有很多方法如何解决这个问题。最简单的是裁剪最后一个 Conv-MaxPool DUO并将网络定义更改为:
sequence_input = Input(shape=(MAX_SEQUENCE_LENGTH,), dtype='int32')
embedded_sequences = embedding_layer(sequence_input)
# Output shape: (95, EMBEDDING_DIM)
x = Conv1D(128, 5, activation='relu')(embedded_sequences)
# Output shape: (91, 128) (because of valid border mode)
x = MaxPooling1D(5)(x)
# Output shape: (18, 128)
x = Conv1D(128, 5, activation='relu')(x)
# Output shape: (14, 128)
x = MaxPooling1D(5)(x)
# Output shape: (2, 128)
x = Flatten()(x) # Here - everything is ok.
x = Dense(128, activation='relu')(x)
preds = Dense(100, activation='softmax')(x)
当然 - 还有更多的方法来做这件事(如玩池尺寸等)。
使用背后的原因 Conv2D 来自这样的事实 TensorFlow 后端A. Conv1D 由二维卷积实现,一个维度挤压为具有大小 1.
问题描述 使用ng new hello-angular命令创建 angular 应用; 使用 VSCode 打开hello-angular应用,在终端中执行ng serve命令,报错如下: 解决办法 第一次使用 VSCode,默认使用的 powershell 执行命令,在 powershell 中禁止执行ng.ps1脚本文件。 使用 windows 的 cmd 时,可以正常执行ng serve -...
Query Expansion Using Word Embeddings 论文解读 整体思想 基于word2vec挖掘查询词和扩展词之间的相关性 搜索词和扩展词相关性 基于极大似然估计的查询词和扩展词之间的相关性 基于伪反馈的关联模型 整体思想 作者利用word2vec来挖掘查询词和扩展词之间的相关性;除此以外,为了弥补word2vec向量相似性的不足,引入了一些规则算法,例如:最大似然概率和基...
论文地址: https://www.ijcai.org/Proceedings/15/Papers/185.pdf 要点 一词多义, 或者单词的意思应该随上下文而定, 学者们老早就意识到了, 本文就提供了一种思路. 如题所示, 本文旨在赋予 word embeddings 上下文的感知能力, 借助了 Neural Tensor 这样一个特殊的网络结构. 具体来说, 作者区分了不同 topic 下同...
NLP学习 更新流程↓ Task 1: 简介和词向量Word Vectors Task 2: 词向量和词义Word Senses Task 3: 子词模型Subword Models Task 4: Contextual Word Embeddings Task 5: 大作业 日本人综艺感从昭和时代开始就这么强了吗? 今日份的舒适 常见餐桌礼仪 Contextual Word Embed...
目录 Introduction to Word Embeddings Word Representation Using word embeddings Properties of word embeddings Embedding matrix Learning Word Embeddings:Word2vec & GloVe Learning word embeddings Word2...
如何让电脑识别图片, 图一通过CNN, 然后转化为一个fully-connected 向量表示所有的pixel。那么如何让计算机分析句子, 就需要用到同样的原理, 如果人类要理解一句话, 这句话并非你了解的语言,那么需要通过查字典来解决, 字典把每个单词按照字母顺序编排好, 然后我们按照单词顺序查询每个单词的意思即可。对于计算机, 是无法识别字母的, 可以通过把词向量转化为数字向量来代表。 如上图...
来源:Coursera吴恩达深度学习课程 我们将要学习一些具体的算法来学习词嵌入(learning word embeddings)。从稍微复杂一些的算法开始,因为Andrew觉得这样更容易对算法的运作方式有一个更直观的了解,之后我们会对这些算法进行简化,我们开始吧。 假如你在构建一个语言模型(language model),并且用神经网络(neural network)来实现这个模型。于是在训练...
金属-氧化物-半导体(MOS)场效应管 N沟道增强型MOSFET 栅源加电压,在电场作用下产生沟道。产生沟道的门限开启电压VT。 漏源加电压,产生电压梯度,导致沟道夹断。预夹断的临界条件 输出特性 特性方程 可变电阻区 &...
提到响应式,就不得不提两个响应式框架——bootstrap和foundation。在标题上我已经说明白啦,今天给大家介绍的是foundation框架。 何为“尝鲜”?就是带大伙初步一下foundation的灵活和强大 何为“踩坑”?就是我把我使用的时候踩过的坑给标个记号,这样大伙用的时候就可以“绕道而...
word2vec 词向量 one hot Distributed representation CBOW&Skip-Gram CBOW Skip-Gram sigmoid函数 Huffman树 基于Hierarchical Softmax的模型 基于Negative Sampling的模型 本文基于word2vec原理CBOW与Skip-Gram模型基础 CBOW与Skip-Gram的模型...
It keeps saying : ORA-00933: SQL command not properly ended Pls help me or give me a link to a solution You can use a correlated subquery instead:...
I'm doing an Json call to retrieve an a list of locations with information details for each location. longitude and latitude are included in this info. I am using Google's distance matrix api to get t...
Suppose you have a database which has an 'n' number of schemas with an 'n' number of tables each. Each of these contain an 'n' number of columns. How would I print all this data along with the data ty...
Could anyone please help how do I solve this error: I am using IDEA IDE as a first time, and have been using Resin_4.0.37 as a server to test my work. As soon as I start my lcoal server in debug mode ...
i am trying to develop a remote desktop apps with c#. so i have couple of question regarding mouse coordinate calculation based on picture box suppose i have picture box and i want to capture mouse co...