def test_pipeline_step(self): tr_data_X, tr_data_y = rand_df_classification(shape=(100, 20), classes=3) te_data = rand_df(shape=(100, 20), labeled=False) scale_step = StandardScalerStep() chi_step = ChiSqSelectionStep(select_kwargs={'k': 20}) corr_step = PearsonCorrStep(num_features=0.1) pca_step = PCAStep(append_input=False, kwargs={'n_components': 5}) poly_step = PolyStep(kwargs={'degree': 3, 'include_bias': False}) pipeline = Pipeline([ scale_step, Pipeline([pca_step, poly_step], append_input=True), chi_step ]) r, _ = pipeline.fit_transform(tr_data_X, y=tr_data_y) self.assertEqual(type(r), pd.DataFrame) r = pipeline.transform(te_data) self.assertEqual(type(r), pd.DataFrame)
class SMOTETests1(unittest.TestCase, StepTest): step = SMOTEStep() X, y = rand_df_classification(val_range=(0, 100)) test_X = rand_df(val_range=(0, 100))
class ADASYNTests1(unittest.TestCase, StepTest): step = ADASYNStep(kwargs={'ratio': {0.0: 100, 1.0: 100}}) X, y = rand_df_classification(val_range=(0, 100)) test_X = rand_df(val_range=(0, 100))
class LDATransform2(unittest.TestCase, StepTest): step = LDATransformStep(append_input=True) X, y = rand_df_classification() test_X = rand_df(labeled=False)
class LDATransform1(unittest.TestCase, StepTest): step = LDATransformStep() X, y = rand_df_classification() test_X = rand_df(labeled=False)
class LFODefault(unittest.TestCase, StepTest): step = LOFStep() X, y = rand_df_classification(outlier=True) test_X = rand_df(labeled=False, outlier=True)
class ABODTests(unittest.TestCase, StepTest): step = ABODStep(num_remove=1) X, y = rand_df_classification(outlier=True) test_X = rand_df(labeled=False, outlier=True)
class TreeTests2(unittest.TestCase, StepTest): step = TreeSelectionStep(tree_model=ExtraTreesClassifier) X, y = rand_df_classification() test_X = rand_df(labeled=False)
class LassoTests(unittest.TestCase, StepTest): step = LassoSelectionStep() X, y = rand_df_classification() test_X = rand_df(labeled=False)