def fit(self, embset): names, X = embset_to_X(embset=embset) with warnings.catch_warnings(): warnings.simplefilter("ignore", category=UserWarning) warnings.simplefilter("ignore", category=NumbaPerformanceWarning) self.tfm.fit(X) self.is_fitted = True
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}()")
def transform(self, embset): names, X = embset_to_X(embset=embset) 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}", )
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}()")
def transform(self, embset): names, X = embset_to_X(embset=embset) np.random.seed(self.seed) orig_dict = embset.embeddings.copy() new_dict = { f"rand_{k}": Embedding(f"rand_{k}", np.random.normal(0, self.sigma, X.shape[1])) for k in range(self.n) } return EmbeddingSet({**orig_dict, **new_dict})
def fit(self, embset): names, X = embset_to_X(embset=embset) self.tfm.fit(X) self.is_fitted = True
def fit(self, embset): embset_to_X(embset=embset) self.is_fitted = True