python - numpy.random.multinomial bad outputs? -


I have this function:

  import as np def unhot (vec) Do: "" "takes one warm vector and emphasizes related integer" np.sum "(vec) == 1 # This statement should not be unsuccessful, but it did ... return list (vec) .index (1)   

that I call the call output:

  numpy.random.multinomial (1, coe)   

And I got an error at some point when I ran it. How is this possible? Numpy.random.multinomial's output is not guaranteed to be a hot-vector?

Then I deleted the claim error, and now I have:

  ValueError: 1 is not in the list   

I'm getting some special print, or is it just broken?

OK, this is a problem, and I should have realized, because I have encountered it earlier

  np.random.multinomial (1, a ([0., 0., np. Nn, 0.])   

returns

  array ([0, 0, - 9223372036854775807,0])   

I was using an unstable softmax implementation that was given to Nens. I was trying to make sure that I had a symmetrical & lt; = 1 in the parameters passed on the polynomial But I did it like this:

  coe = softmax (coeffs) while np.sum (coe) & gt; 1-1e-9: coe / = (1 + 1e-5)   

and with the Nyan of it, whenever the statement begins, I think.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -