where is the transpose of . For , we have the time complexity .
And finally, for , we have . In total, we have
which is same as feedforward pass algorithm. Since they are same, the total time complexity for one epoch will be
This time complexity is then multiplied by number of iterations (epochs). So, we have
Note that these matrix operations can greatly be paralelized by GPUs.
We tried to find the time complexity for training a neural network that has 4 layers with respectively , , and nodes, with training examples and epochs. The result was .
We assumed the simplest form of matrix multiplication that has cubic time complexity. We used batch gradient descent algorithm. The results for stochastic and mini-batch gradient descent should be same. (Let me know if you think the otherwise: note that batch gradient descent is the general form, with little modification, it becomes stochastic or mini-batch)
Also, if you use momentum optimization, you will have same time complexity, because the extra matrix operations required are all element-wise operations, hence they will not affect the time complexity of the algorithm.
I'm not sure what the results would be using other optimizers such as RMSprop.
The following article http://briandolhansky.com/blog/2014/10/30/artificial-neural-networks-matrix-form-part-5 describes an implementation using matrices. Although this implementation is using "row major", the time complexity is not affected by this.
If you're not familiar with back-propagation, check this article:
For the evaluation of a single pattern, you need to process all weights and all neurons. Given that every neuron has at least one weight, we can ignore them, and have where is the number of weights, i.e., , assuming full connectivity between your layers.
The back-propagation has the same complexity as the forward evaluation (just look at the formula).
So, the complexity for learning examples, where each gets repeated times, is .
The bad news is that there's no formula telling you what number of epochs you need.
etimes for each of
mexamples. I didn't bother to compute the number of weights, I guess, that's the difference.
w = ij + jk + kl. basically sum of
n * n_ibetween layers as you noted.
A potential disadvantage of gradient-based methods is that they head for the nearest minimum, which is usually not the global minimum.
This means that the only difference between these search methods is the speed with which solutions are obtained, and not the nature of those solutions.
An important consideration is time complexity, which is the rate at which the time required to find a solution increases with the number of parameters (weights). In short, the time complexities of a range of different gradient-based methods (including second-order methods) seem to be similar.
Six different error functions exhibit a median run-time order of approximately O(N to the power 4) on the N-2-N encoder in this paper:
Lister, R and Stone J "An Empirical Study of the Time Complexity of Various Error Functions with Conjugate Gradient Back Propagation" , IEEE International Conference on Artificial Neural Networks (ICNN95), Perth, Australia, Nov 27-Dec 1, 1995.
Summarised from my book: Artificial Intelligence Engines: A Tutorial Introduction to the Mathematics of Deep Learning.