Skip to content
Snippets Groups Projects
UMAP_.py 699 B
Newer Older
DIANE's avatar
DIANE committed
# UMAP function for the Sample Selection module
from Packages import * 
from Class_Mod.DATA_HANDLING import * 

DIANE's avatar
DIANE committed

class Umap:
    def __init__(self, x, n_components, n_neighbors, min_dist):
        self.numerical_data, categorical_data, scaled_values = col_cat(x)
        self.catdata = list(categorical_data.columns)

        self.x = scaled_values
        
        self.model = UMAP(n_neighbors=20, n_components=4, min_dist=0.0,) # random_state=42,)
DIANE's avatar
DIANE committed
        self.model.fit(self.x)
        self.scores = self.model.transform(self.x)
        self.scores = pd.DataFrame(self.scores, index = self.numerical_data.index)

    @property
    def scores_(self):
        return self.scores