umap icon indicating copy to clipboard operation
umap copied to clipboard

Aligned UMAP issue

Open tariqul-islam opened this issue 3 years ago • 0 comments

Hi, I was trying to use alignedUMAP in one of my projects. However, I'm having some problems running it. Consider the following code snippets:

No 1.


n_neighbors= 5
n_components = 2
dim_in = 786
MIN_DIST = 0.1

np.random.seed(23423)

nA = 10000
nB = 25000
nC = 25000

SETA = np.random.randn(nA,dim_in)
SETB = np.random.randn(nB,dim_in)
SETC = np.random.randn(nC,dim_in)

print(SETA.shape, SETB.shape, SETC.shape)

D1 = np.concatenate((SETA, SETB))
D2 = np.concatenate((SETA, SETC))

slices = [D1, D2]

relation_dict = {i:i for i in range(len(SETA))}
relation_dicts = [relation_dict]

import umap
np.random.seed(100)
aligned_mapper = umap.AlignedUMAP(n_neighbors=n_neighbors,
                                  random_state=42).fit(slices, relations=relation_dicts)

No 2.


np.random.seed(23423)

nA = 100
nB = 29950
nC = 29950

SETA = np.random.randn(nA,dim_in)
SETB = np.random.randn(nB,dim_in)
SETC = np.random.randn(nC,dim_in)

print(SETA.shape, SETB.shape, SETC.shape)

D1 = np.concatenate((SETA, SETB))
D2 = np.concatenate((SETA, SETC))

slices = [D1, D2]

relation_dict = {i:i for i in range(len(SETA))}
relation_dicts = [relation_dict]

import umap
np.random.seed(100)
aligned_mapper = umap.AlignedUMAP(n_neighbors=n_neighbors,
                                  random_state=42).fit(slices, relations=relation_dicts)

The first one runs just fine. However, for the second one the kernel always dies in Jupyter notebook.

tariqul-islam avatar Feb 24 '22 18:02 tariqul-islam