简体   繁体   English

使用Keras创建具有多个输入的NN体系结构

[英]Creating NN architecture with multiple inputs using Keras

I want to create a model with the following architecture: 我要创建一个具有以下架构的模型:

          i_1    i_2     i_3 (3 input nodes)
       h1_1 ..... h1_j ...... h1_n ('n' nodes in 1st hidden layer)
     h2_1 ....... h2_j......... h2_m ('m' nodes in 2nd hidden layer)
                  o         (1 output)

Further Details 更多详情

  1. Each input node has a descriptor vector of constant length (let's say the length for each descriptor vector is 10) 每个输入节点都有一个恒定长度的描述符向量(假设每个描述符向量的长度为10)
  2. I'd like each node in the 1st hidden layer to be "connected" to all 3 input nodes (ie for a weight to exist for each combination of hidden and input node) and for each node in the 2nd hidden layer to be connected to each node in the 1st hidden layer. 我希望将第一隐藏层中的每个节点“连接”到所有3个输入节点(即,对于隐藏和输入节点的每种组合都存在权重)以及第二隐藏层中的每个节点都将连接到第一隐藏层中的每个节点。
  3. The NN is feed-forward NN是前馈

How can I achieve this in Keras? 如何在Keras中实现这一目标?

This looks like a basic feed-forward network: 这看起来像一个基本的前馈网络:

model = Sequential()
model.add(Dense(n, input_dim=3))
model.add(Dense(m))
model.add(Dense(1))

You can specify activation parameters independently for each layer. 您可以为每个层独立指定activation参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM