मैंने एक विश्वसनीय स्रोत से उत्तर नहीं देखा है, लेकिन मैं इसका उत्तर स्वयं देने की कोशिश करूँगा, एक साधारण उदाहरण के साथ (मेरे वर्तमान ज्ञान के साथ)।
सामान्य तौर पर, ध्यान दें कि पीठ-प्रसार का उपयोग करते हुए एक एमएलपी को प्रशिक्षण आमतौर पर मैट्रिसेस के साथ लागू किया जाता है।
मैट्रिक्स गुणन का समय जटिलता
के लिए आव्यूह गुणन के समय जटिलता Mij∗Mjk बस है O(i∗j∗k) ।
ध्यान दें कि हम यहां सरलतम गुणा एल्गोरिथ्म मान रहे हैं: कुछ बेहतर समय जटिलता के साथ कुछ अन्य एल्गोरिदम मौजूद हैं।
Feedforward पास एल्गोरिथ्म
फीडफ़ॉर्वर्ड प्रचार एल्गोरिथ्म इस प्रकार है।
सबसे पहले, लेयर i से j तक जाने के लिए , आप करते हैं
Sj=Wji∗Zi
फिर आप सक्रियण फ़ंक्शन लागू करते हैं
Zj=f(Sj)
अगर हमारे पास N लेयर्स हैं (इनपुट और आउटपुट लेयर सहित), तो यह N - 1 चलेगाN−1 बार ।
उदाहरण
एक उदाहरण के रूप में, चलो 4 परतों के साथ एक एमएलपी के लिए आगे पास एल्गोरिथ्म की समय जटिलता की गणना करते हैं, जहां i इनपुट परत के नोड्स की संख्या को दर्शाता है, दूसरी परत में नोड की संख्या को j , नोड की संख्या को k । तीसरी परत और आउटपुट परत में नोड्स की संख्या l ।
43WjiWkjWlk, where Wji is a matrix with j rows and i columns (Wji thus contains the weights going from layer i to layer j).
Assume you have t training examples. For propagating from layer i to j, we have first
Sjt=Wji∗Zit
and this operation (i.e. matrix multiplcation) has O(j∗i∗t) time complexity. Then we apply the activation function
Zjt=f(Sjt)
and this has O(j∗t) time complexity, because it is an element-wise operation.
So, in total, we have
O(j∗i∗t+j∗t)=O(j∗t∗(t+1))=O(j∗i∗t)
j→kO(k∗j∗t), and, for k→l, we have O(l∗k∗t).
In total, the time complexity for feedforward propagation will be
O(j∗i∗t+k∗j∗t+l∗k∗t)=O(t∗(ij+jk+kl))
I'm not sure if this can be simplified further or not. Maybe it's just O(t∗i∗j∗k∗l), but I'm not sure.
Back-propagation algorithm
l→kEltl
Elt=f′(Slt)⊙(Zlt−Olt)
where ⊙ means element-wise multiplication. Note that Elt has l rows and t columns: it simply means each column is the error signal for training example t.
We then compute the "delta weights", Dlk∈Rl×k (between layer l and layer k)
Dlk=Elt∗Ztk
where Ztk is the transpose of Zkt.
We then adjust the weights
Wlk=Wlk−Dlk
For l→k, we thus have the time complexity O(lt+lt+ltk+lk)=O(l∗t∗k).
Now, going back from k→j. We first have
Ekt=f′(Skt)⊙(Wkl∗Elt)
Then
Dkj=Ekt∗Ztj
And then
Wkj=Wkj−Dkj
where Wkl is the transpose of Wlk. For k→j, we have the time complexity O(kt+klt+ktj+kj)=O(k∗t(l+j)).
And finally, for j→i, we have O(j∗t(k+i)). In total, we have
O(ltk+tk(l+j)+tj(k+i))=O(t∗(lk+kj+ji))
which is same as feedforward pass algorithm. Since they are same, the total time complexity for one epoch will be O(t∗(ij+jk+kl)).
This time complexity is then multiplied by number of iterations (epochs). So, we have O(n∗t∗(ij+jk+kl)),
where n is number of iterations.
Notes
Note that these matrix operations can greatly be paralelized by GPUs.
Conclusion
We tried to find the time complexity for training a neural network that has 4 layers with respectively i, j, k and l nodes, with t training examples and n epochs. The result was O(nt∗(ij+jk+kl)).
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.
Sources
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:
http://briandolhansky.com/blog/2013/9/27/artificial-neural-networks-backpropagation-part-4