pythonPackages.bayespy: 0.5.22 -> 0.5.26
This commit is contained in:
parent
f91ee3065d
commit
d2ad81b088
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
buildPythonPackage rec {
|
buildPythonPackage rec {
|
||||||
pname = "bayespy";
|
pname = "bayespy";
|
||||||
version = "0.5.22";
|
version = "0.5.26";
|
||||||
|
|
||||||
# Python 2 not supported and not some old Python 3 because MPL doesn't support
|
# Python 2 not supported and not some old Python 3 because MPL doesn't support
|
||||||
# them properly.
|
# them properly.
|
||||||
|
@ -12,23 +12,9 @@ buildPythonPackage rec {
|
||||||
|
|
||||||
src = fetchPypi {
|
src = fetchPypi {
|
||||||
inherit pname version;
|
inherit pname version;
|
||||||
sha256 = "ed0057dc22bd392df4b3bba23536117e1b2866e3201b12c5a37428d23421a5ba";
|
sha256 = "sha256-NOvuqPKioRIqScd2jC7nakonDEovTo9qKp/uTk9z1BE=";
|
||||||
};
|
};
|
||||||
|
|
||||||
patches = [
|
|
||||||
# Change from scipy to locally defined epsilon
|
|
||||||
# https://github.com/bayespy/bayespy/pull/126
|
|
||||||
(fetchpatch {
|
|
||||||
name = "locally-defined-epsilon.patch";
|
|
||||||
url = "https://github.com/bayespy/bayespy/commit/9be53bada763e19c2b6086731a6aa542ad33aad0.patch";
|
|
||||||
hash = "sha256-KYt/0GcaNWR9K9/uS2OXgK7g1Z+Bayx9+IQGU75Mpuo=";
|
|
||||||
})
|
|
||||||
|
|
||||||
# Fix deprecated numpy types
|
|
||||||
# https://sources.debian.org/src/python-bayespy/0.5.22-5/debian/patches/pr127-Fix-deprecated-numpy-types.patch/
|
|
||||||
./pr127-Fix-deprecated-numpy-types.patch
|
|
||||||
];
|
|
||||||
|
|
||||||
nativeCheckInputs = [ pytestCheckHook nose glibcLocales ];
|
nativeCheckInputs = [ pytestCheckHook nose glibcLocales ];
|
||||||
|
|
||||||
propagatedBuildInputs = [ numpy scipy matplotlib h5py ];
|
propagatedBuildInputs = [ numpy scipy matplotlib h5py ];
|
||||||
|
|
|
@ -1,129 +0,0 @@
|
||||||
Description: Fix deprecated numpy types
|
|
||||||
From: Antti Mäkinen <antti.makinen@danfoss.com>
|
|
||||||
Bug: https://github.com/bayespy/bayespy/pull/127
|
|
||||||
Bug-Debian: https://bugs.debian.org/1027220
|
|
||||||
|
|
||||||
--- a/bayespy/inference/vmp/nodes/categorical_markov_chain.py
|
|
||||||
+++ b/bayespy/inference/vmp/nodes/categorical_markov_chain.py
|
|
||||||
@@ -171,7 +171,7 @@ class CategoricalMarkovChainDistribution
|
|
||||||
# Explicit broadcasting
|
|
||||||
P = P * np.ones(plates)[...,None,None,None]
|
|
||||||
# Allocate memory
|
|
||||||
- Z = np.zeros(plates + (self.N,), dtype=np.int)
|
|
||||||
+ Z = np.zeros(plates + (self.N,), dtype=np.int64)
|
|
||||||
# Draw initial state
|
|
||||||
Z[...,0] = random.categorical(p0, size=plates)
|
|
||||||
# Create [0,1,2,...,len(plate_axis)] indices for each plate axis and
|
|
||||||
--- a/bayespy/inference/vmp/nodes/concatenate.py
|
|
||||||
+++ b/bayespy/inference/vmp/nodes/concatenate.py
|
|
||||||
@@ -70,7 +70,7 @@ class Concatenate(Deterministic):
|
|
||||||
)
|
|
||||||
|
|
||||||
# Compute start indices for each parent on the concatenated plate axis
|
|
||||||
- self._indices = np.zeros(len(nodes)+1, dtype=np.int)
|
|
||||||
+ self._indices = np.zeros(len(nodes)+1, dtype=np.int64)
|
|
||||||
self._indices[1:] = np.cumsum([int(parent.plates[axis])
|
|
||||||
for parent in self.parents])
|
|
||||||
self._lengths = [parent.plates[axis] for parent in self.parents]
|
|
||||||
--- a/bayespy/inference/vmp/nodes/tests/test_binomial.py
|
|
||||||
+++ b/bayespy/inference/vmp/nodes/tests/test_binomial.py
|
|
||||||
@@ -43,7 +43,7 @@ class TestBinomial(TestCase):
|
|
||||||
X = Binomial(10, 0.7*np.ones((4,3)))
|
|
||||||
self.assertEqual(X.plates,
|
|
||||||
(4,3))
|
|
||||||
- n = np.ones((4,3), dtype=np.int)
|
|
||||||
+ n = np.ones((4,3), dtype=np.int64)
|
|
||||||
X = Binomial(n, 0.7)
|
|
||||||
self.assertEqual(X.plates,
|
|
||||||
(4,3))
|
|
||||||
--- a/bayespy/inference/vmp/nodes/tests/test_multinomial.py
|
|
||||||
+++ b/bayespy/inference/vmp/nodes/tests/test_multinomial.py
|
|
||||||
@@ -43,7 +43,7 @@ class TestMultinomial(TestCase):
|
|
||||||
X = Multinomial(10, 0.25*np.ones((2,3,4)))
|
|
||||||
self.assertEqual(X.plates,
|
|
||||||
(2,3))
|
|
||||||
- n = 10 * np.ones((3,4), dtype=np.int)
|
|
||||||
+ n = 10 * np.ones((3,4), dtype=np.int64)
|
|
||||||
X = Multinomial(n, [0.1, 0.3, 0.6])
|
|
||||||
self.assertEqual(X.plates,
|
|
||||||
(3,4))
|
|
||||||
--- a/bayespy/inference/vmp/nodes/tests/test_take.py
|
|
||||||
+++ b/bayespy/inference/vmp/nodes/tests/test_take.py
|
|
||||||
@@ -89,7 +89,7 @@ class TestTake(TestCase):
|
|
||||||
|
|
||||||
# Test matrix indices, no shape
|
|
||||||
X = GaussianARD(1, 1, plates=(3,), shape=(2,))
|
|
||||||
- Y = Take(X, np.ones((4, 5), dtype=np.int))
|
|
||||||
+ Y = Take(X, np.ones((4, 5), dtype=np.int64))
|
|
||||||
self.assertEqual(
|
|
||||||
Y.plates,
|
|
||||||
(4, 5),
|
|
||||||
@@ -113,7 +113,7 @@ class TestTake(TestCase):
|
|
||||||
|
|
||||||
# Test vector indices with more plate axes
|
|
||||||
X = GaussianARD(1, 1, plates=(4, 2), shape=())
|
|
||||||
- Y = Take(X, np.ones(3, dtype=np.int))
|
|
||||||
+ Y = Take(X, np.ones(3, dtype=np.int64))
|
|
||||||
self.assertEqual(
|
|
||||||
Y.plates,
|
|
||||||
(4, 3),
|
|
||||||
@@ -125,7 +125,7 @@ class TestTake(TestCase):
|
|
||||||
|
|
||||||
# Test take on other plate axis
|
|
||||||
X = GaussianARD(1, 1, plates=(4, 2), shape=())
|
|
||||||
- Y = Take(X, np.ones(3, dtype=np.int), plate_axis=-2)
|
|
||||||
+ Y = Take(X, np.ones(3, dtype=np.int64), plate_axis=-2)
|
|
||||||
self.assertEqual(
|
|
||||||
Y.plates,
|
|
||||||
(3, 2),
|
|
||||||
@@ -141,7 +141,7 @@ class TestTake(TestCase):
|
|
||||||
ValueError,
|
|
||||||
Take,
|
|
||||||
X,
|
|
||||||
- np.ones(3, dtype=np.int),
|
|
||||||
+ np.ones(3, dtype=np.int64),
|
|
||||||
plate_axis=0,
|
|
||||||
)
|
|
||||||
|
|
||||||
--- a/bayespy/utils/tests/test_linalg.py
|
|
||||||
+++ b/bayespy/utils/tests/test_linalg.py
|
|
||||||
@@ -126,7 +126,7 @@ class TestBandedSolve(misc.TestCase):
|
|
||||||
# Random sizes of the blocks
|
|
||||||
#D = np.random.randint(5, 10, size=N)
|
|
||||||
# Fixed sizes of the blocks
|
|
||||||
- D = 5*np.ones(N, dtype=np.int)
|
|
||||||
+ D = 5*np.ones(N, dtype=np.int64)
|
|
||||||
|
|
||||||
# Some helpful variables to create the covariances
|
|
||||||
W = [np.random.randn(D[i], 2*D[i])
|
|
||||||
--- a/bayespy/utils/misc.py
|
|
||||||
+++ b/bayespy/utils/misc.py
|
|
||||||
@@ -355,7 +355,7 @@ class TestCase(unittest.TestCase):
|
|
||||||
]
|
|
||||||
)
|
|
||||||
]
|
|
||||||
- ).astype(np.int)
|
|
||||||
+ ).astype(int)
|
|
||||||
|
|
||||||
def pack(x):
|
|
||||||
return [
|
|
||||||
--- a/bayespy/utils/random.py
|
|
||||||
+++ b/bayespy/utils/random.py
|
|
||||||
@@ -284,7 +284,7 @@ def categorical(p, size=None):
|
|
||||||
for ind in inds:
|
|
||||||
z[ind] = np.searchsorted(P[ind], x[ind])
|
|
||||||
|
|
||||||
- return z.astype(np.int)
|
|
||||||
+ return z.astype(int)
|
|
||||||
|
|
||||||
|
|
||||||
def multinomial(n, p, size=None):
|
|
||||||
@@ -313,7 +313,7 @@ def multinomial(n, p, size=None):
|
|
||||||
for i in misc.nested_iterator(size):
|
|
||||||
x[i] = np.random.multinomial(n[i], p[i])
|
|
||||||
|
|
||||||
- return x.astype(np.int)
|
|
||||||
+ return x.astype(int)
|
|
||||||
|
|
||||||
|
|
||||||
def gamma(a, b, size=None):
|
|
Loading…
Reference in a new issue