Skip to content

tf-probability error using Wishart prior #194

@doctorwes

Description

@doctorwes

I am having trouble estimating a covariance matrix using a Wishart prior. This may be related to a previously reported issue in tensorflow-probability: https://github.com/GPflow/GPflow/issues/553

Error message:

InvalidArgumentError: Cholesky decomposition was not successful. The input might not be valid. [[{{node cov_194/log_prob/Cholesky}}]]

Code:

def flat_model(mean=mean0, cov=cov0):
    meanrets = inf.Normal(mean0, scale=0.01, name='meanrets')
    cov = inf.Wishart(df=n, scale=cov0, name='cov')
    with inf.datamodel():
        x = inf.MultivariateNormalFullCovariance(loc=meanrets, covariance_matrix=cov, name='x')
 
@inf.probmodel
def flat_qmodel():
    q_means_loc = inf.Parameter(np.zeros([n]), name='q_means_loc')
    q_means_scale = tf.math.softplus(inf.Parameter(np.ones([n]), name='q_means_scale'))
    qmeans = inf.Normal(q_means_loc, q_means_scale, name='meanrets')  
    q_cov_scale = inf.Parameter(np.diag(n*[1.]), name='q_cov_scale')
    qcov = inf.Wishart(df=n, scale=q_cov_scale, name='cov')```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions