profile
viewpoint

RJT1990/pyflux 1824

Open source time series library for Python

springcoil/advanced_pymc3 11

A talk illustrating some of the Advanced features of PyMC3

hadim/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers 7

aka "Bayesian Methods for Hackers": An introduction to Bayesian methods + probabilistic programming with a computation/understanding-first, mathematics-second point of view. All in pure Python ;)

springcoil/Bayesian_Examples_PyMC3 4

A collection of notes and examples of Bayesian Modelling with some other statistical notes

fonnesbeck/pydata-cookbook 1

PyData Coobook Project

manjutr/Python 0

Python tutorials

springcoil/52-technologies-in-2016 0

Let's learn a new technology every week. A new technology blog every Sunday in 2016.

springcoil/538model 0

538 Election Forecasting Model

springcoil/actitracker-cassandra-spark 0

Activity recognition using Spark, Cassandra and MLlib

springcoil/alpine-tensorflow 0

Building Tensorflow in Alpine

pull request commentpymc-devs/pymc3

Add github actions workflow for tests

Why do you think pip would be preferable?

I hadn't realised conda was the recommended way to install, so pip just seemed simpler - I've gone with conda anyway

aseyboldt

comment created time in 22 minutes

Pull request review commentpymc-devs/pymc3

Move travis CI to GitHubActions

 dependencies:   - nose-parameterized>=0.6   - numpydoc>=0.9   - pre-commit>=2.8.0-  - pycodestyle>=2.3-  - pyflakes>=1.5-  - pylint>=1.7

remove these (and other formatters/linters) as they're run via pre-commit

MarcoGorelli

comment created time in 26 minutes

PR opened pymc-devs/pymc3

Move travis CI to GitHubActions

