@@ -292,18 +292,8 @@ def test_serialize_pipeline(self):
292292 "estimator, or a transformer removed by setting\n it to " \
293293 "'passthrough' or ``None``."
294294 else :
295- fixture_description = "Pipeline of transforms with a final estimator.\n \n Sequentially" \
296- " apply a list of transforms and a final estimator.\n " \
297- "Intermediate steps of the pipeline must be 'transforms', that " \
298- "is, they\n must implement fit and transform methods.\n The final" \
299- " estimator only needs to implement fit.\n \n The purpose of the " \
300- "pipeline is to assemble several steps that can be\n " \
301- "cross-validated together while setting different parameters." \
302- "\n For this, it enables setting parameters of the various steps" \
303- " using their\n names and the parameter name separated by a '__'," \
304- " as in the example below.\n A step's estimator may be replaced " \
305- "entirely by setting the parameter\n with its name to another " \
306- "estimator, or a transformer removed by setting\n to None."
295+ fixture_description = self .extension ._get_sklearn_description (model )
296+
307297 fixture_structure = {
308298 fixture_name : [],
309299 'sklearn.preprocessing.data.StandardScaler' : ['scaler' ],
@@ -315,9 +305,6 @@ def test_serialize_pipeline(self):
315305
316306 self .assertEqual (serialization .name , fixture_name )
317307 self .assertEqual (serialization .custom_name , fixture_short_name )
318- TestBase .logger .info ("\n \n test_serialize_pipeline\n ---------------------\n {}\n "
319- "{}\n \n {}\n \n " .format (sklearn .__version__ , serialization .description ,
320- fixture_description ))
321308 self .assertEqual (serialization .description , fixture_description )
322309 self .assertDictEqual (structure , fixture_structure )
323310
@@ -412,18 +399,7 @@ def test_serialize_pipeline_clustering(self):
412399 "estimator, or a transformer removed by setting\n it to " \
413400 "'passthrough' or ``None``."
414401 else :
415- fixture_description = "Pipeline of transforms with a final estimator.\n \n Sequentially" \
416- " apply a list of transforms and a final estimator.\n " \
417- "Intermediate steps of the pipeline must be 'transforms', that " \
418- "is, they\n must implement fit and transform methods.\n The final" \
419- " estimator only needs to implement fit.\n \n The purpose of the " \
420- "pipeline is to assemble several steps that can be\n " \
421- "cross-validated together while setting different parameters." \
422- "\n For this, it enables setting parameters of the various steps" \
423- " using their\n names and the parameter name separated by a '__'," \
424- " as in the example below.\n A step's estimator may be replaced " \
425- "entirely by setting the parameter\n with its name to another " \
426- "estimator, or a transformer removed by setting\n to None."
402+ fixture_description = self .extension ._get_sklearn_description (model )
427403 fixture_structure = {
428404 fixture_name : [],
429405 'sklearn.preprocessing.data.StandardScaler' : ['scaler' ],
@@ -435,9 +411,6 @@ def test_serialize_pipeline_clustering(self):
435411
436412 self .assertEqual (serialization .name , fixture_name )
437413 self .assertEqual (serialization .custom_name , fixture_short_name )
438- TestBase .logger .info ("\n \n test_serialize_pipeline_clustering\n ---------------------\n {}\n "
439- "{}\n \n {}\n \n " .format (sklearn .__version__ , serialization .description ,
440- fixture_description ))
441414 self .assertEqual (serialization .description , fixture_description )
442415 self .assertDictEqual (structure , fixture_structure )
443416
@@ -518,14 +491,20 @@ def test_serialize_column_transformer(self):
518491 'numeric=sklearn.preprocessing.data.StandardScaler,' \
519492 'nominal=sklearn.preprocessing._encoders.OneHotEncoder)'
520493 fixture_short_name = 'sklearn.ColumnTransformer'
521- # str obtained from self.extension._get_sklearn_description(model)
522- fixture_description = 'Applies transformers to columns of an array or pandas DataFrame.\n ' \
523- '\n This estimator allows different columns or column subsets of the ' \
524- 'input\n to be transformed separately and the features generated by ' \
525- 'each transformer\n will be concatenated to form a single feature ' \
526- 'space.\n This is useful for heterogeneous or columnar data, to ' \
527- 'combine several\n feature extraction mechanisms or transformations ' \
528- 'into a single transformer.'
494+
495+ if version .parse (sklearn .__version__ ) >= version .parse ("0.21.0" ):
496+ # str obtained from self.extension._get_sklearn_description(model)
497+ fixture_description = 'Applies transformers to columns of an array or pandas ' \
498+ 'DataFrame.\n \n This estimator allows different columns or ' \
499+ 'column subsets of the input\n to be transformed separately and ' \
500+ 'the features generated by each transformer\n will be ' \
501+ 'concatenated to form a single feature space.\n This is useful ' \
502+ 'for heterogeneous or columnar data, to combine several\n feature' \
503+ ' extraction mechanisms or transformations into a single ' \
504+ 'transformer.'
505+ else :
506+ fixture_description = self .extension ._get_sklearn_description (model )
507+
529508 fixture_structure = {
530509 fixture : [],
531510 'sklearn.preprocessing.data.StandardScaler' : ['numeric' ],
@@ -584,20 +563,25 @@ def test_serialize_column_transformer_pipeline(self):
584563 fixture_name : [],
585564 }
586565
587- # str obtained from self.extension._get_sklearn_description(model)
588- fixture_description = "Pipeline of transforms with a final estimator.\n \n Sequentially " \
589- "apply a list of transforms and a final estimator.\n Intermediate " \
590- "steps of the pipeline must be 'transforms', that is, they\n must " \
591- "implement fit and transform methods.\n The final estimator only " \
592- "needs to implement fit.\n The transformers in the pipeline can be " \
593- "cached using ``memory`` argument.\n \n The purpose of the pipeline " \
594- "is to assemble several steps that can be\n cross-validated together " \
595- "while setting different parameters.\n For this, it enables setting " \
596- "parameters of the various steps using their\n names and the " \
597- "parameter name separated by a '__', as in the example below.\n A " \
598- "step's estimator may be replaced entirely by setting the parameter" \
599- "\n with its name to another estimator, or a transformer removed by " \
600- "setting\n it to 'passthrough' or ``None``."
566+ if version .parse (sklearn .__version__ ) >= version .parse ("0.21.0" ):
567+ # str obtained from self.extension._get_sklearn_description(model)
568+ fixture_description = "Pipeline of transforms with a final estimator.\n \n Sequentially" \
569+ " apply a list of transforms and a final estimator.\n " \
570+ "Intermediate steps of the pipeline must be 'transforms', that " \
571+ "is, they\n must implement fit and transform methods.\n The final" \
572+ " estimator only needs to implement fit.\n The transformers in " \
573+ "the pipeline can be cached using ``memory`` argument.\n \n The " \
574+ "purpose of the pipeline is to assemble several steps that can " \
575+ "be\n cross-validated together while setting different " \
576+ "parameters.\n For this, it enables setting parameters of the " \
577+ "various steps using their\n names and the parameter name " \
578+ "separated by a '__', as in the example below.\n A step's " \
579+ "estimator may be replaced entirely by setting the parameter\n " \
580+ "with its name to another estimator, or a transformer removed by" \
581+ " setting\n it to 'passthrough' or ``None``."
582+ else :
583+ fixture_description = self .extension ._get_sklearn_description (model )
584+
601585 serialization = self .extension .model_to_flow (model )
602586 structure = serialization .get_structure ('name' )
603587 self .assertEqual (serialization .name , fixture_name )
0 commit comments