2:40 - what's the difference between X_std[y==3,:] & X_std[y==3] used earlier? aren't they the same
in
Linear Algebra and Feature Selection
/
Calculating the Within- and Between-Class Scatter Matrices
2:40 - what's the difference between X_std[y==3,:] & X_std[y==3] used earlier? aren't they the same
1 answers ( 0 marked as helpful)
Hi Ryan!
Thanks for reaching out!
Yes, both expressions will give you the same result: the rows of X_std
where y==3
is True. However, it's a matter of coding style and personal preference. Some people prefer using the colon :
to explicitly indicate that they are selecting all columns, while others omit it for brevity.
In summary, both expressions are used to select rows from a NumPy array based on a condition, and they are often interchangeable in practice.
Hope this helps.
Best,
Ivan