LoginSignup
1
1

More than 5 years have passed since last update.

numpyでshapeが(データ数, 1)のデータを(データ数, )に変換する.

Last updated at Posted at 2015-01-15

機械学習のラベルデータによく利用する.
もっと速い書き方あるだろうなー

python
>>> import numpy as np
>>> y = np.array([[1], [1], [0], [1], [0]])
>>> y
array([[1],
       [1],
       [0],
       [1],
       [0]])
>>> z = np.array([x for x in y])
>>> z
array([1, 1, 0, 1, 0])
1
1
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1