def test_feature_pca(self): data = np.arange(6).reshape(3, 2) data = pd.DataFrame(data=data, columns=["col1", "col2"]) feature = Data(x_train=data, test_split_percentage=0.33, report_name="test") feature.pca(n_components=2) validate = feature.x_train.shape[1] == 2 and feature.x_test.shape[ 1] == 2 self.assertTrue(validate)
def test_feature_pcatarget(self): data = np.arange(9).reshape(3, 3) data = pd.DataFrame(data=data, columns=["col1", "col2", "col3"]) feature = Data( x_train=data, test_split_percentage=0.33, target_field="col3", report_name="test", ) feature.pca(n_components=2) validate = feature.col3 is not None and feature.x_train.shape[1] == 3 self.assertTrue(validate)