def test_binarizer(self): trfm_obj = Binarizer() trfm_obj, feature_names, target_name = auto_dataset_for_regression( trfm_obj) self.assertEqual(pp.get_class_name(trfm_obj), trfm_obj.__class__.__name__) self.assertEqual( pp.get_derived_colnames('binarizer', ['displacement']), ['binarizer(displacement)']) self.assertEqual( pp.binarizer(trfm_obj, feature_names)['der_fld'][0].__class__.__name__, pml.DerivedField().__class__.__name__) self.assertEqual( pp.binarizer(trfm_obj, feature_names)['der_fld'][0].get_optype(), "continuous") self.assertEqual( pp.binarizer(trfm_obj, feature_names)['der_fld'][0].get_dataType(), "double") self.assertEqual( pp.binarizer(trfm_obj, feature_names)['der_fld'] [0].get_Apply().get_Constant()[0].get_valueOf_(), trfm_obj.threshold)
def test_max_abs_scaler(self): trfm_obj = MaxAbsScaler() trfm_obj, feature_names, target_name = auto_dataset_for_regression( trfm_obj) self.assertEqual(pp.get_class_name(trfm_obj), trfm_obj.__class__.__name__) self.assertEqual( pp.get_derived_colnames('max_abs__scaler', ['displacement']), ['max_abs__scaler(displacement)']) self.assertEqual( pp.max_abs_scaler(trfm_obj, feature_names)['der_fld'][0].__class__.__name__, pml.DerivedField().__class__.__name__) self.assertEqual( pp.max_abs_scaler(trfm_obj, feature_names)['der_fld'][0].get_optype(), "continuous") self.assertEqual( pp.max_abs_scaler(trfm_obj, feature_names)['der_fld'][0].get_dataType(), "double") self.assertEqual( pp.max_abs_scaler(trfm_obj, feature_names)['der_fld'] [0].get_Apply().get_Constant()[0].get_valueOf_(), "{:.25f}".format(trfm_obj.max_abs_[0]))
def test_lbl_encoder(self): trfm_obj = LabelEncoder() trfm_obj, feature_names, target_name = auto_dataset_for_regression( trfm_obj) self.assertEqual(pp.get_class_name(trfm_obj), trfm_obj.__class__.__name__) self.assertEqual(pp.get_derived_colnames('labelEncoder', ['origin']), ['labelEncoder(origin)']) self.assertEqual( pp.lbl_encoder(trfm_obj, feature_names)['der_fld'][0].__class__.__name__, pml.DerivedField().__class__.__name__) self.assertEqual( pp.lbl_encoder(trfm_obj, feature_names)['der_fld'][0].get_optype(), "continuous") self.assertEqual( pp.lbl_encoder(trfm_obj, feature_names)['der_fld'][0].get_dataType(), "double") self.assertEqual( pp.lbl_encoder(trfm_obj, feature_names)['der_col_names'][0], "labelEncoder(origin)") self.assertEqual( pp.lbl_encoder(trfm_obj, feature_names)['pp_feat_class_lbl'][0], trfm_obj.classes_[0]) self.assertEqual( pp.lbl_encoder(trfm_obj, feature_names)['der_fld'] [0].get_MapValues().get_outputColumn(), "output") self.assertEqual( pp.lbl_encoder(trfm_obj, feature_names)['pp_feat_name'], "origin")
def test_lbl_binarizer(self): trfm_obj = LabelBinarizer() trfm_obj, feature_names, target_name = auto_dataset_for_regression( trfm_obj) self.assertEqual(pp.get_class_name(trfm_obj), trfm_obj.__class__.__name__) self.assertEqual( pp.lbl_binarizer(trfm_obj, feature_names)['der_fld'][0].__class__.__name__, pml.DerivedField().__class__.__name__) self.assertEqual( pp.lbl_binarizer(trfm_obj, feature_names)['der_fld'][0].get_optype(), "categorical") self.assertEqual( pp.lbl_binarizer(trfm_obj, feature_names)['der_fld'][0].get_dataType(), "double") self.assertEqual( pp.lbl_binarizer(trfm_obj, feature_names)['pp_feat_class_lbl'][0], trfm_obj.classes_[0]) self.assertEqual( pp.lbl_binarizer( trfm_obj, feature_names)['der_fld'][0].get_NormDiscrete().get_field(), "origin") self.assertEqual( pp.lbl_binarizer(trfm_obj, feature_names)['pp_feat_name'], "origin")