I have a 4D numpy array of input data where each column represents a quantity (say speed, acceleration, etc) and I would like to calculate some statistical information for each quantity (mean, st-dev. meadian, 75, 85 and 95 percentiles.
So for example:
input_shape = (1,200,4)
n_sample = 100
X = np.random.uniform(0,1, (n_sample,) + input_shape)
X.shape
(100, 1, 200, 4)
X[0]
array([[[0.50410922, 0.82829892, 0.72460878, 0.0562701 ],
[0.49223423, 0.14152948, 0.32285973, 0.49056405],
...
[0.8299407 , 0.78446729, 0.40959698, 0.893117 ],
[0.25150705, 0.56759064, 0.28280459, 0.0599566 ]]])
Each column of X represents some physical quantity for 200 data-points. The statistics of each quantity is what I'm interested in.
EDIT
I would expect something like:
[[[col1_mean, col2_mean, col3_mean, col4_mean ],
[col1_std, col2_std, col3_std, col4_mean],
[col1_med, col2_med, col3_med, col4_med],
[col1_p75, col2_p75, col3_p75, col4_p75 ],
[col1_p85, col2_p85, col3_p85, col4_p85 ],
[col1_p95, col2_p95, col3_p95, col4_p95 ]]]
So the result is shaped (100, 1, 6, 4)
Xis a 4D array, It's rather unclear what you mean bystdor 75%-percentile of 3D data.axisargument. For examplenp.mean(X, axis=-2)would return an array of shape(100, 1, 4)with the mean across what you call the "200 data points".axis=-2) as in your comment.