Hi everybody.
Olivier asked me to explain my commit:
https://github.com/scikit-learn/scikit-learn/commit/00d1055bf9f00e7024f9c4757262ffb852a61267
On the ML, so here goes:
The code used

as_float_array(startprob, copy=False)

which I replaced with


np.array(startprob, dtype=np.float)

Basically as_float_array converts arrays to float, but respects how many 
bits it had.
So int32 is converted to float32 and int64 is converted to float64.
And that is basically all the function does (if I understand correctly) 
- though it
is safe for sparse matrices, which is a bit of a hassle otherwise.

As pointed out earlier, numpy float is always float64. But int is not.
On 32bit machines, np.int is np.int32, on 64bit machines it is np.int64.
So someone created an int array without caring about the bits, which
was later converted to float using as_float_array.
The resulting array was then either float32 or float64 depending
on the architecture.

As we use cython in so many places, I think it would be good to generally
be as explicit as we can. Maybe we should look at where we use the function
and think about why - or maybe this was just a weird coincidence...

Cheers,

Andy


------------------------------------------------------------------------------
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to