예제 #1
0
 def test_standardize_with_scaler(self):
     scaler = StandardScaler()
     scaler.fit(self.data)
     self.assertTrue(
         np.array_equal(scaler.transform(self.data),
                        Normalizer.standardize(self.data, scaler)[1]))
     self.assertEqual(scaler, Normalizer.standardize(self.data, scaler)[0])
예제 #2
0
 def test_get_normalizer_standardize_with_scaler(self):
     scaler = StandardScaler()
     scaler.fit(self.data)
     self.assertTrue(
         np.array_equal(
             Normalizer.standardize(self.data, fitted_scaler=scaler)[1],
             Normalizer.get_normalizer(Normalizer.STANDARDIZE,
                                       data=self.data,
                                       fitted_scaler=scaler)[1]))
     self.assertTrue(
         Normalizer.standardize(self.data, fitted_scaler=scaler)[0],
         Normalizer.get_normalizer(Normalizer.STANDARDIZE,
                                   data=self.data,
                                   fitted_scaler=scaler)[0])
예제 #3
0
 def test_get_normalizer_standardize(self):
     self.assertTrue(
         np.array_equal(
             Normalizer.standardize(self.data)[1],
             Normalizer.get_normalizer(Normalizer.STANDARDIZE,
                                       data=self.data)[1]))
예제 #4
0
 def test_standardize(self):
     self.assertTrue(
         np.array_equal(StandardScaler().fit_transform(self.data),
                        Normalizer.standardize(self.data)[1]))