What is batch size in neural network? I'm using Python Keras package for neural network. This is the link. Is batch_size equals to number of test samples? From Wikipedia we have this information:

However, in other cases, evaluating the sum-gradient may require
  expensive evaluations of the gradients from all summand functions.
  When the training set is enormous and no simple formulas exist,
  evaluating the sums of gradients becomes very expensive, because
  evaluating the gradient requires evaluating all the summand functions'
  gradients. To economize on the computational cost at every iteration,
  stochastic gradient descent samples a subset of summand functions at
  every step. This is very effective in the case of large-scale machine
  learning problems.

Above information is describing test data? Is this same as batch_size in keras (Number of samples per gradient update)?
 A: When solving with a CPU or a GPU an Optimization Problem, you iteratively apply an Algorithm over some Input Data. In each of these iterations you usually update a Metric of your problem doing some Calculations on the Data. Now when the size of your data is large it might need a considerable amount of time to complete every iteration, and may consume a lot of resources. So sometimes you choose to apply these iterative calculations on a Portion of the Data to save time and computational resources. This portion is the batch_size and the process is called (in the Neural Network Lingo) batch data processing. When you apply your computations on all your data, then you do online data processing. I guess the terminology comes from the 60s, and even before. Does anyone remember the .bat DOS files? But of course the concept incarnated to mean a thread or portion of the data to be used. 
A: The documentation for Keras about batch size can be found under the fit function in the Models (functional API) page

batch_size: Integer or None. Number of samples per gradient update.
  If unspecified, batch_size will default to 32.

If you have a small dataset, it would be best to make the batch size equal to the size of the training data. First try with a small batch then increase to save time. As itdxer mentioned, there's a tradeoff between accuracy and speed.
A: The batch size defines the number of samples that will be propagated through the network.
For instance, let's say you have 1050 training samples and you want to set up a batch_size equal to 100. The algorithm takes the first 100 samples (from 1st to 100th) from the training dataset and trains the network. Next, it takes the second 100 samples (from 101st to 200th) and trains the network again. We can keep doing this procedure until we have propagated all samples through of the network. Problem might happen with the last set of samples. In our example, we've used 1050 which is not divisible by 100 without remainder. The simplest solution is just to get the final 50 samples and train the network.
Advantages of using a batch size < number of all samples:


*

*It requires less memory. Since you train the network using fewer samples, the overall training procedure requires less memory. That's especially important if you are not able to fit the whole dataset in your machine's memory.

*Typically networks train faster with mini-batches. That's because we update the weights after each propagation. In our example we've propagated 11 batches (10 of them had 100 samples and 1 had 50 samples) and after each of them we've updated our network's parameters. If we used all samples during propagation we would make only 1 update for the network's parameter.
Disadvantages of using a batch size < number of all samples:


*

*The smaller the batch the less accurate the estimate of the gradient will be. In the figure below, you can see that the direction of the mini-batch gradient (green color) fluctuates much more in comparison to the direction of the full batch gradient (blue color).



Stochastic is just a mini-batch with batch_size equal to 1. In that case, the gradient changes its direction even more often than a mini-batch gradient.
A: In the neural network terminology:


*

*one epoch = one forward pass and one backward pass of all the training examples

*batch size = the number of training examples in one forward/backward pass. The higher the batch size, the more memory space you'll need.

*number of iterations =  number of passes, each pass using [batch size] number of examples. To be clear, one pass = one forward pass + one backward pass (we do not count the forward pass and backward pass as two different passes).


Example: if you have 1000 training examples, and your batch size is 500, then it will take 2 iterations to complete 1 epoch.
FYI: Tradeoff batch size vs. number of iterations to train a neural network
A: The question has been asked a while ago but I think people are still tumbling across it. For me it helped to know about the mathematical background to understand batching and where the advantages/disadvantages mentioned in itdxer's answer come from. So please take this as a complementary explanation to the accepted answer.
Consider Gradient Descent as an optimization algorithm to minimize your Loss function $J(\theta)$. The updating step in Gradient Descent is given by
$$\theta_{k+1} = \theta_{k} - \alpha \nabla J(\theta)$$
For simplicity let's assume you only have 1 parameter ($n=1$), but you have a total of 1050 training samples ($m = 1050$) as suggested by itdxer.
Full-Batch Gradient Descent
In Full-Batch Gradient Descent one computes the gradient for all training samples first (represented by the sum in below equation, here the batch comprises all samples $m$ = full-batch) and then updates the parameter:
$$\theta_{k+1} = \theta_{k} - \alpha \sum^m_{j=1} \nabla J_j(\theta)$$
This is what is described in the wikipedia excerpt from the OP. For large number of training samples, the updating step becomes very expensive since the gradient has to be evaluated for each summand.
Mini-Batch Gradient Descent
In Mini-Batch we apply the same equation but compute the gradient for batches of the training sample only (here the batch comprises a subset $b$ of all training samples $m$, thus mini-batch) before updating the parameter.
$$\theta_{k+1} = \theta_{k} - \alpha \sum^b_{j=1} \nabla J_j(\theta)$$
Let's say we divide our 1050 training samples in 50 batches each comprising 21 training samples ($b$ = 21). Then we would evaluate the equation 50 times (once for each batch) and each time we would sum up the gradients for 21 training samples before updating the parameter.
Stochastic Gradient Descent
In Stochastic Gradient Descent one computes the gradient for one training sample and updates the paramter immediately. Basically, it is mini-batch with batch size = 1, as already mentioned by itdxer. These two steps are repeated for all training samples.
for each sample j compute:

$$\theta_{k+1} = \theta_{k} - \alpha \nabla J_j(\theta)$$
One updating step is less expensive since the gradient is only evaluated for a single training sample j.
Difference between the approaches
Updating Speed: Batch gradient descent tends to converge more slowly because the gradient has to be computed for all training samples before updating. Within the same number of computation steps, Stochastic Gradient Descent already updated the parameter multiple times. But why should we then even choose Batch Gradient Descent?
Convergence Direction: Faster updating speed comes at the cost of lower "accuracy". Since in Stochastic Gradient Descent we only incorporate a single training sample to estimate the gradient it does not converge as directly as batch gradient descent. One could say, that the amount of information in each updating step is lower in SGD compared to BGD.
The less direct convergence is nicely depicted in itdxer's answer. Full-Batch has the most direct route of convergence, where as mini-batch or stochastic fluctuate a lot more. Also with SDG it can theoretically happen, that the solution never fully converges.
Memory Capacity: As pointed out by itdxer feeding training samples as batches requires memory capacity to load the batches. The greater the batch, the more memory capacity is required. Feeding a full-batch would require a lot of memory for large datasets and feeding each sample individually would take the algorithm a long time to converge. Thus, we typically choose a mini-batch (some batch size between one and full).
Summary
In my example I used Gradient Descent and no particular loss function, but the concept stays the same since optimization on computers basically always comprises iterative approaches.
So, by batching you have influence over training speed (smaller batch size) vs. gradient estimation accuracy (larger batch size). By choosing the batch size you define how many training samples are combined to estimate the gradient before updating the parameter(s).
A: Batch size is a hyperparameter that define number of sample to work through before updating internal model parameters.