Still need to upload to codecov, but for now this seems to run the same tests travis did (except pylint, which in #4242 I've moved over to pre-commit so it provides faster feedback to devs)

+79 -75

0 comment

3 changed files

pr created time in 29 minutes

pull request commentpymc-devs/pymc3

Test model logp before starting any MCMC chains

Seems like there are still conflicts though:

Yes, that's what I'm saying - I can either leave the conflict in, in which case I can't merge, or I can resolve the conflict in which case linting fails because there's an unneeded import. It's a Catch-22.

Shouldn't be a catch-22 :smile:

Can you try

git fetch --all --prune
git merge upstream/master

Then, in pymc3/util.py, you'll see something like

<<<<<<< HEAD
=======
from numpy import ndarray
>>>>>>> upstream/master

Change it to

(i.e., choose the current changes, ignore the incoming ones)

Then,

git add -u
git commit
git push -u origin HEAD
StephenHogg

comment created time in 44 minutes

push eventpymc-devs/pymc3

Eelke Spaak

commit sha a3a63da7d78188d870bb9b27a46cf6c14475e7e7

Fix str representations for KroneckerNormal and MatrixNormal (#4243) * fallback __str__ to default Theano on error * fix str repr for KroneckerNormal and MatrixNormal * black formatting * update release notes

view details

push time in 2 hours

PR merged pymc-devs/pymc3

Reviewers
Fix str representations for KroneckerNormal and MatrixNormal defects

Fixes #4240. Additionally, updates Distribution.__str__ and PyMC3Variable.__str__ such that they fallback to the old super().__str__ in case _str_repr_ raises an error (which might happen in e.g. custom distribution subclasses without _distr_params_for_repr defined).

+38 -3

1 comment

5 changed files

Spaak

pr closed time in 2 hours

issue closedpymc-devs/pymc3

Broken str representation for Kronecker Normal distribution

If you have questions about a specific use case, or you are not sure whether this is a bug or not, please post it to our discourse channel: https://discourse.pymc.io

Description of your problem

This issue popped out while I was in pdb debugger, figuring out the reason of failing test cases in #4207

Please provide a minimal, self-contained, and reproducible example.

>>> import numpy as np
>>> import pymc3 as pm
>>> K1 = np.array([[1., 0.5], [0.5, 2]])
>>> K2 = np.array([[1., 0.4, 0.2], [0.4, 2, 0.3], [0.2, 0.3, 1]])
>>> covs = [K1, K2]
>>> N = 6
>>> mu = np.zeros(N)
>>> with pm.Model() as model:
...     vals = pm.KroneckerNormal('vals', mu=mu, covs=covs, shape=N)
... 
>>> vals

Please provide the full traceback.

>>> vals
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sayam/.local/lib/python3.8/site-packages/theano/gof/graph.py", line 449, in __repr__
    to_print = [str(self)]
  File "/home/sayam/Desktop/pymc/pymc3/pymc3/model.py", line 83, in __str__
    return self._str_repr(formatting="plain", **kwargs)
  File "/home/sayam/Desktop/pymc/pymc3/pymc3/model.py", line 77, in _str_repr
    return self.distribution._str_repr(name=name, dist=dist, formatting=formatting)
  File "/home/sayam/Desktop/pymc/pymc3/pymc3/distributions/distribution.py", line 176, in _str_repr
    param_values = [
  File "/home/sayam/Desktop/pymc/pymc3/pymc3/distributions/distribution.py", line 177, in <listcomp>
    get_repr_for_variable(getattr(dist, x), formatting=formatting) for x in param_names
  File "/home/sayam/Desktop/pymc/pymc3/pymc3/util.py", line 131, in get_repr_for_variable
    name = variable.name if variable is not None else None
AttributeError: 'list' object has no attribute 'name'

Please provide any additional information below.

https://github.com/pymc-devs/pymc3/blob/ad63b94342260ca21d385f2539e243aaf62d26aa/pymc3/util.py#L130-L131

I imagine to use getattr for variable. Pinging @Spaak, @AlexAndorra to help here.

Versions and main components

  • PyMC3 Version: master
  • Theano Version: 1.0.11
  • Python Version: 3.8.6
  • Operating system: Ubuntu 18.04 LTS
  • How did you install PyMC3: (conda/pip) pip

closed time in 2 hours

Sayam753

Pull request review commentpymc-devs/pymc3

Test model logp before starting any MCMC chains

 def update_start_vals(a, b, model):     a.update({k: v for k, v in b.items() if k not in a})  +def check_start_vals(start, model):+    r"""Check that the starting values for MCMC do not cause the relevant log probability+    to evaluate to something invalid (e.g. Inf or NaN)+    Parameters

    Parameters
StephenHogg

comment created time in 3 hours

Pull request review commentpymc-devs/pymc3

Test model logp before starting any MCMC chains

 def test_nuts_tuning():      assert not step.tune     assert np.all(trace["step_size"][5:] == trace["step_size"][5])---def test_nuts_error_reporting(caplog):

Oh I get it, disregard.

StephenHogg

comment created time in 3 hours

Pull request review commentpymc-devs/pymc3

Test model logp before starting any MCMC chains

 def test_nuts_tuning():      assert not step.tune     assert np.all(trace["step_size"][5:] == trace["step_size"][5])---def test_nuts_error_reporting(caplog):

Why did you remove this test?

StephenHogg

comment created time in 3 hours

pull request commentpymc-devs/pymc3

Test model logp before starting any MCMC chains

Seems like there are still conflicts though:

Yes, that's what I'm saying - I can either leave the conflict in, in which case I can't merge, or I can resolve the conflict in which case linting fails because there's an unneeded import. It's a Catch-22.

StephenHogg

comment created time in 3 hours

pull request commentpymc-devs/pymc3

Test model logp before starting any MCMC chains

Seems like there are still conflicts though: Uploading image.png…

StephenHogg

comment created time in 3 hours

pull request commentpymc-devs/pymc3

Test model logp before starting any MCMC chains

There seem to be more problems, unfortunately. The resolution of the merge conflict in util.py resulted in an unnecessary import, which makes linting throw an error. In addition, ymc3/tests/test_examples.py::TestLatentOccupancy::test_run throws an error, which has not happened before. Specifically, the new check is complaining there's a non-finite evaluation of logp. Here's the output:

E               pymc3.exceptions.SamplingError: Initial evaluation of model at starting point failed!
E               Starting values:
E               {'psi': array(0.5, dtype=float32), 'z': array([1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1,
E                      0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0,
E                      0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0,
E                      0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0,
E                      1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0], dtype=int16), 'theta': array(5., dtype=float32), 'psi_logodds__': 0.0, 'theta_interval__': -2.944439}
E               
E               Initial evaluation results:
E               psi_logodds__       -1.390000
E               z                  -69.309998
E               theta_interval__    -3.050000
E               y                        -inf
E               Name: Log-probability of test_point, dtype: float64

I'll remove the unneeded import for now, but probably need guidance on the other error.

StephenHogg

comment created time in 3 hours

pull request commentpymc-devs/pymc3

Add github actions workflow for tests

@MarcoGorelli I prefer conda because it's a) much faster to install and b) sets everything up correctly with MKL. Furthermore, it's the recommended way to install PyMC3. Why do you think pip would be preferable?

aseyboldt

comment created time in 3 hours

pull request commentpymc-devs/pymc3

Add github actions workflow for tests

In this PR, the action creates a conda environment:

    steps:
    - uses: actions/checkout@v2
    - name: Cache conda and theano
      uses: actions/cache@v2
      env:
        # Increase this value to reset cache
        CACHE_NUMBER: 0
      with:
        path: |
          ~/conda_pkgs_dir
          ~/.theano
        key: ${{ runner.os }}-${{ matrix.floatx }}-py${{ matrix.python-version }}-${{ env.CACHE_NUMBER }}
    - name: Install miniconda
      uses: goanpeca/setup-miniconda@v1
      with:
        auto-update-conda: true
        activate-environment: pymc3-dev
        python-version: ${{ matrix.python-version }}
        channels: conda-forge,defaults
        channel-priority: strict
    - name: Install Dependences
      shell: bash -l {0}
      run: |
        conda install --yes --only-deps pymc3
        conda install coverage pytest parameterized dill nose nose-parameterized python-graphviz pytest-cov

Maybe we could use conda for the Windows job, and pip for the Linux one, so both are tested - I'll take a closer look tomorrow

aseyboldt

comment created time in 4 hours

pull request commentpymc-devs/pymc3

Add github actions workflow for tests

What do you mean by "using conda"?

aseyboldt

comment created time in 4 hours

pull request commentpymc-devs/pymc3

Add github actions workflow for tests

Do you have a strong preference for using conda? I just gave this a go using pip in my fork and it seems to work fine, see https://github.com/MarcoGorelli/pymc3/pull/2

aseyboldt

comment created time in 5 hours

pull request commentpymc-devs/pymc3

Restructure and update release notes.

Codecov Report

Merging #4250 (c891d45) into master (68d5201) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4250   +/-   ##
=======================================
  Coverage   88.19%   88.19%           
=======================================
  Files          89       89           
  Lines       14358    14358           
=======================================
  Hits        12663    12663           
  Misses       1695     1695           
twiecki

comment created time in 12 hours

issue openedpymc-devs/pymc3

Unable to draw prior samples from model

If you have questions about a specific use case, or you are not sure whether this is a bug or not, please post it to our discourse channel: https://discourse.pymc.io

Description of your problem

I have problems with drawing prior samples from my model. The model I am using is the linear trend component of a time series model (Facebook’s prophet model). I am using the implementation in PyMC3 of the timeseers package authored by @MBrouns. I’d like to draw prior sample from the model, but I keep running into some Theano error that I can’t figure out.

Please provide a minimal, self-contained, and reproducible example. Here is a minimal reproducer of the model (I basically stripped down the timeseers implementation to a minimal version so that it’s easier to understand here):

def linear_trend_model(X, y):
    t = X["t"].values
    n_changepoints = 1
    s = np.linspace(0, np.max(t), n_changepoints + 2)[1:-1]

    with pm.Model() as model:
        A = (t[:, None] > s) * 1.0

        delta = pm.Laplace("delta", 0, 0.05, shape=(n_changepoints,))
        k = pm.Normal("k", 0, 1.0)
        m = pm.Normal("m", 0, 5)
        gamma = -s * delta

        mu = (k + pm.math.sum(A * delta, axis=1)) * t + (m + pm.math.sum(A * gamma, axis=1))
        sigma = pm.HalfCauchy("sigma", 0.5)
        pm.Normal("obs", mu=mu, sd=sigma, observed=y)
    return model

To draw prior samples, I am creating some dummy data that I can feed into the model and then call pm.draw_sample_prior_predictive:

import pandas as pd
import numpy as np
import pymc3 as pm

t = np.linspace(0, 1, 24)
y = np.random.rand(len(t))
df = pd.DataFrame({'t': t, 'y': y})

with linear_trend_model(df, df.y):
    prior_trace = pm.sample_prior_predictive(10)

Please provide the full traceback. This yields this error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
~//path/to/lib/python3.7/site-packages/pymc3/distributions/distribution.py in _draw_value(param, point, givens, size)
    834                 try:
--> 835                     return dist_tmp.random(point=point, size=size)
    836                 except (ValueError, TypeError):

~//path/to/lib/python3.7/site-packages/pymc3/distributions/continuous.py in random(self, point, size)
    513         mu, tau, _ = draw_values([self.mu, self.tau, self.sigma],
--> 514                                  point=point, size=size)
    515         return generate_samples(stats.norm.rvs, loc=mu, scale=tau**-0.5,

~//path/to/lib/python3.7/site-packages/pymc3/distributions/distribution.py in draw_values(params, point, size)
    697                                             givens=givens.values(),
--> 698                                             size=size)
    699                         evaluated[param_idx] = drawn[(param, size)] = value

~//path/to/lib/python3.7/site-packages/pymc3/distributions/distribution.py in _draw_value(param, point, givens, size)
    875             func = _compile_theano_function(param, input_vars)
--> 876             output = func(*input_vals)
    877             return output

~//path/to/lib/python3.7/site-packages/numpy/lib/function_base.py in __call__(self, *args, **kwargs)
   2107 
-> 2108         return self._vectorize_call(func=func, args=vargs)
   2109 

~//path/to/lib/python3.7/site-packages/numpy/lib/function_base.py in _vectorize_call(self, func, args)
   2181         if self.signature is not None:
-> 2182             res = self._vectorize_call_with_signature(func, args)
   2183         elif not args:

~//path/to/lib/python3.7/site-packages/numpy/lib/function_base.py in _vectorize_call_with_signature(self, func, args)
   2222         for index in np.ndindex(*broadcast_shape):
-> 2223             results = func(*(arg[index] for arg in args))
   2224 

~//path/to/lib/python3.7/site-packages/theano/compile/function_module.py in __call__(self, *args, **kwargs)
    812                             arg, strict=s.strict,
--> 813                             allow_downcast=s.allow_downcast)
    814 

~//path/to/lib/python3.7/site-packages/theano/tensor/type.py in filter(self, data, strict, allow_downcast)
    194                 raise TypeError("Non-unit value on shape on a broadcastable"
--> 195                                 " dimension.", data.shape, self.broadcastable)
    196             i += 1

TypeError: ('Bad input argument to theano function with name "/Users/maximilianschmidt2//path/to/lib/python3.7/site-packages/pymc3/distributions/distribution.py:732" at index 0 (0-based). ', 'Non-unit value on shape on a broadcastable dimension.', (10,), (True,))

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
<ipython-input-11-4a0c0bbadcf5> in <module>
      1 with linear_trend_model(df, df.y):
----> 2     prior_trace = pm.sample_prior_predictive(10)

~//path/to/lib/python3.7/site-packages/pymc3/sampling.py in sample_prior_predictive(samples, model, vars, var_names, random_seed)
   1955     names = get_default_varnames(vars_, include_transformed=False)
   1956     # draw_values fails with auto-transformed variables. transform them later!
-> 1957     values = draw_values([model[name] for name in names], size=samples)
   1958 
   1959     data = {k: v for k, v in zip(names, values)}

~//path/to/lib/python3.7/site-packages/pymc3/distributions/distribution.py in draw_values(params, point, size)
    652                                         point=point,
    653                                         givens=temp_givens,
--> 654                                         size=size)
    655                     givens[next_.name] = (next_, value)
    656                     drawn[(next_, size)] = value

~//path/to/lib/python3.7/site-packages/pymc3/distributions/distribution.py in _draw_value(param, point, givens, size)
    842                     with _DrawValuesContextBlocker():
    843                         val = np.atleast_1d(dist_tmp.random(point=point,
--> 844                                                             size=None))
    845                     # Sometimes point may change the size of val but not the
    846                     # distribution's shape

~//path/to/lib/python3.7/site-packages/pymc3/distributions/continuous.py in random(self, point, size)
    512         """
    513         mu, tau, _ = draw_values([self.mu, self.tau, self.sigma],
--> 514                                  point=point, size=size)
    515         return generate_samples(stats.norm.rvs, loc=mu, scale=tau**-0.5,
    516                                 dist_shape=self.shape,

~//path/to/lib/python3.7/site-packages/pymc3/distributions/distribution.py in draw_values(params, point, size)
    696                                             point=point,
    697                                             givens=givens.values(),
--> 698                                             size=size)
    699                         evaluated[param_idx] = drawn[(param, size)] = value
    700                         givens[param.name] = (param, value)

~//path/to/lib/python3.7/site-packages/pymc3/distributions/distribution.py in _draw_value(param, point, givens, size)
    874                 input_vals = []
    875             func = _compile_theano_function(param, input_vars)
--> 876             output = func(*input_vals)
    877             return output
    878     raise ValueError('Unexpected type in draw_value: %s' % type(param))

~//path/to/lib/python3.7/site-packages/numpy/lib/function_base.py in __call__(self, *args, **kwargs)
   2106             vargs.extend([kwargs[_n] for _n in names])
   2107 
-> 2108         return self._vectorize_call(func=func, args=vargs)
   2109 
   2110     def _get_ufunc_and_otypes(self, func, args):

~//path/to/lib/python3.7/site-packages/numpy/lib/function_base.py in _vectorize_call(self, func, args)
   2180         """Vectorized call to `func` over positional `args`."""
   2181         if self.signature is not None:
-> 2182             res = self._vectorize_call_with_signature(func, args)
   2183         elif not args:
   2184             res = func()

~//path/to/lib/python3.7/site-packages/numpy/lib/function_base.py in _vectorize_call_with_signature(self, func, args)
   2210 
   2211         broadcast_shape, dim_sizes = _parse_input_dimensions(
-> 2212             args, input_core_dims)
   2213         input_shapes = _calculate_shapes(broadcast_shape, dim_sizes,
   2214                                          input_core_dims)

~//path/to/lib/python3.7/site-packages/numpy/lib/function_base.py in _parse_input_dimensions(args, input_core_dims)
   1871     dim_sizes = {}
   1872     for arg, core_dims in zip(args, input_core_dims):
-> 1873         _update_dim_sizes(dim_sizes, arg, core_dims)
   1874         ndim = arg.ndim - len(core_dims)
   1875         dummy_array = np.lib.stride_tricks.as_strided(0, arg.shape[:ndim])

~//path/to/lib/python3.7/site-packages/numpy/lib/function_base.py in _update_dim_sizes(dim_sizes, arg, core_dims)
   1837             '%d-dimensional argument does not have enough '
   1838             'dimensions for all core dimensions %r'
-> 1839             % (arg.ndim, core_dims))
   1840 
   1841     core_shape = arg.shape[-num_core_dims:]

ValueError: 0-dimensional argument does not have enough dimensions for all core dimensions ('i_1_0',)

Please provide any additional information below.

Versions and main components

  • PyMC3 Version: 3.9.3
  • Theano Version: 1.0.5
  • Python Version: 3.7.7
  • Operating system: Mac OS
  • How did you install PyMC3: pip

created time in 13 hours

startedxz/new.css

started time in 16 hours

pull request commentpymc-devs/pymc3

Add github actions workflow for tests

sorry about the intervention - the merge conflict was just about whitespace. But I still fucked it up - black wants an empty line behind that import 🙄

aseyboldt

comment created time in 17 hours

startedfastai/nbdev

started time in 17 hours

pull request commentpymc-devs/pymc3

test

sorry, I meant to push to this my own fork

MarcoGorelli

comment created time in 18 hours

PR closed pymc-devs/pymc3

test

Thank your for opening a PR!

Depending on what your PR does, here are a few things you might want to address in the description:

  • [ ] what are the (breaking) changes that this PR makes?
  • [ ] important background, or details about the implementation
  • [ ] are the changes—especially new features—covered by tests and docstrings?
  • [ ] consider adding/updating relevant example notebooks
  • [ ] right before it's ready to merge, mention the PR in the RELEASE-NOTES.md
+89 -68

0 comment

2 changed files

MarcoGorelli

pr closed time in 18 hours

PR opened pymc-devs/pymc3

test

Thank your for opening a PR!

Depending on what your PR does, here are a few things you might want to address in the description:

  • [ ] what are the (breaking) changes that this PR makes?
  • [ ] important background, or details about the implementation
  • [ ] are the changes—especially new features—covered by tests and docstrings?
  • [ ] consider adding/updating relevant example notebooks
  • [ ] right before it's ready to merge, mention the PR in the RELEASE-NOTES.md
+89 -68

0 comment

2 changed files

pr created time in 18 hours

Pull request review commentpymc-devs/pymc3

Add HyperGeometric Distribution to pymc3.distributions.discrete #4108

 def logp(self, value):         return bound(tt.log(p) + logpow(1 - p, value - 1), 0 <= p, p <= 1, value >= 1)  +class HyperGeometric(Discrete):+    R"""+    Discrete hypergeometric distribution.++    The probability of :math:`x` successes in a sequence of :math:`n` bernoulli+    trials taken without replacement from a population of :math:`N` objects,+    containing :math:`k` good (or successful or Type I) objects.+    The pmf of this distribution is++    .. math:: f(x \mid N, n, k) = \frac{\binom{k}{x}\binom{N-k}{n-x}}{\binom{N}{n}}++    .. plot::++        import matplotlib.pyplot as plt+        import numpy as np+        import scipy.stats as st+        plt.style.use('seaborn-darkgrid')+        x = np.arange(1, 15)+        N = 50+        k = 10+        for n in [20, 25]:+            pmf = st.hypergeom.pmf(x, N, k, n)+            plt.plot(x, pmf, '-o', label='n = {}'.format(n))+        plt.plot(x, pmf, '-o', label='N = {}'.format(N))+        plt.plot(x, pmf, '-o', label='k = {}'.format(k))+        plt.xlabel('x', fontsize=12)+        plt.ylabel('f(x)', fontsize=12)+        plt.legend(loc=1)+        plt.show()++    ========  =============================++    Support   :math:`x in [max(0, n - \mathbb{N} + k), min(k, n)]`+    Mean      :math:`\dfrac{nk}{N}`+    Variance  :math:`\dfrac{(N-n)nk(N-k)}{(N-1)N^2}`+    ========  =============================++    Parameters+    ----------+    N : integer+        Total size of the population+    n : integer+        Number of samples drawn from the population+    k : integer+        Number of successful individuals in the population+    """++    def __init__(self, N, k, n, *args, **kwargs):+        super().__init__(*args, **kwargs)+        self.N = intX(N)+        self.k = intX(k)+        self.n = intX(n)+        self.mode = intX(tt.floor((n + 1) * (k + 1) / (N + 2)))++    def random(self, point=None, size=None):+        r"""+        Draw random values from HyperGeometric distribution.++        Parameters+        ----------+        point : dict, optional+            Dict of variable values on which random values are to be+            conditioned (uses default point if not specified).+        size : int, optional+            Desired size of random sample (returns one sample if not+            specified).++        Returns+        -------+        array+        """+        N, n, k = draw_values([self.N, self.n, self.k], point=point, size=size)+        return generate_samples(+            np.random.hypergeometric, N, n, k, dist_shape=self.shape, size=size+        )++    def logp(self, value):+        r"""+        Calculate log-probability of HyperGeometric distribution at specified value.++        Parameters+        ----------+        value : numeric+            Value(s) for which log-probability is calculated. If the log probabilities for multiple+            values are desired the values must be provided in a numpy array or theano tensor++        Returns+        -------+        TensorVariable+        """+        N = self.N+        k = self.k+        n = self.n+        tot, good = N, k+        bad = tot - good+        result = (+            betaln(good + 1, 1)+            + betaln(bad + 1, 1)+            + betaln(tot - n + 1, n + 1)+            - betaln(value + 1, good - value + 1)+            - betaln(n - value + 1, bad - n + value + 1)+            - betaln(tot + 1, 1)+        )+        lower = tt.switch(tt.gt(n - N + k, 0), n - N + k, 0)

I'm a bit of a theano noob, but would

        lower = tt.clip(n - N + k, 0, n - N + k)

work?

Harivallabha

comment created time in 20 hours

Pull request review commentpymc-devs/pymc3

Add HyperGeometric Distribution to pymc3.distributions.discrete #4108

 def ref_rand(size, alpha, mu):     def test_geometric(self):         pymc3_random_discrete(pm.Geometric, {"p": Unit}, size=500, fails=50, ref_rand=nr.geometric) +    def test_hypergeometric(self):+        pymc3_random_discrete(pm.HyperGeometric, {"N": Nat, "n": Nat, "k": Nat}, size=500, fails=50, ref_rand=nr.hypergeometric)

np.random.hypergeometric takes arguments named differently than N, n, and k - you may need to define a helper ref_rand function here, as is done above in test_negative_binomial

Harivallabha

comment created time in 20 hours

startedcypress-io/cypress

started time in a day

issue commentCollinRooney12/htsprophet

runHTS.py does not work

Same. Still not working for me. Already added keyword arguments as mentioned in #7 but still getting the same error.

XanderHorn

comment created time in a day

more