def test_const_vec(self): tf.standardize(np.array([2, 2, 2]))
def test_inf(self): tf.standardize(np.array([1, -1, np.inf, -2, 3, -3]))
def test_const_mat(self): tf.standardize(np.ones((6, 4)))
def test_vec(self): data_std = tf.standardize(np.array([1, -1, 2, -2, 3, -3])) assert np.isclose(np.mean(data_std), 0) assert np.isclose(np.std(data_std), 1)
def test_missing(self): tf.standardize(np.array([1, -1, np.nan, -2, 3, -3]))
def test_clean_data(self): data_std = tf.standardize(DATA1) assert np.allclose(np.mean(data_std, 0), np.zeros(DATA1.shape[1])) assert np.allclose(np.std(data_std, 0), np.ones(DATA1.shape[1]))