Пример #1
0
 def transform(self, embset):
     names, X = embset.to_names_X()
     new_vecs = np.array(self.emb.transform(X))
     names_out = names + [f"tsne_{i}" for i in range(self.n_components)]
     vectors_out = np.concatenate([new_vecs, np.eye(self.n_components)])
     new_dict = new_embedding_dict(names_out, vectors_out, embset)
     return EmbeddingSet(new_dict, name=f"{embset.name}.tsne_{self.n_components}()")
Пример #2
0
 def transform(self, embset):
     names, X = embset_to_X(embset=embset)
     new_vecs = self.tfm.transform(X)
     names_out = names + [f"pca_{i}" for i in range(self.n_components)]
     vectors_out = np.concatenate([new_vecs, np.eye(self.n_components)])
     new_dict = new_embedding_dict(names_out, vectors_out, embset)
     return EmbeddingSet(new_dict,
                         name=f"{embset.name}.pca_{self.n_components}()")
Пример #3
0
 def transform(self, embset):
     names, X = embset.to_names_X()
     np.random.seed(self.seed)
     new_vecs = self.tfm.transform(X)
     new_dict = new_embedding_dict(names, new_vecs, embset)
     return EmbeddingSet(
         new_dict,
         name=f"{embset.name}",
     )
Пример #4
0
 def transform(self, embset):
     names, X = embset_to_X(embset=embset)
     with warnings.catch_warnings():
         warnings.simplefilter("ignore", category=NumbaPerformanceWarning)
         new_vecs = self.tfm.transform(X)
     names_out = names + [f"umap_{i}" for i in range(self.n_components)]
     vectors_out = np.concatenate([new_vecs, np.eye(self.n_components)])
     new_dict = new_embedding_dict(names_out, vectors_out, embset)
     return EmbeddingSet(new_dict,
                         name=f"{embset.name}.umap_{self.n_components}()")
Пример #5
0
 def transform(self, embset: EmbeddingSet) -> EmbeddingSet:
     names, X = embset.to_names_X()
     axis = 0 if self.feature else 1
     X = normalize(X, norm=self.norm, axis=axis)
     new_dict = new_embedding_dict(names, X, embset)
     return EmbeddingSet(new_dict, name=embset.name)