› Foros › PC › Software libre
0 | 1, 0, 0
1 | 5, 3, 1
…
5 | 5, 3, 1
6 | 1, 1, 1
…
10| 1, 1, 1
11| 1, 3, 5
…
(último caso, en este caso)
24 | 1, 3, 5
self.direct_rewards = np.concatenate( (
[1, 0, 0],
np.tile([5, 3, 1], self.nn_top),
np.tile([1, 1, 1], self.nn_hi-self.nn_top),
np.tile([1, 3, 5], self.max_number-self.nn_hi) )
, axis=0).reshape((-1,3))
np.concatenate( (lambda : [1, 0, 0],
np.tile(lambda x,y: x/y*[5, 3, 1], nn_top),
np.tile([1, 1, 1], nn_hi-nn_top),
np.tile(lambda x,y: x/y[1, 3, 5], 24-nn_hi) ),
axis=0).reshape((-1,3))
np.tile(lambda x,y: x/y*[5, 3, 1], nn_top)
array([<function <lambda> at 0x7fea33ee6f50>,
<function <lambda> at 0x7fea33ee6f50>,
<function <lambda> at 0x7fea33ee6f50>,
<function <lambda> at 0x7fea33ee6f50>,
<function <lambda> at 0x7fea33ee6f50>], dtype=object)
array_string = ["uno","dos","tres"])
np.where( array_string == "uno" )
-> debería devolver 0, sin embargo devuelve:
(array([], dtype=int64),)
array_string.index("uno")
def findIdx(array, string):
if array.count(string) > 0:
return array.index(string)
else:
return -1
b = lambda x,y: x/y*[5,3,1]
b(9,3)
out: [5, 3, 1, 5, 3, 1, 5, 3, 1]
np.concatenate( [[ lambda x,y: np.array([1, 0, 0.0])],
np.tile(lambda x,y: np.array([5, 3, 1.0]).dot(x*1./y), nn_top),
np.tile(lambda x,y: np.array([1, 1, 1.0]).dot(1. if x==y else 0.), nn_hi-nn_top),
np.tile(lambda x,y: np.array([1, 3, 5.0]).dot(y*1./x), 24-nn_hi) ]
, axis=0)