<p>Unfortunately, batch size is a hyper parameter you will have to learn by cross validation.  In practice, start with a very large number (1024) and then half it until you see performance improve.</p>

<p>There are also a few papers that show that the optimal learning rate and batch size are roughly inversely correlated: <a href="https://arxiv.org/abs/1711.00489" rel="nofollow noreferrer">https://arxiv.org/abs/1711.00489</a></p>
Keras - LSTM Optimal Batch Size
<p>In an LSTM network I'm passing as feature an array of the form </p>

<pre><code>X.shape 
    (350000, 240, 1)
</code></pre>

<p>With a binary categorical target of the form</p>

<pre><code>y.shape 
    (350000, 2)
</code></pre>

<p>How can I estimate the optimal batch size to minimize learning time without losing accuracy?</p>

<p>Here's the setup:</p>

<pre><code>model = Sequential()
model.add(LSTM(25, input_shape=(240, 1)))
model.add(Dropout(0.1))
model.add(Dense(2, activation='softmax'))
model.compile(loss="binary_crossentropy", optimizer="rmsprop")
model.fit(X_s, y_s, epochs=1000, batch_size=512, verbose=1, shuffle=False, callbacks=[EarlyStopping(patience=10)])
</code></pre>