2017-09-11 8 views
0

Kerasを使用して、入力層に接続されていても相互に接続されていない、異なる起動機能を持つ隠れた層を作成できますか?Kerasで切断された隠れたレイヤーを作成できますか?

例えば、5ニューロンがReLU活性化を有し、5ニューロンがシグモイド活性化機能を有すると言う10個のニューロンを有する隠れ層。スラブアーキテクチャのニューラルネットワークを作成したいと思います。

答えて

1

2つの別々の密なレイヤーを作成できます。それはそれを行う最も簡単な方法です。

層を分離:

from keras.layers import * 
from keras.models import Model 

#model's input and the basic syntax for creating layers 

inputTensor = Input(some_shape) 
outputTensor = SomeLayer(blablabla)(inputTensor) 
outputTensor = AnotherLayer(bblablabla)(outputTensor) 


#keep creating other layers like the previous one 
#when you reach the point you want to divide: 

out1 = Dense(5,activation='relu')(outputTensor) 
out2 = Dense(5,activation='sigmoid')(outputTensor) 


#you may concatenate the results: 
outputTensor = Concatenate()([out1,out2]) 


#keep creating more layers.... 


#create the model 
model = Model(inputTensor,outputTensor) 
+0

おかげで....それは御馳走を働きました。 – Christie

関連する問題