For example assume I have three observations as given in matrix A
$A = \left[ \begin{array}{ccc} 1 & 0 & 1 \\ 1 & 1 & 0 \\ 0 & 1 & 1 \\ \end{array} \right]$
each row vector of matrix A has a weight value associated with it as $w = (0.5, 0.3, 0.2) $
Using the equation in Wikipedia which is:
$$ \bar{x} = \sum_{i = 1}^{N} w_ix_i $$
I'm confused on the direction of $i$ in the above equation.
I managed to interpret this in two ways below
$i$ represents a row in matrix A $$ \bar{x} = 0.5*\left[ \begin{array}{ccc} 1 & 0 & 1 \\ \end{array} \right] + 0.3*\left[ \begin{array}{ccc} 1 & 1 & 0\\ \end{array} \right] + 0.2*\left[ \begin{array}{ccc} 0 & 1 & 1 \\ \end{array} \right] $$ $$ \bar{x} = \left[ \begin{array}{ccc} 0.5 & 0 & 0.5 \\ \end{array} \right] + \left[ \begin{array}{ccc} 0.3 & 0.3 & 0\\ \end{array} \right] + \left[ \begin{array}{ccc} 0 & 0.2 & 0.2 \\ \end{array} \right] = \left[ \begin{array}{ccc} 0.8 & 0.5 & 0.7 \\ \end{array} \right] $$
$i$ represents a column in matrix A (column is represented as a row) $$ \bar{x} = \left[ \begin{array}{ccc} 0.5 & 0.3 & 0 \\ \end{array} \right] + \left[ \begin{array}{ccc} 0 & 0.3 & 0.2\\ \end{array} \right] + \left[ \begin{array}{ccc} 0.5 & 0 & 0.2 \\ \end{array} \right] $$ $$ \bar{x} = \left[ \begin{array}{ccc} 1.0 & 0.6 & 0.4 \\ \end{array} \right] $$
Which calculation is correct? For me the approach 1 seems correct but I'm not sure.
Please explain the two scenarios
- If the columns of matrix A represents attributes and the rows represent observations which method is correct?
- If the columns of matrix A represents observations and the rows represent attributes which method is correct?