我具有用於從使用Keras(Theano後端)寫在python 28x28px圖像檢測手寫數字的簡單神經網絡模型:Keras model.summary()結果 - 瞭解參數的#
model0 = Sequential()
#number of epochs to train for
nb_epoch = 12
#amount of data each iteration in an epoch sees
batch_size = 128
model0.add(Flatten(input_shape=(1, img_rows, img_cols)))
model0.add(Dense(nb_classes))
model0.add(Activation('softmax'))
model0.compile(loss='categorical_crossentropy',
optimizer='sgd',
metrics=['accuracy'])
model0.fit(X_train, Y_train, batch_size=batch_size, nb_epoch=nb_epoch,
verbose=1, validation_data=(X_test, Y_test))
score = model0.evaluate(X_test, Y_test, verbose=0)
print('Test score:', score[0])
print('Test accuracy:', score[1])
這運行良好,準確度達到〜90%。然後我執行以下命令,通過執行print(model0.summary())
來獲得我的網絡結構的摘要。這輸出以下內容:
Layer (type) Output Shape Param # Connected to
=====================================================================
flatten_1 (Flatten) (None, 784) 0 flatten_input_1[0][0]
dense_1 (Dense) (None, 10) 7850 flatten_1[0][0]
activation_1 (None, 10) 0 dense_1[0][0]
======================================================================
Total params: 7850
我不明白他們是如何得到7850總參數,這實際上是什麼意思?
謝謝!爲什麼與偏見有一個重要的聯繫?它的目的是什麼? – user3501476