e77dda15bfd5dbc415ad63c4838a5d0ef21bd1d9,pymc3/diagnostics.py,,effective_n,#Any#Any#Any#,171

Before Change


        // make sure to handle scalars correctly - add extra dim if needed
        if len(x.shape) == 2:
            is_scalar = True
            x = np.atleast_3d(mtrace.get_values(var, combine=False))
        else:
            is_scalar = False

        // now we are going to transpose all dims - makes the loop below
        // easier by moving the axes of the variable to the front instead
        // of the chain and sample axes
        x = x.transpose()

        Vhat = get_vhat(x)

        // get an array the same shape as the var
        _n_eff = np.zeros(x.shape[:-2])

        // iterate over tuples of indices of the shape of var
        for tup in np.ndindex(*list(x.shape[:-2])):
            _n_eff[tup] = get_neff(x[tup], Vhat[tup])

        // we could be using np.squeeze here, but we don"t want to squeeze
        // out dummy dimensions that a user inputs
        if is_scalar:
            n_eff[var] = _n_eff[0]
        else:
            // make sure to transpose the dims back
            n_eff[var] = np.transpose(_n_eff)

    return n_eff

After Change



    if not isinstance(mtrace, MultiTrace):
        // Return neff for non-multitrace array
        return generate_neff(mtrace)

    if mtrace.nchains < 2:
        raise ValueError(
            "Calculation of effective sample size requires multiple chains "
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: pymc-devs/pymc3
Commit Name: e77dda15bfd5dbc415ad63c4838a5d0ef21bd1d9
Time: 2017-10-28
Author: siobhankcronin@gmail.com
File Name: pymc3/diagnostics.py
Class Name:
Method Name: effective_n


Project Name: ANSSI-FR/SecuML
Commit Name: 984afb6e438cabf024139785ab4b18c858af4163
Time: 2019-04-26
Author: anael.beaugnon@ssi.gouv.fr
File Name: secuml/core/classif/classifiers/__init__.py
Class Name: Classifier
Method Name: apply_pipeline


Project Name: ANSSI-FR/SecuML
Commit Name: 557fea369f48500b30bda8d2f1572ac4c4ebad55
Time: 2019-09-03
Author: anael.beaugnon@ssi.gouv.fr
File Name: secuml/core/clustering/algos/gaussian_mixture.py
Class Name: GaussianMixture
Method Name: get_predicted_proba