-
Notifications
You must be signed in to change notification settings - Fork 238
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
grassmannian test visuaiization for 2D #1803
base: main
Are you sure you want to change the base?
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Codecov Report
@@ Coverage Diff @@
## master #1803 +/- ##
==========================================
- Coverage 91.50% 90.64% -0.85%
==========================================
Files 136 137 +1
Lines 13738 13963 +225
==========================================
+ Hits 12569 12655 +86
- Misses 1169 1308 +139
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Address my code review comments, specifically the ones on respecting the hw's guidelines, and resubmit.
Takes Grassmannian generated projection matrix | ||
and converts it to a plotable 2D point. | ||
|
||
INPUT: Array of 2x2 projection matricies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use numpy's convention for docstrings, see guidelines:
https://github.com/bioshape-lab/ece594n/tree/main/hw_geomviz
Takes Grassmannian generated projection matrix and | ||
converts it to a plotable 3D point. | ||
|
||
INPUT: Array of 3x3 projection matricies or a single projection matrix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow guidelines for docstrings: https://github.com/bioshape-lab/ece594n/tree/main/hw_geomviz
def two_d_to_projection(vector): | ||
"""Take 2D point on manifold and gets its corresponding projection. | ||
|
||
INPUT: Point on manifold as a 2x1 vector |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow guidelines for docstrings: https://github.com/bioshape-lab/ece594n/tree/main/hw_geomviz
return projection | ||
|
||
|
||
def submersion(point, k): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this function entirely (it is already coded in geomstats)
return gs.concatenate([row_1, row_2], axis=-2) | ||
|
||
|
||
def _squared_d_g_a(point_a, point_b, metric): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name this function _squared_dist_grad_point_a
for consistency with next funciton
ax.set_zticks([]) | ||
plt.show() | ||
|
||
def plot_tangent_space(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep this method! But follow guidelines for docstring
def plot_tangent_space(self): | ||
"""Plot Grassmanian tangent space. | ||
|
||
Warning: Under construction, do not use. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explain which case works in details
plt.plot(x_part, y_part, "-g") | ||
|
||
|
||
class GrassmannianCanonicalMetric(MatricesMetric, RiemannianMetric): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this class entirely. If you need the metric, import it direclty from geomstats:
from geomstats.geometry.grassmannian import GrassmannianCanonicalMetric
"""Test the plotting function of Grassmannian for 2 dimensions.""" | ||
self.grassmannian21.plot(True) | ||
|
||
def test_plot_2d_render(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow the hw's guidelines: the name of the test function should be the same as the name of the function being tests
i.e. rename to test_plot_rendering_2d
The Grassmannian :math:`Gr(n, k)` is the manifold of k-dimensional | ||
subspaces in n-dimensional Euclidean space. | ||
|
||
Lead author: Olivier Peltre. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove: the lead author of this file is not Olivier Peltre
View / edit / reply to this conversation on ReviewNB ninamiolane commented on 2023-02-13T16:47:17Z change the name of the ipynb file so that there is no uppercase (everything should be lower case) |
View / edit / reply to this conversation on ReviewNB ninamiolane commented on 2023-02-13T16:47:18Z Remove that sentence "The Grassmanian can be expressed in various ways: a set, a differentiable manifold, a set of orthogonal projections, a homogeneous space, or a scheme. One of the most significant qualities of a Grassmannian manifold is that they are an orbit space of the Steifel Manifold v n , k ��,� of orthonormal k � frames in G n �� . (Wolfram)" |
View / edit / reply to this conversation on ReviewNB ninamiolane commented on 2023-02-13T16:47:20Z Remove this image |
View / edit / reply to this conversation on ReviewNB ninamiolane commented on 2023-02-13T16:47:21Z Remove the sentence: "Today, Grassmanian manifolds are applied to computer vision problems such as video-based shape recognition. In computer vision applications, Grassman manifolds are used to compute distances between different images and shapes. " |
View / edit / reply to this conversation on ReviewNB ninamiolane commented on 2023-02-13T16:47:22Z Remove that image and the text below. |
View / edit / reply to this conversation on ReviewNB ninamiolane commented on 2023-02-13T16:47:23Z Remove this section III, as well as the references it cites (from section on references) |
View / edit / reply to this conversation on ReviewNB ninamiolane commented on 2023-02-13T16:47:25Z Line #8. # TODO: Change these paths with the corresponding paths on your computer Remove these lines and the TODO comment sys.path.append("/home/nmiolane/code/") sys.path.append("/home/nmiolane/code/ece594n/") sys.path.append("/home/nmiolane/code/ece594n/hw_geomviz") |
matplotlib.use("Agg") # NOQA | ||
|
||
|
||
class TestVisualizationGrassmanian(tests.conftest.TestCase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the functions:
projection_to_two_d
projection_to_three_d
should be tested as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and: two_d_to_projection
from geomstats.geometry.symmetric_matrices import SymmetricMatrices | ||
|
||
|
||
def projection_to_two_d(projections, points): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this a method of the Grassmanian class below + test it in the test file
return np.asarray(storage) | ||
|
||
|
||
def projection_to_three_d(projections, points): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this a method of the Grassmanian class below + test it in the test file
return np.asarray(storage) | ||
|
||
|
||
def two_d_to_projection(vector): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this a method of the Grassmanian class below + test it.
Point. | ||
point_b : array-like, shape=[..., dim] | ||
Point. | ||
metric : SpecialEuclideanMatrixCannonicalLeftMetric |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just say it is a RiemannianMetric
test for 2d visualization