![](/img/trans.png)
[英]Introduction to Deep Learning with Keras: 'X_train' is not defined?
[英]Introduction part in Deep Learning with Keras using Python
問題指導:
下面是我的代碼:
# Instantiate a Sequential model
model = Sequential()
# Add a Dense layer with 50 neurons and an input of 1 neuron
model.add(Dense(50, input_shape=(2,), activation='relu'))
# Add two Dense layers with 50 neurons and relu activation
model.add(Dense(____,____=____))
model.____
# End your model with a Dense layer and no activation
model.____
我對這部分感到困惑
model.add(Dense(____,____=____))
在model.add(Dense(___,___=___))
中,您有三個空白。 第一個用於提及神經元的數量,第二個用於表示您想要設置一些activation
值,第三個用於將該值設置為relu
。
所以你會得到model.add(Dense(50,activation='relu'))
更多信息可以在密集層文檔中找到。
在文檔中,Dense 層唯一需要的參數是units
,即神經元的數量。 默認激活 function 是None
,所以如果你希望它是"relu"
,請執行activation="relu"
。
總之,這是一段代碼,它創建了一個具有 50 個神經元並激活為relu
的 Dense 層:
model.add(Dense(50, activation="relu"))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.