94ec55bd5c13d75a590f82d41ff66e422bc11b1d,scanpy/tools/tsne.py,,tsne,#Any#Any#Any#,26

Before Change


        Y : np.ndarray
            tSNE representation of the data.
    
    params = locals(); del params["adata"]
    sett.m(0,"perform tSNE")
    sett.m(0,"--> mind that this is not deterministic!")
    // preprocessing by PCA
    if "X_pca" in adata:
        X = adata["X_pca"]
        sett.m(0, "using X_pca for tSNE")
    else:
        if params["n_pcs"] > 0 and adata.X.shape[1] > params["n_pcs"]:
            sett.m(0, "preprocess using PCA with", params["n_pcs"], "PCs")
            sett.m(0, "--> avoid this by setting n_pcs = 0")
            dpca = pca(adata, n_comps=params["n_pcs"])

After Change


        if n_pcs > 0 and adata.X.shape[1] > n_pcs:
            sett.m(0, "preprocess using PCA with", n_pcs, "PCs")
            sett.m(0, "--> avoid this by setting n_pcs = 0")
            X = pca(adata.X, n_comps=n_pcs)
            adata["X_pca"] = X
        else:
            X = adata.X
    // params for sklearn
    params_sklearn = {"perplexity" : perplexity}
    params_sklearn["verbose"] = sett.verbosity
    // deal with different tSNE implementations
    try:
        from MulticoreTSNE import MulticoreTSNE as TSNE
        tsne = TSNE(n_jobs=4, **params_sklearn)
        sett.m(0,"... compute tSNE using MulticoreTSNE")
        Y = tsne.fit_transform(X)
    except ImportError:
        try:
            from sklearn.manifold import TSNE
            tsne = TSNE(**params_sklearn)
            sett.m(1,"--> perform tSNE using sklearn!")
            sett.m(1,"--> can be sped up by installing\n" 
                     "    https://github.com/DmitryUlyanov/Multicore-TSNE")
            Y = tsne.fit_transform(X)            
        except ImportError:
            sett.m(0,"--> perform tSNE using slow/unreliable original\n" 
                     "    code by L. van der Maaten!?\n"
                     "--> consider installing sklearn\n"
                     "    using "conda/pip install scikit-learn"")
            Y = _tsne_vandermaaten(X, 2, params["perplexity"])
    adata["X_tsne"] = Y
    return adata

def plot(adata,
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: theislab/scanpy
Commit Name: 94ec55bd5c13d75a590f82d41ff66e422bc11b1d
Time: 2017-02-20
Author: f.alex.wolf@gmx.de
File Name: scanpy/tools/tsne.py
Class Name:
Method Name: tsne


Project Name: soft-matter/trackpy
Commit Name: dbeab7509cfec1314b6529d57fbd090ce744695c
Time: 2017-07-27
Author: caspervdw@gmail.com
File Name: trackpy/motion.py
Class Name:
Method Name: compute_drift


Project Name: theislab/scanpy
Commit Name: 7bc8e6dce4229d4924ad01792f3c913cfb250d9e
Time: 2017-04-24
Author: f.alex.wolf@gmx.de
File Name: scanpy/tools/diffmap.py
Class Name:
Method Name: diffmap