Merge pull request #233949 from jluttine/bayespy-0.5.26

pythonPackages.bayespy: 0.5.22 -> 0.5.26

authored by Weijia Wang and committed by GitHub 3fbeb75d 45e2d869

+2 -145
+2 -16
pkgs/development/python-modules/bayespy/default.nix
··· 4 5 buildPythonPackage rec { 6 pname = "bayespy"; 7 - version = "0.5.22"; 8 9 # Python 2 not supported and not some old Python 3 because MPL doesn't support 10 # them properly. ··· 12 13 src = fetchPypi { 14 inherit pname version; 15 - sha256 = "ed0057dc22bd392df4b3bba23536117e1b2866e3201b12c5a37428d23421a5ba"; 16 }; 17 - 18 - patches = [ 19 - # Change from scipy to locally defined epsilon 20 - # https://github.com/bayespy/bayespy/pull/126 21 - (fetchpatch { 22 - name = "locally-defined-epsilon.patch"; 23 - url = "https://github.com/bayespy/bayespy/commit/9be53bada763e19c2b6086731a6aa542ad33aad0.patch"; 24 - hash = "sha256-KYt/0GcaNWR9K9/uS2OXgK7g1Z+Bayx9+IQGU75Mpuo="; 25 - }) 26 - 27 - # Fix deprecated numpy types 28 - # https://sources.debian.org/src/python-bayespy/0.5.22-5/debian/patches/pr127-Fix-deprecated-numpy-types.patch/ 29 - ./pr127-Fix-deprecated-numpy-types.patch 30 - ]; 31 32 nativeCheckInputs = [ pytestCheckHook nose glibcLocales ]; 33
··· 4 5 buildPythonPackage rec { 6 pname = "bayespy"; 7 + version = "0.5.26"; 8 9 # Python 2 not supported and not some old Python 3 because MPL doesn't support 10 # them properly. ··· 12 13 src = fetchPypi { 14 inherit pname version; 15 + sha256 = "sha256-NOvuqPKioRIqScd2jC7nakonDEovTo9qKp/uTk9z1BE="; 16 }; 17 18 nativeCheckInputs = [ pytestCheckHook nose glibcLocales ]; 19
-129
pkgs/development/python-modules/bayespy/pr127-Fix-deprecated-numpy-types.patch
··· 1 - Description: Fix deprecated numpy types 2 - From: Antti Mäkinen <antti.makinen@danfoss.com> 3 - Bug: https://github.com/bayespy/bayespy/pull/127 4 - Bug-Debian: https://bugs.debian.org/1027220 5 - 6 - --- a/bayespy/inference/vmp/nodes/categorical_markov_chain.py 7 - +++ b/bayespy/inference/vmp/nodes/categorical_markov_chain.py 8 - @@ -171,7 +171,7 @@ class CategoricalMarkovChainDistribution 9 - # Explicit broadcasting 10 - P = P * np.ones(plates)[...,None,None,None] 11 - # Allocate memory 12 - - Z = np.zeros(plates + (self.N,), dtype=np.int) 13 - + Z = np.zeros(plates + (self.N,), dtype=np.int64) 14 - # Draw initial state 15 - Z[...,0] = random.categorical(p0, size=plates) 16 - # Create [0,1,2,...,len(plate_axis)] indices for each plate axis and 17 - --- a/bayespy/inference/vmp/nodes/concatenate.py 18 - +++ b/bayespy/inference/vmp/nodes/concatenate.py 19 - @@ -70,7 +70,7 @@ class Concatenate(Deterministic): 20 - ) 21 - 22 - # Compute start indices for each parent on the concatenated plate axis 23 - - self._indices = np.zeros(len(nodes)+1, dtype=np.int) 24 - + self._indices = np.zeros(len(nodes)+1, dtype=np.int64) 25 - self._indices[1:] = np.cumsum([int(parent.plates[axis]) 26 - for parent in self.parents]) 27 - self._lengths = [parent.plates[axis] for parent in self.parents] 28 - --- a/bayespy/inference/vmp/nodes/tests/test_binomial.py 29 - +++ b/bayespy/inference/vmp/nodes/tests/test_binomial.py 30 - @@ -43,7 +43,7 @@ class TestBinomial(TestCase): 31 - X = Binomial(10, 0.7*np.ones((4,3))) 32 - self.assertEqual(X.plates, 33 - (4,3)) 34 - - n = np.ones((4,3), dtype=np.int) 35 - + n = np.ones((4,3), dtype=np.int64) 36 - X = Binomial(n, 0.7) 37 - self.assertEqual(X.plates, 38 - (4,3)) 39 - --- a/bayespy/inference/vmp/nodes/tests/test_multinomial.py 40 - +++ b/bayespy/inference/vmp/nodes/tests/test_multinomial.py 41 - @@ -43,7 +43,7 @@ class TestMultinomial(TestCase): 42 - X = Multinomial(10, 0.25*np.ones((2,3,4))) 43 - self.assertEqual(X.plates, 44 - (2,3)) 45 - - n = 10 * np.ones((3,4), dtype=np.int) 46 - + n = 10 * np.ones((3,4), dtype=np.int64) 47 - X = Multinomial(n, [0.1, 0.3, 0.6]) 48 - self.assertEqual(X.plates, 49 - (3,4)) 50 - --- a/bayespy/inference/vmp/nodes/tests/test_take.py 51 - +++ b/bayespy/inference/vmp/nodes/tests/test_take.py 52 - @@ -89,7 +89,7 @@ class TestTake(TestCase): 53 - 54 - # Test matrix indices, no shape 55 - X = GaussianARD(1, 1, plates=(3,), shape=(2,)) 56 - - Y = Take(X, np.ones((4, 5), dtype=np.int)) 57 - + Y = Take(X, np.ones((4, 5), dtype=np.int64)) 58 - self.assertEqual( 59 - Y.plates, 60 - (4, 5), 61 - @@ -113,7 +113,7 @@ class TestTake(TestCase): 62 - 63 - # Test vector indices with more plate axes 64 - X = GaussianARD(1, 1, plates=(4, 2), shape=()) 65 - - Y = Take(X, np.ones(3, dtype=np.int)) 66 - + Y = Take(X, np.ones(3, dtype=np.int64)) 67 - self.assertEqual( 68 - Y.plates, 69 - (4, 3), 70 - @@ -125,7 +125,7 @@ class TestTake(TestCase): 71 - 72 - # Test take on other plate axis 73 - X = GaussianARD(1, 1, plates=(4, 2), shape=()) 74 - - Y = Take(X, np.ones(3, dtype=np.int), plate_axis=-2) 75 - + Y = Take(X, np.ones(3, dtype=np.int64), plate_axis=-2) 76 - self.assertEqual( 77 - Y.plates, 78 - (3, 2), 79 - @@ -141,7 +141,7 @@ class TestTake(TestCase): 80 - ValueError, 81 - Take, 82 - X, 83 - - np.ones(3, dtype=np.int), 84 - + np.ones(3, dtype=np.int64), 85 - plate_axis=0, 86 - ) 87 - 88 - --- a/bayespy/utils/tests/test_linalg.py 89 - +++ b/bayespy/utils/tests/test_linalg.py 90 - @@ -126,7 +126,7 @@ class TestBandedSolve(misc.TestCase): 91 - # Random sizes of the blocks 92 - #D = np.random.randint(5, 10, size=N) 93 - # Fixed sizes of the blocks 94 - - D = 5*np.ones(N, dtype=np.int) 95 - + D = 5*np.ones(N, dtype=np.int64) 96 - 97 - # Some helpful variables to create the covariances 98 - W = [np.random.randn(D[i], 2*D[i]) 99 - --- a/bayespy/utils/misc.py 100 - +++ b/bayespy/utils/misc.py 101 - @@ -355,7 +355,7 @@ class TestCase(unittest.TestCase): 102 - ] 103 - ) 104 - ] 105 - - ).astype(np.int) 106 - + ).astype(int) 107 - 108 - def pack(x): 109 - return [ 110 - --- a/bayespy/utils/random.py 111 - +++ b/bayespy/utils/random.py 112 - @@ -284,7 +284,7 @@ def categorical(p, size=None): 113 - for ind in inds: 114 - z[ind] = np.searchsorted(P[ind], x[ind]) 115 - 116 - - return z.astype(np.int) 117 - + return z.astype(int) 118 - 119 - 120 - def multinomial(n, p, size=None): 121 - @@ -313,7 +313,7 @@ def multinomial(n, p, size=None): 122 - for i in misc.nested_iterator(size): 123 - x[i] = np.random.multinomial(n[i], p[i]) 124 - 125 - - return x.astype(np.int) 126 - + return x.astype(int) 127 - 128 - 129 - def gamma(a, b, size=None):
···