I am not really aware of what rules does numpy follows when performing some 2d array operations with regards to returning the result as a 1d or 2d array. Let us consider the following piece of code
idx_cls_samples = sample_data[:, -1] == c
v_feature = sample_data[idx_cls_samples, f]
f_values = sample_data[[sample_data[:, -1] == c], f]
Note that the last line is simply the first two lines combined into one.
The result of first two lines is a numpy vector of the form array([1, 2, 3, ...]) and the result of last line is array([[1, 2, 3, ...]]) and I believe the result should have been array([1], [2], [3], ...]) in both cases. How can I figure out beforehand what format will numpy choose to return the result?
sample_data[sample_data[:, -1] == c, f]would be the same (dropped an extra set of brackets)