eamid/trimap

IndexError in running trimap with precomputed values

groceryheist opened this issue · 2 comments

To reproduce:

import trimap
import numpy as np
import pandas as pd

cossims = pd.read_feather("wiki_rule_cosinesimilarities.feather")

distmat = 1 - np.matrix(cossims.iloc[:,0:cossims.shape[0]],'double')

tmap = trimap.TRIMAP(use_dist_matrix=True)
tmap = tmap.fit_transform(distmat)

I'm attaching the data in a zipfile.
wiki_rule_cosinesimilarities.feather.zip

eamid commented

The problem is that you're passing an np.matrix as input. You should pass an np.array instead:

import trimap
import numpy as np
import pandas as pd

cossims = pd.read_feather("wiki_rule_cosinesimilarities.feather")

distmat = 1 - np.matrix(cossims.iloc[:,0:cossims.shape[0]],'double')

# convert to np.array
distmat = np.array(distmat)

tmap = trimap.TRIMAP(use_dist_matrix=True)
tmap = tmap.fit_transform(distmat)
eamid commented

Sorry, I understand that use_dist_matrixis a bit misleading! I'll add a line to convert the input into a numpy array.