How can I get biases from a trained model in Keras?

后端 未结 2 1163
挽巷
挽巷 2020-12-06 06:50

I have built a simple neural network,

model = Sequential()
model.add(Dense(20, input_dim=5, activation=\'sigmoid\'))
model.add(Dense(1, activation=\'sigmoid\         


        
2条回答
  •  遥遥无期
    2020-12-06 07:18

    Quite simple, its just the second element in the array returned by get_weights() (For Dense layers):

    B_Input_Hidden = model.layers[0].get_weights()[1]
    B_Output_Hidden = model.layers[1].get_weights()[1]
    

提交回复
热议问题