diff --git a/utils/reduction_dimension_2d.py b/utils/reduction_dimension_2d.py index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..ce6d9c7d50295f15171a20045b0967abfd668734 100644 --- a/utils/reduction_dimension_2d.py +++ b/utils/reduction_dimension_2d.py @@ -0,0 +1,8 @@ +from sklearn.decomposition import PCA + + + +def reduce_embeddings_2d(embeddings, n_components=2, random_state=42): + """Réduit les embeddings à 2 dimensions avec PCA.""" + pca = PCA(n_components=n_components, random_state=random_state) + return pca.fit_transform(embeddings) \ No newline at end of file