Commit 73ab8717 authored by lucas_miranda's avatar lucas_miranda
Browse files

Enhanced projection functionalities for all types of table_dict objects

parent 90bc023f
......@@ -1333,7 +1333,7 @@ class table_dict(dict):
X = proj.fit_transform(X)
if labels is not None:
X = np.concatenate([X, labels[:, np.newaxis]], axis=1)
return X, labels, proj
return X, proj
......@@ -1344,9 +1344,7 @@ class table_dict(dict):
to a n_components space. The sample parameter allows the user to randomly pick a subset of the data for
performance or visualization reasons"""
return self._project(
"random", n_components=n_components, kernel=kernel
)
return self._project("random", n_components=n_components, kernel=kernel)
def pca(
self, n_components: int = 2, sample: int = 1000, kernel: str = "linear"
......@@ -1355,9 +1353,7 @@ class table_dict(dict):
to a n_components space. The sample parameter allows the user to randomly pick a subset of the data for
performance or visualization reasons"""
return self._project(
"pca", n_components=n_components, kernel=kernel
)
return self._project("pca", n_components=n_components, kernel=kernel)
def tsne(
self, n_components: int = 2, sample: int = 1000, perplexity: int = 30
......@@ -1366,9 +1362,7 @@ class table_dict(dict):
to a n_components space. The sample parameter allows the user to randomly pick a subset of the data for
performance or visualization reasons"""
return self._project(
"tsne", n_components=n_components, perplexity=perplexity
)
return self._project("tsne", n_components=n_components, perplexity=perplexity)
def merge_tables(*args):
......
......@@ -57,9 +57,7 @@ def plot_heatmap(
ax=ax[i],
)
else:
sns.kdeplot(
x=heatmap.x, y=heatmap.y, cmap=None, shade=True, alpha=1, ax=ax
)
sns.kdeplot(x=heatmap.x, y=heatmap.y, cmap=None, shade=True, alpha=1, ax=ax)
ax = np.array([ax])
[x.set_xlim(xlim) for x in ax]
......
......@@ -295,6 +295,12 @@ def test_get_table_dicts(nodes, ego, exclude, sampler):
# deepof dimensionality reduction testing
assert isinstance(table.random_projection(n_components=2, sample=50), tuple)
assert isinstance(table.pca(n_components=2, sample=50), tuple)
assert isinstance(table.tsne(n_components=2, sample=50), tuple)
table = deepof.data.table_dict(
dict(table, **{"test1": table["test"]}), typ=table._type
)
print(table)
assert isinstance(table.random_projection(n_components=2), tuple)
assert isinstance(table.pca(n_components=2), tuple)
assert isinstance(table.tsne(n_components=2), tuple)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment