PyAutoFit icon indicating copy to clipboard operation
PyAutoFit copied to clipboard

Matrix is not positive definite

Open rhayes777 opened this issue 5 years ago • 0 comments

../../../../autofit/graphical/declarative.py:114: in optimise self.mean_field_approximation() ../../../../autofit/graphical/expectation_propagation.py:352: in run model_approx, status = optimiser.optimise(factor, model_approx) ../../../../autofit/graphical/optimise.py:360: in optimise res.full_hess_inv) ../../../../autofit/graphical/factor_graphs/transform.py:196: in from_dense return cls(cho_factor(hess)) ../../../../../../anaconda3/envs/autolens/lib/python3.7/site-packages/scipy/linalg/decomp_cholesky.py:153: in cho_factor check_finite=check_finite)


a = array([[ 6.81790758e+04, -1.84507364e+03, -4.06077634e+02], [-1.87999409e+03, 2.40122572e+02, 5.23547334e+01], [-4.13671999e+02, 5.23522660e+01, 1.14148089e+01]]) lower = False, overwrite_a = False, clean = False, check_finite = True

def _cholesky(a, lower=False, overwrite_a=False, clean=True,
              check_finite=True):
    """Common code for cholesky() and cho_factor()."""

    a1 = asarray_chkfinite(a) if check_finite else asarray(a)
    a1 = atleast_2d(a1)

    # Dimension check
    if a1.ndim != 2:
        raise ValueError('Input array needs to be 2D but received '
                         'a {}d-array.'.format(a1.ndim))
    # Squareness check
    if a1.shape[0] != a1.shape[1]:
        raise ValueError('Input array is expected to be square but has '
                         'the shape: {}.'.format(a1.shape))

    # Quick return for square empty array
    if a1.size == 0:
        return a1.copy(), lower

    overwrite_a = overwrite_a or _datacopied(a1, a)
    potrf, = get_lapack_funcs(('potrf',), (a1,))
    c, info = potrf(a1, lower=lower, overwrite_a=overwrite_a, clean=clean)
    if info > 0:
        raise LinAlgError("%d-th leading minor of the array is not positive "
                        "definite" % info)

E numpy.linalg.LinAlgError: 3-th leading minor of the array is not positive definite

../../../../../../anaconda3/envs/autolens/lib/python3.7/site-packages/scipy/linalg/decomp_cholesky.py:38: LinAlgError

rhayes777 avatar Dec 02 '20 11:12 rhayes777