4fa15dade9f2174a602a28682d2f1013dba3ef78,src/pyscenic/binarization.py,,_derive_threshold,#,13

Before Change


    data = auc_mtx[regulon_name].values.reshape(-1, 1)
    gmm = mixture.GaussianMixture(n_components=2, covariance_type="full").fit(data)
    idx = np.argmax(gmm.means_)
    return max((gmm.means_[idx] - 1 * sqrt(gmm.covariances_[idx]))[0], 0)

def binarize(auc_mtx: pd.DataFrame) -> (pd.DataFrame, pd.Series):
    

After Change


    data = auc_mtx[regulon_name].values.reshape(-1, 1)
    gmm = mixture.GaussianMixture(n_components=2, covariance_type="full").fit(data)
    avgs = gmm.means_
    stds = np.sqrt(gmm.covariances_.reshape(-1, 1))

    // The threshold is based on the distribution with the highest mean and is defined as (mu - 2 x std)
    idx = np.argmax(avgs)
    threshold = max(avgs[idx] - 2 * stds[idx], 0)
    // This threshold cannot be lower than (mu + 2 x std) based on the distribution with the lowest mean.
    idx = np.argmin(avgs)
    lower_bound = avgs[idx] + 2 * stds[idx]

    return max(lower_bound, threshold)

def binarize(auc_mtx: pd.DataFrame) -> (pd.DataFrame, pd.Series):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: aertslab/pySCENIC
Commit Name: 4fa15dade9f2174a602a28682d2f1013dba3ef78
Time: 2018-05-09
Author: vandesande.bram@gmail.com
File Name: src/pyscenic/binarization.py
Class Name:
Method Name: _derive_threshold


Project Name: GPflow/GPflowOpt
Commit Name: b96598a16031c8b940e991f7c1bf80d702fea07f
Time: 2017-09-27
Author: Pxidbpb4Lq
File Name: gpflowopt/acquisition/mes.py
Class Name: MinValueEntropySearch
Method Name: _setup


Project Name: astroML/astroML
Commit Name: 4e70cb5fc9a9494e866ccd7d2e1a9046091b6337
Time: 2018-11-16
Author: bsipocz@gmail.com
File Name: astroML/density_estimation/gauss_mixture.py
Class Name: GaussianMixture1D
Method Name: __init__