8000 Benedict: Visualization of manifolds of categorical distributions by Benleeee · Pull Request #1813 · geomstats/geomstats · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Benedict: Visualization of manifolds of categorical distributions #1813

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
484 changes: 484 additions & 0 deletions geomstats/visualization/CategoricalDistributionsManifold.py

Large diffs are not rendered by default.

723 changes: 723 additions & 0 deletions notebooks/CategoricalDistributionsManifold.ipynb

Large diffs are not rendered by default.

Binary file added notebooks/images/coins.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/images/color_naming.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/images/dice.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/images/dome.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/images/simplex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
"""Unit tests for visualization."""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for visualization of the manifold of categorical distributions


import geomstats.visualization as visualization
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import tests.conftest

from CategoricalDistributionsManifold import CategoricalDistributionsManifold

matplotlib.use("Agg") # NOQA


class TestVisualizationManifoldOfCategoricalDistributions(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to TestVisualizationCategorical

tests.conftest.TestCase):
def setup_method(self):
self.n_samples = 10
self.CD2 = CategoricalDistributionsManifold(dim=2)
self.CD3 = CategoricalDistributionsManifold(dim=3)
plt.figure()

@staticmethod
def test_tutorial_matplotlib():
visualization.tutorial_matplotlib()

def test_plot(self):
self.CD2.plot()
self.CD3.plot()

def test_scatter(self):
self.CD2.scatter(self.n_samples)
self.CD3.scatter(self.n_samples)

def test_plot_geodesic(self):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing test_plot_log, test_plot_exp, test__plot_two_points_and_a_vector

b2 = np.array([0.2, 0.3, 0.5])
v2 = np.array([1, 0, 0])
self.CD2.plot_geodesic(initial_point=b2, tangent_vector=v2)

b3 = np.array([0.3, 0.3, 0.2, 0.2])
v3 = np.array([1, 0, 0, 0])
self.CD3.plot_geodesic(initial_point=b3, tangent_vector=v3)

def test_plot_grid(self):
self.CD2.plot_grid()

@staticmethod
def teardown_method():
plt.close()
0