Re: Creating a hot vector (numpy)

2016-04-18 Thread Paulo da Silva
Às 05:05 de 18-04-2016, Reto Brunner escreveu: > Hi, > It is called broadcasting an array, have a look here: > http://docs.scipy.org/doc/numpy-1.10.1/user/basics.broadcasting.html > So, there are two broadcasts here. OK. Thanks. -- https://mail.python.org/mailman/listinfo/python-list

Re: Creating a hot vector (numpy)

2016-04-17 Thread Reto Brunner
Hi, It is called broadcasting an array, have a look here: http://docs.scipy.org/doc/numpy-1.10.1/user/basics.broadcasting.html Greetings, Reto On Mon, Apr 18, 2016, 02:54 Paulo da Silva wrote: > Hi all. > > I have seen this "trick" to create a hot vector. > >

Creating a hot vector (numpy)

2016-04-17 Thread Paulo da Silva
Hi all. I have seen this "trick" to create a hot vector. In [45]: x Out[45]: array([0, 1]) In [46]: y Out[46]: array([1, 1, 1, 0, 0, 1, 0, 0], dtype=uint8) In [47]: y[:,None] Out[47]: array([[1], [1], [1], [0], [0], [1], [0], [0]], dtype=uint8)