I am used to C/Java like programming, and sometimes I am getting a headache on understanding the Python notation.
On the logistic regression code available online, I am trying to understand this line of code:
-T.mean(T.log(self.p_y_given_x)[T.arange(y.shape[0]), y])
It is basically saying perform this average: $\begin{align} J(\theta) = - \left[ \sum_{i=1}^{b} \sum_{k=1}^{K} 1\left\{y^{(i)} = k\right\} \log \frac{\exp(\theta^{(k)\top} x^{(i)})}{\sum_{j=1}^K \exp(\theta^{(j)\top} x^{(i)})}\right] \end{align}$ where $b$ is the batch size.
So is it related to theano code, or it is just a python notation ? I am interested exactly on this piece of code:
T.log(self.p_y_given_x)[T.arange(y.shape[0]), y]
If you could please give me some explanation.