[PYTHON] About batch_size specified by keras

① Specific example

batch_size is 32 by default.

When X_train.shape = (60000,784),

model.fit(X_train,y_train,epochs=4)

Then (32 because batch_size is not specified)

Epoch 1/4 1875/1875 [==============================] - 2s 840us/step - loss: 0.8699 - accuracy: 0.82040s Epoch 2/4 1875/1875 [==============================] - 2s 811us/step - loss: 0.6358 - accuracy: 0.85760s Epoch 3/4 1875/1875 [==============================] - 2s 829us/step - loss: 0.5283 - accuracy: 0.87400s - loss: Epoch 4/4 1875/1875 [==============================] - 2s 949us/step - loss: 0.4664 - accuracy: 0.88420s - loss: 0.4674 - accuracy:

Results like

This 1875 is a value of 60000/32,

That it was learned with 1875 data

② Specific example

Under the same conditions as above

model.fit(X_train,y_train,epochs=4,batch_size=100)

Epoch 1/4 600/600 [==============================] - 1s 2ms/step - loss: 0.4371 - accuracy: 0.8896 Epoch 2/4 600/600 [==============================] - 1s 2ms/step - loss: 0.4257 - accuracy: 0.8918 Epoch 3/4 600/600 [==============================] - 1s 1ms/step - loss: 0.4156 - accuracy: 0.8934: 0s - loss: 0.4190 - accu Epoch 4/4 600/600 [==============================] - 1s 1ms/step - loss: 0.4065 - accuracy: 0.8949

A result like that appears.

This 600 is a value of 60000/100,

That it was learned with 600 data

Recommended Posts

About batch_size specified by keras
Machine Sommelier by Keras-
About type comparison by PHP
List structure obtained by keras model.get_weights ()
Think about transformation rock-paper-scissors by optimization
Think about menus by combinatorial optimization