0
$\begingroup$

This code accesses the first 3 examples in the iris data set,

from sklearn.datasets import load_iris
iris = load_iris()
print(iris.data[:3])

and gives

[[5.1 3.5 1.4 0.2]
 [4.9 3.  1.4 0.2]
 [4.7 3.2 1.3 0.2]]

To denote the first example, $x_1$, should I use a column vector like

\begin{bmatrix} 5.1\\3.5\\1.4\\0.2 \end{bmatrix}

or a row vector like the following?

$$[5.1 \ 3.5 \ 1.4 \ 0.2]$$

Andrew Ng suggests putting examples in columns

enter image description here

while typical relational databases putting examples in rows.

I'd just like to know the pros and cons of different notations so that I can decide which one I would follow.

$\endgroup$
2
  • $\begingroup$ Hello. What do you mean by "to denote a training example..."? Are you writing e.g. a paper or a homework and you don't know which notation you should use or maybe something else? $\endgroup$ – nbro Jun 14 at 1:50
  • $\begingroup$ @nbro Thank you. I'd just like to know the pros and cons of different notations so that I can decide which one I would follow. $\endgroup$ – JJJohn Jun 18 at 9:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.