예제 #1
0
 def test_loss_se2(self):
     """Test that the loss is 0 at the true parameters."""
     gr = GeodesicRegression(
         self.se2,
         metric=self.metric_se2,
         center_X=False,
         method="extrinsic",
         max_iter=50,
         init_step_size=0.1,
         verbose=True,
     )
     loss = gr._loss(self.X_se2, self.y_se2, self.param_se2_true,
                     self.shape_se2)
     self.assertAllClose(loss.shape, ())
     self.assertTrue(gs.isclose(loss, 0.0))
예제 #2
0
 def test_loss_hypersphere(self):
     """Test that the loss is 0 at the true parameters."""
     gr = GeodesicRegression(
         self.sphere,
         metric=self.sphere.metric,
         center_X=False,
         method="extrinsic",
         verbose=True,
         max_iter=50,
         learning_rate=0.1,
     )
     loss = gr._loss(
         self.X_sphere,
         self.y_sphere,
         self.param_sphere_true,
         self.shape_sphere,
     )
     self.assertAllClose(loss.shape, ())
     self.assertTrue(gs.isclose(loss, 0.0))