Example #1
0
 def test_sparse_pps(self):
     self.data.X = csr_matrix(self.data.X)
     out = AdaptiveNormalize()(self.data)
     true_out = Scale(center=Scale.NoCentering, scale=Scale.Span)(self.data)
     np.testing.assert_array_equal(out, true_out)
     self.data = self.data.X.toarray()
Example #2
0
 def test_scaling_median_stddev(self):
     table = Scale(center=Scale.Median, scale=Scale.Std)(self.table)
     np.testing.assert_almost_equal(np.std(table, 0), 1)
Example #3
0
 def test_scaling_pickling(self):
     c = Scale(center=Scale.Median, scale=Scale.Span)
     s = pickle.dumps(c, -1)
     c1 = pickle.loads(s)
     self.assertIs(c1.center, c.center)
     self.assertIs(c1.scale, c.scale)
Example #4
0
 def test_scaling_mean_span(self):
     table = Scale(center=Scale.Mean, scale=Scale.Span)(self.table)
     np.testing.assert_almost_equal(np.mean(table, 0), 0)
     np.testing.assert_almost_equal(np.ptp(table, 0), 1)