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]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

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: keras-team/keras-preprocessing
Commit Name: 75c9e8cbcd9da21591cd5f8aaaa99205f48fa606
Time: 2021-01-19
Author: eli.osherovich@gmail.com
File Name: keras_preprocessing/image/image_data_generator.py
Class Name: ImageDataGenerator
Method Name: fit


Project Name: scikit-image/scikit-image
Commit Name: dd17b42f452bc156f55e3400f8ebc84d58761e65
Time: 2019-12-30
Author: gregory.lee@cchmc.org
File Name: skimage/filters/_window.py
Class Name:
Method Name: window


Project Name: neurodsp-tools/neurodsp
Commit Name: 441bab4b2277333e58823c0159206644c0b4eee9
Time: 2019-03-22
Author: tdonoghue@ucsd.edu
File Name: neurodsp/sim/utils.py
Class Name:
Method Name: normalize_variance