From d84df6efb0c6b001db6f0bed0a2c7254cc9b8b55 Mon Sep 17 00:00:00 2001 From: Paula Kramer Date: Tue, 12 Nov 2024 16:29:46 +0100 Subject: [PATCH] default tsne --- kinfraglib/filters/plots.py | 15 ++++++++++++--- .../2_2_custom_filters_analysis.ipynb | 3 ++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/kinfraglib/filters/plots.py b/kinfraglib/filters/plots.py index 0b672f04..d7b4d355 100644 --- a/kinfraglib/filters/plots.py +++ b/kinfraglib/filters/plots.py @@ -332,9 +332,18 @@ def debug_tsne(fragment_library): pca = PCA(n_components=50) crds = pca.fit_transform(list(fragment_library_concat["maccs"])) - # crds_embedded = TSNE( - # n_components=2, init="pca", learning_rate="auto" - # ).fit_transform(crds) + crds_embedded = TSNE( + n_components=2, init="pca", learning_rate="auto" + ).fit_transform(crds) + + +def debug_tsne_v2(): + import numpy as np + + X = np.array([[0, 0, 0], [0, 1, 1], [1, 0, 1], [1, 1, 1]]) + X_embedded = TSNE( + n_components=2, learning_rate="auto", init="random", perplexity=3 + ).fit_transform(X) def create_tsne_plots(fragment_library): diff --git a/notebooks/custom_kinfraglib/2_2_custom_filters_analysis.ipynb b/notebooks/custom_kinfraglib/2_2_custom_filters_analysis.ipynb index f1058baf..56654d90 100644 --- a/notebooks/custom_kinfraglib/2_2_custom_filters_analysis.ipynb +++ b/notebooks/custom_kinfraglib/2_2_custom_filters_analysis.ipynb @@ -1142,7 +1142,8 @@ "metadata": {}, "outputs": [], "source": [ - "filters.plots.debug_tsne(fragment_library)" + "#filters.plots.debug_tsne(fragment_library)\n", + "filters.plots.debug_tsne_v2()" ] }, {