Definition of dimension For example, there is a matrix
A = [[1, 2, 3, 4],
     [5, 6, 7, 8]]

where A is a 2 dimensional matrix with 2 samples of 4 dimensions.
I guess word dimension has different meanings for matrix and data (n-dim space for matrix and length of vector for data).
But I want to know definitions and the exact difference.
Thank you in advance.
 A: This is not a definition, I shall try and highlight a few points of difference between data dimension and matrix dimension.
1) A data dimension is (loosely) related to an observation of an entity or a process. Better explained with an example. Let us say we wish to observe the behaviour of a server over time, we then need to determine which aspects of the server we shall observe. Let us say we decide to observe the CPU and RAM utilization of the server, so each observation will have 2 numbers associated with it one the CPU utilization and the other RAM utilization. So each observation has a pair of values. The number of values associated with an observation (in this case 2) is the dimension of the data that you have chosen to collect.
2) Essentially an observation or data point has nothing to do with matrix. As far as pure data angle is concerned, matrix (or for that matter any other structure) does not exist. We arrange observation and data points for our convenience, it need not be a matrix at all. For example, your observations (in matrix form) could be thought of as objects with attributes and the entire collection as a list. In this case, there are no columns or rows (matrix form), it could be considered as a list.
In essence, data has no linkage to the structure that we put it in. dimensions of a matrix (or tensor) is given by the max. size of it's axis (if we take a coordinate system comparison). While data dimension is essentially the aspect of observation.
