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): ...@@ -1333,7 +1333,7 @@ class table_dict(dict):
X = proj.fit_transform(X) X = proj.fit_transform(X)
if labels is not None: if labels is not None:
X = np.concatenate([X, labels[:, np.newaxis]], axis=1) return X, labels, proj
return X, proj return X, proj
...@@ -1344,9 +1344,7 @@ class table_dict(dict): ...@@ -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 to a n_components space. The sample parameter allows the user to randomly pick a subset of the data for
performance or visualization reasons""" performance or visualization reasons"""
return self._project( return self._project("random", n_components=n_components, kernel=kernel)
"random", n_components=n_components, kernel=kernel
)
def pca( def pca(
self, n_components: int = 2, sample: int = 1000, kernel: str = "linear" self, n_components: int = 2, sample: int = 1000, kernel: str = "linear"
...@@ -1355,9 +1353,7 @@ class table_dict(dict): ...@@ -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 to a n_components space. The sample parameter allows the user to randomly pick a subset of the data for
performance or visualization reasons""" performance or visualization reasons"""
return self._project( return self._project("pca", n_components=n_components, kernel=kernel)
"pca", n_components=n_components, kernel=kernel
)
def tsne( def tsne(
self, n_components: int = 2, sample: int = 1000, perplexity: int = 30 self, n_components: int = 2, sample: int = 1000, perplexity: int = 30
...@@ -1366,9 +1362,7 @@ class table_dict(dict): ...@@ -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 to a n_components space. The sample parameter allows the user to randomly pick a subset of the data for
performance or visualization reasons""" performance or visualization reasons"""
return self._project( return self._project("tsne", n_components=n_components, perplexity=perplexity)
"tsne", n_components=n_components, perplexity=perplexity
)
def merge_tables(*args): def merge_tables(*args):
......
...@@ -57,9 +57,7 @@ def plot_heatmap( ...@@ -57,9 +57,7 @@ def plot_heatmap(
ax=ax[i], ax=ax[i],
) )
else: else:
sns.kdeplot( sns.kdeplot(x=heatmap.x, y=heatmap.y, cmap=None, shade=True, alpha=1, ax=ax)
x=heatmap.x, y=heatmap.y, cmap=None, shade=True, alpha=1, ax=ax
)
ax = np.array([ax]) ax = np.array([ax])
[x.set_xlim(xlim) for x in ax] [x.set_xlim(xlim) for x in ax]
......
...@@ -295,6 +295,12 @@ def test_get_table_dicts(nodes, ego, exclude, sampler): ...@@ -295,6 +295,12 @@ def test_get_table_dicts(nodes, ego, exclude, sampler):
# deepof dimensionality reduction testing # deepof dimensionality reduction testing
assert isinstance(table.random_projection(n_components=2, sample=50), tuple) table = deepof.data.table_dict(
assert isinstance(table.pca(n_components=2, sample=50), tuple) dict(table, **{"test1": table["test"]}), typ=table._type
assert isinstance(table.tsne(n_components=2, sample=50), tuple) )
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