-
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
Special linear #1810
base: main
Are you sure you want to change the base?
Special linear #1810
Conversation
…stats into special_linear Trying to gte it work locally
…t of special_linear as a part og geomviz hw for ECE594N
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
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 the following before we can merge:
- Address DeepSource errors (style)
- Address Linting errors (style)
- If you had observed conflicts between black and flake8 code style, this should have been fixed. See this PR.
- Polish the notebook, so that it can be used as a tutorial for someone discovering SL2 (see example of the stiefel manifold in another PR, for inspiration)
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.
Very nice!
"""Evaluate if a point belongs to the group. | ||
|
||
Check the size and the value of the determinant. | ||
Parameters |
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.
Clean the docstring style.
See errors in GitHub action's linting: they ask you to add blank lines between the sections of a docstring.
Also see the ECE594n HW guidelines which show an example of how docstring should be formatted.
return has_right_shape | ||
|
||
def projection(self, point): | ||
"""Project a point in embedding space to the group. |
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.
Ditto
return gs.einsum("...ij,...->...ij", proj_point, 1.0 / scale_coeff) | ||
|
||
def random_point(self, n_samples=1, bound=1.0): | ||
"""Sample in the group. |
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.
Ditto
"""Class for the Lie algebra sl(n) of the Special Linear group. | ||
|
||
This is the space of matrices of size n with vanishing trace. | ||
Parameters |
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.
Ditto
cubes = Cubes() | ||
cubes.animate(points=points) | ||
|
||
return ax |
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.
Using black on this file should make these warnings go away
Y_trans = pts[1] | ||
Z_trans = pts[2] | ||
ax.scatter3D(X_trans, Y_trans, Z_trans) | ||
pts_T = gs.transpose(pts) |
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.
Ditto: no uppercase
) | ||
|
||
def animate(self, points, ax=None, **point_draw_kwargs): | ||
"""Animation of the unit cube. |
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.
Ditto: "Animate..."
@@ -0,0 +1,5 @@ | |||
from tests.tests_geomstats.test_visualization_special_linear import * |
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 file, this is not a notebook.
from tests.conftest import TestCase | ||
from tests.data_generation import _LieGroupTestData, _MatrixLieAlgebraTestData | ||
|
||
# from tests.parametrizers import LieGroupParametrizer, MatrixLieAlgebraParametrizer |
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.
Rm leftover comment
# from tests.parametrizers import LieGroupParametrizer, MatrixLieAlgebraParametrizer | ||
|
||
|
||
# TODO: very similar to GeneralLinear tests (simplify common 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.
Rm leftover comment
skip_test_exp_log_composition = True | ||
skip_test_log_exp_composition = True | ||
|
||
class TestDataSpecialLinear(_LieGroupTestData): |
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.
Hard/Expert (you can, but don't have to, address it): put this class into a special file within the tests/data folder and adapt the code accordingly. You can get inspiration on how it is done for other classes in geomstats: we have two files: one test file, and one data file.
@@ -0,0 +1,337 @@ | |||
{ |
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.
To make this notebook pass, try adding a Set up section with the code pasted from this example.
Correct typo in title
Reply via ReviewNB
Checklist
Description
Modified special_linear.py in geomstats.geometry and added codes on visualization for the special linear group
Submission as a part of geomviz hw of ECE594N
Co-authored-by: Pieter Derksen 98928045+pieterderksen-ucsb@users.noreply.github.com
Co-authored-by: Molly Kaplan 123593445+mollykaplan@users.noreply.github.com
Issue
Fixes inconsistencies in special_linear coming due to differences in the older (when special_linear was originally written by luisfpereira) and current versions of geomstats.
Additional context
Modified special_linear.py in geomstats.geometry
Added a file called special_linear in geomstats.visualization and modified __init__.py accordingly
Added a file called test_visualization_special_linear in tests.tests_geomstats to check the visualization functions defined
Added a notebook called special_linear in notebooks which checks the modifications to special_linear.py in geomstats.geometry and the functions defined in test_visualization_special_linear.py. Also added a file special_linear.py in notebooks to shows the animations.