7da447b4b42c4b214fc464deb3a3166a9bace7b2,scanpy/preprocessing/simple.py,,filter_genes_dispersion,#Any#Any#Any#Any#Any#Any#Any#Any#Any#,110

Before Change


    from sklearn.preprocessing import StandardScaler
    scaler = StandardScaler(with_mean=False).partial_fit(X)
    mean = scaler.mean_
    var = scaler.var_ * (X.shape[0]/(X.shape[0]-1))  // use R convention (unbiased estimator)
    dispersion = var / (mean + 1e-12)
    if log:  // logarithmized mean as in Seurat
        dispersion[dispersion == 0] = np.nan

After Change


        disp_grouped = df.groupby("mean_bin")["dispersion"]
        disp_median_bin = disp_grouped.median()
        // the next line raises the warning: "Mean of empty slice"
        with warnings.catch_warnings():
            warnings.simplefilter("ignore")
            disp_mad_bin = disp_grouped.apply(robust.mad)
        df["dispersion_norm"] = np.abs((df["dispersion"].values
                                 - disp_median_bin[df["mean_bin"]].values)) \
                                / disp_mad_bin[df["mean_bin"]].values
    else:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: theislab/scanpy
Commit Name: 7da447b4b42c4b214fc464deb3a3166a9bace7b2
Time: 2017-05-22
Author: f.alex.wolf@gmx.de
File Name: scanpy/preprocessing/simple.py
Class Name:
Method Name: filter_genes_dispersion


Project Name: pfnet/optuna
Commit Name: 0ef17ad55a8d92903f648eaf02b25918a44ec4e1
Time: 2020-10-30
Author: norihitoishida@gmail.com
File Name: tests/samplers_tests/test_partial_fixed.py
Class Name:
Method Name: test_params_identity


Project Name: nipy/dipy
Commit Name: a17b669606cdc5c16fb823b5f00abcacf6a68d70
Time: 2012-10-24
Author: mrbago@gmail.com
File Name: dipy/reconst/dti.py
Class Name: TensorFit
Method Name: odf