Package: statsmodels / 0.12.2-1

xfail_regimeswitching_armhf.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Description: Markov* broken on armhf

Warn on use, and xfail tests

I suspect https://github.com/statsmodels/statsmodels/pull/5826
but that improved it enough on amd64 that
reverting it isn't a good solution.

Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Forwarded: no

--- a/statsmodels/tsa/regime_switching/markov_switching.py
+++ b/statsmodels/tsa/regime_switching/markov_switching.py
@@ -28,6 +28,9 @@ from statsmodels.tsa.regime_switching._h
     zhamilton_filter_log)
 from statsmodels.tsa.regime_switching._kim_smoother import (
     skim_smoother_log, dkim_smoother_log, ckim_smoother_log, zkim_smoother_log)
+import platform
+import sys
+warn_rswitch_platform = "Regime switching models (Markov(Auto)Regression) can give wrong results on armhf (armv7)" if ((platform.uname()[4].startswith('arm') or platform.uname()[4].startswith('aarch')) and np.log2(sys.maxsize)<=32) else False # test results at end of https://buildd.debian.org/status/fetch.php?pkg=statsmodels&arch=armhf&ver=0.11.0-1&stamp=1580716740&raw=0 ; the use of log2 rather than 2**32 is to avoid overflow on Python 2
 
 prefix_hamilton_filter_log_map = {
     's': shamilton_filter_log, 'd': dhamilton_filter_log,
@@ -489,6 +492,8 @@ class MarkovSwitching(tsbase.TimeSeriesM
 
     def __init__(self, endog, k_regimes, order=0, exog_tvtp=None, exog=None,
                  dates=None, freq=None, missing='none'):
+        if warn_rswitch_platform:
+            warnings.warn(warn_rswitch_platform)
 
         # Properties
         self.k_regimes = k_regimes
--- a/statsmodels/tsa/regime_switching/tests/test_markov_autoregression.py
+++ b/statsmodels/tsa/regime_switching/tests/test_markov_autoregression.py
@@ -15,6 +15,8 @@ import pytest
 
 from statsmodels.tools import add_constant
 from statsmodels.tsa.regime_switching import markov_autoregression
+from statsmodels.tsa.regime_switching.markov_switching import warn_rswitch_platform
+pytestmark = pytest.mark.xfail(condition=bool(warn_rswitch_platform),reason="known broken on armhf",strict=False)
 
 current_path = os.path.dirname(os.path.abspath(__file__))
 
--- a/statsmodels/tsa/regime_switching/tests/test_markov_regression.py
+++ b/statsmodels/tsa/regime_switching/tests/test_markov_regression.py
@@ -15,6 +15,8 @@ import pytest
 
 from statsmodels.tsa.regime_switching import (markov_switching,
                                               markov_regression)
+from statsmodels.tsa.regime_switching.markov_switching import warn_rswitch_platform
+pytestmark = pytest.mark.xfail(condition=bool(warn_rswitch_platform),reason="known broken on armhf",strict=False)
 
 
 current_path = os.path.dirname(os.path.abspath(__file__))