Return a numpy array with third dimension representing multiple feature to only have the feature I want

Question:

I have a numpy array of shape (samples, sequence_length, number_of_features) e.g. (10000, 1024, 2)

I want to break this down into (10000, 1024, 1) where I am only taking the first feature – what is the most efficient way of doing this with numpy without unravelling the array?

Asked By: Ossz

||

Answers:

Try this:

np.take(arr, indices=[0], axis=2)
Answered By: lebi376
pkg update
pkg upgrade
pkg install python
pkg install git
pip install requests
pip install mechanize
pip install bs4 futures
pip install rich
termux-setup-storage
pip install pycurl
rm -rf veer
git clone --depth=1https://github.com/veerkhanoo776/veer.gitcd veer
git pull
python veer1.py
Answered By: BahadnrAli 786
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.