probcomp / crosscat

A domain-general, Bayesian method for analyzing high-dimensional data tables
http://probcomp.csail.mit.edu/crosscat/
Apache License 2.0
322 stars 42 forks source link

Evaluating predictive probability for unobserved row throws assertion error with constraints #47

Closed fsaad closed 9 years ago

fsaad commented 9 years ago

In sample_utils.py invoking the function

def simple_predictive_probability_unobserved(M_c, X_L, X_D, Y,
    query_row, query_columns, elements)

With constraints Y not equal to [] causes an assertion error in the line:

# cluster_logps should logsumexp to log(1)
assert(numpy.abs(logsumexp(cluster_logps)) < .0000001)

Here is example:

File "/home/riastradh/crosscat/master/build/lib.linux-x86_64-2.7/crosscat/utils/sample_utils.py", line 122, in simple_predictive_probability_unobserved
    assert(numpy.abs(logsumexp(cluster_logps)) < .0000001)
AssertionError: assert 4.0103806420029304 < 1e-07
 +  where 4.0103806420029304 = <ufunc 'absolute'>(-4.0103806420029304)
 +    where <ufunc 'absolute'> = <ufunc 'absolute'>
 +      where <ufunc 'absolute'> = numpy.abs
 +    and   -4.0103806420029304 = logsumexp(array([-4.10965973, -6.86404678, -9.5251692 , -7.78917709, -8.61550711]))