Beispiel #1
0
 def test_intrinsic_dim_mle_levina_low_memory(self):
     """ Same as above, but invoking the speed-memory trade-off. """
     _, _, vector = load_dexter()
     ID_MLE_REF = 74.472
     id_mle = intrinsic_dimension(vector, 6, 12, 'levina', 
                                  'vector', None, mem_threshold=0)
     return np.testing.assert_almost_equal(id_mle, ID_MLE_REF, decimal=3)
Beispiel #2
0
 def test_intrinsic_dim_mle_levina(self):
     """Test against value calc. by matlab reference implementation."""
     _, _, vector = load_dexter()
     ID_MLE_REF = 74.472
     id_mle = intrinsic_dimension(vector, k1=6, k2=12, 
         estimator='levina', metric='vector', trafo=None)
     return np.testing.assert_almost_equal(id_mle, ID_MLE_REF, decimal=3)
 def _calc_intrinsic_dim(self):
     """Calculate intrinsic dimension estimate."""
     self.intrinsic_dim = intrinsic_dimension(X=self.vectors)
     return self
Beispiel #4
0
 def test_incorrect_metric_other(self):
     """ Test handling of unsupported metric parameters."""
     with self.assertRaises(ValueError):
         intrinsic_dimension(self.vector, metric=None)
Beispiel #5
0
 def test_incorrect_metric_sim(self):
     """ Test handling of unsupported metric parameters."""
     with self.assertRaises(NotImplementedError):
         intrinsic_dimension(self.vector, metric='similarity')
Beispiel #6
0
 def test_incorrect_trafo_params(self):
     """ Test handling of incorrect transformation parameters."""
     with self.assertRaises(ValueError):
         intrinsic_dimension(self.vector, trafo=0)
Beispiel #7
0
 def test_incorrect_k2_params(self):
     """ Test handling of incorrect neighborhood parameters."""
     n = self.vector.shape[0]
     with self.assertRaises(ValueError):
         intrinsic_dimension(self.vector, k2=n)
Beispiel #8
0
 def test_incorrect_est_params(self):
     """ Test handling of incorrect estimator. """
     with self.assertRaises(ValueError):
         intrinsic_dimension(self.vector, 
             estimator='the_single_truly_best_id_estimator')