np.__version__ '1.6.2' aa array([1970-01-13 96:00:00, 1970-01-13 120:00:00, 1970-01-13 144:00:00, 1970-01-13 168:00:00, 1970-01-13 192:00:00], dtype=datetime64[ns]) np.dot(aa, [1]) <segfault>
reported at http://stackoverflow.com/questions/13786209/regression-on-stock-data-using-p... discussion https://groups.google.com/d/topic/pystatsmodels/5zpWBzSH8UE/discussion using linalg is "safe" but I doubt this casting to float is the desired result
np.linalg.pinv(aa[:,None]) array([[ 1.87768878e-19, 1.87784114e-19, 1.87799350e-19, 1.87814586e-19, 1.87829822e-19]]) np.linalg.pinv(np.asarray(aa, float)[:,None]) array([[ 1.87768878e-19, 1.87784114e-19, 1.87799350e-19, 1.87814586e-19, 1.87829822e-19]])
Josef
On Mon, Dec 10, 2012 at 5:39 PM,
np.__version__ '1.6.2' aa array([1970-01-13 96:00:00, 1970-01-13 120:00:00, 1970-01-13 144:00:00, 1970-01-13 168:00:00, 1970-01-13 192:00:00], dtype=datetime64[ns]) np.dot(aa, [1]) <segfault>
Hmm, I can't even get that array using current master, what with illegal hours and all. Datetime in 1.6.x wasn't quite up to snuff, so things might have been fixed in 1.7.0. Is there any way you can check that. Chuck
On Mon, Dec 10, 2012 at 8:26 PM, Charles R Harris
On Mon, Dec 10, 2012 at 5:39 PM,
wrote: np.__version__ '1.6.2' aa array([1970-01-13 96:00:00, 1970-01-13 120:00:00, 1970-01-13 144:00:00, 1970-01-13 168:00:00, 1970-01-13 192:00:00], dtype=datetime64[ns]) np.dot(aa, [1]) <segfault>
Hmm, I can't even get that array using current master, what with illegal hours and all. Datetime in 1.6.x wasn't quite up to snuff, so things might have been fixed in 1.7.0. Is there any way you can check that.
I didn't know the dates are illegal, they were created with pandas. Skipper said he couldn't replicate the segfault so it might be gone with a more recent numpy. I still have to setup a virtualenv for a 1.7.0 beta so I can start to test it. (I rely on binaries for numpy and scipy now.) Thanks, Josef
Chuck
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
On Mon, Dec 10, 2012 at 8:54 PM,
On Mon, Dec 10, 2012 at 8:26 PM, Charles R Harris
wrote: On Mon, Dec 10, 2012 at 5:39 PM,
wrote: np.__version__ '1.6.2' aa array([1970-01-13 96:00:00, 1970-01-13 120:00:00, 1970-01-13 144:00:00, 1970-01-13 168:00:00, 1970-01-13 192:00:00], dtype=datetime64[ns]) np.dot(aa, [1]) <segfault>
Hmm, I can't even get that array using current master, what with illegal hours and all. Datetime in 1.6.x wasn't quite up to snuff, so things might have been fixed in 1.7.0. Is there any way you can check that.
I didn't know the dates are illegal, they were created with pandas.
here's the minimal numpy version
np.ones(5, 'datetime64[ns]') array([1970-01-01 00:00:00, 1970-01-01 00:00:00, 1970-01-01 00:00:00, 1970-01-01 00:00:00, 1970-01-01 00:00:00], dtype=datetime64[ns]) b = np.ones(5, 'datetime64[ns]') np.dot(b, [1]) <segfault>
virtualenv is next Josef
Skipper said he couldn't replicate the segfault so it might be gone with a more recent numpy. I still have to setup a virtualenv for a 1.7.0 beta so I can start to test it. (I rely on binaries for numpy and scipy now.)
Thanks,
Josef
Chuck
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
On Mon, Dec 10, 2012 at 9:46 PM,
On Mon, Dec 10, 2012 at 8:54 PM,
wrote: On Mon, Dec 10, 2012 at 8:26 PM, Charles R Harris
wrote: On Mon, Dec 10, 2012 at 5:39 PM,
wrote: > np.__version__ '1.6.2' > aa array([1970-01-13 96:00:00, 1970-01-13 120:00:00, 1970-01-13 144:00:00, 1970-01-13 168:00:00, 1970-01-13 192:00:00], dtype=datetime64[ns]) > np.dot(aa, [1]) <segfault>
Hmm, I can't even get that array using current master, what with illegal hours and all. Datetime in 1.6.x wasn't quite up to snuff, so things might have been fixed in 1.7.0. Is there any way you can check that.
I didn't know the dates are illegal, they were created with pandas.
here's the minimal numpy version
np.ones(5, 'datetime64[ns]') array([1970-01-01 00:00:00, 1970-01-01 00:00:00, 1970-01-01 00:00:00, 1970-01-01 00:00:00, 1970-01-01 00:00:00], dtype=datetime64[ns]) b = np.ones(5, 'datetime64[ns]') np.dot(b, [1]) <segfault>
virtualenv is next
import numpy as np np.__version__ '1.7.0b2' b = np.ones(5, 'datetime64[ns]') b array(['1969-12-31T19:00:00.000000001-0500', '1969-12-31T19:00:00.000000001-0500', '1969-12-31T19:00:00.000000001-0500', '1969-12-31T19:00:00.000000001-0500', '1969-12-31T19:00:00.000000001-0500'], dtype='datetime64[ns]') np.dot(b, [1]) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: Cannot cast array data from dtype('
much better (py27d) E:\Josef\testing\tox\py27d\Scripts>python Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. dtype('int32') according to the rule 'safe' I get the same casting exception instead of the segfault when I run the original script with pandas and statsmodels. All clear with 1.7.0b2, we just need to find a way to avoid user errors that cause segfaults with numpy 1.6.2 --------- other issue: Does using linalg with datetime64 make sense? Implicit casting to float without warning Isn't there an inconsistency between dot and linalg ? (I don't know since I didn't pay much attention to the details of datetime.)
b = np.arange(10).astype('datetime64[ns]').reshape(2,5) b array([['1969-12-31T19:00:00.000000000-0500', '1969-12-31T19:00:00.000000001-0500', '1969-12-31T19:00:00.000000002-0500', '1969-12-31T19:00:00.000000003-0500', '1969-12-31T19:00:00.000000004-0500'], ['1969-12-31T19:00:00.000000005-0500', '1969-12-31T19:00:00.000000006-0500', '1969-12-31T19:00:00.000000007-0500', '1969-12-31T19:00:00.000000008-0500', '1969-12-31T19:00:00.000000009-0500']], dtype='datetime64[ns]')
np.linalg.pinv(b) array([[ -3.20000000e-01, 1.20000000e-01], [ -1.80000000e-01, 8.00000000e-02], [ -4.00000000e-02, 4.00000000e-02], [ 1.00000000e-01, -1.73472348e-17], [ 2.40000000e-01, -4.00000000e-02]])
np.linalg.qr(b) (array([[ 0., -1.], [-1., 0.]]), array([[-5., -6., -7., -8., -9.], [ 0., -1., -2., -3., -4.]]))
c array([['2003-09-28T20:00:00.000000000-0400', '2003-09-29T20:00:00.000000000-0400', '2003-09-30T20:00:00.000000000-0400', '2003-10-01T20:00:00.000000000-0400', '2003-10-02T20:00:00.000000000-0400'], ['2003-10-05T20:00:00.000000000-0400', '2003-10-06T20:00:00.000000000-0400', '2003-10-07T20:00:00.000000000-0400', '2003-10-08T20:00:00.000000000-0400', '2003-10-09T20:00:00.000000000-0400']], dtype='datetime64[ns]') np.linalg.pinv(c) array([[ -4.07870371e-12, 4.07638889e-12], [ -2.03951719e-12, 2.03835978e-12], [ -3.30684814e-16, 3.30684816e-16], [ 2.03885582e-12, -2.03769841e-12], [ 4.07804232e-12, -4.07572751e-12]])
Josef
Josef
Skipper said he couldn't replicate the segfault so it might be gone with a more recent numpy. I still have to setup a virtualenv for a 1.7.0 beta so I can start to test it. (I rely on binaries for numpy and scipy now.)
Thanks,
Josef
Chuck
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
participants (2)
-
Charles R Harris
-
josef.pktd@gmail.com