@@ -75,7 +75,8 @@ def test_serialize_model(self):
7575
7676 fixture_name = 'sklearn.tree.tree.DecisionTreeClassifier'
7777 fixture_short_name = 'sklearn.DecisionTreeClassifier'
78- fixture_description = self .extension ._get_sklearn_description (model )
78+ # str obtained from self.extension._get_sklearn_description(model)
79+ fixture_description = 'A decision tree classifier.'
7980 version_fixture = 'sklearn==%s\n numpy>=1.6.1\n scipy>=0.9' \
8081 % sklearn .__version__
8182 # min_impurity_decrease has been introduced in 0.20
@@ -143,7 +144,8 @@ def test_serialize_model_clustering(self):
143144
144145 fixture_name = 'sklearn.cluster.k_means_.KMeans'
145146 fixture_short_name = 'sklearn.KMeans'
146- fixture_description = self .extension ._get_sklearn_description (model )
147+ # str obtained from self.extension._get_sklearn_description(model)
148+ fixture_description = 'K-Means clustering'
147149 version_fixture = 'sklearn==%s\n numpy>=1.6.1\n scipy>=0.9' \
148150 % sklearn .__version__
149151 # n_jobs default has changed to None in 0.20
@@ -207,11 +209,18 @@ def test_serialize_model_with_subcomponent(self):
207209 '(base_estimator=sklearn.tree.tree.DecisionTreeClassifier)'
208210 fixture_class_name = 'sklearn.ensemble.weight_boosting.AdaBoostClassifier'
209211 fixture_short_name = 'sklearn.AdaBoostClassifier'
210- fixture_description = self .extension ._get_sklearn_description (model )
212+ # str obtained from self.extension._get_sklearn_description(model)
213+ fixture_description = 'An AdaBoost classifier.\n \n An AdaBoost [1] classifier is a ' \
214+ 'meta-estimator that begins by fitting a\n classifier on the original' \
215+ ' dataset and then fits additional copies of the\n classifier on the ' \
216+ 'same dataset but where the weights of incorrectly\n classified ' \
217+ 'instances are adjusted such that subsequent classifiers focus\n more' \
218+ ' on difficult cases.\n \n This class implements the algorithm known ' \
219+ 'as AdaBoost-SAMME [2].'
211220 fixture_subcomponent_name = 'sklearn.tree.tree.DecisionTreeClassifier'
212221 fixture_subcomponent_class_name = 'sklearn.tree.tree.DecisionTreeClassifier'
213- fixture_subcomponent_description = \
214- self . extension . _get_sklearn_description ( model . base_estimator )
222+ # str obtained from self.extension._get_sklearn_description(model.base_estimator)
223+ fixture_subcomponent_description = 'A decision tree classifier.'
215224 fixture_structure = {
216225 fixture_name : [],
217226 'sklearn.tree.tree.DecisionTreeClassifier' : ['base_estimator' ]
@@ -265,7 +274,20 @@ def test_serialize_pipeline(self):
265274 'scaler=sklearn.preprocessing.data.StandardScaler,' \
266275 'dummy=sklearn.dummy.DummyClassifier)'
267276 fixture_short_name = 'sklearn.Pipeline(StandardScaler,DummyClassifier)'
268- fixture_description = self .extension ._get_sklearn_description (model )
277+ # str obtained from self.extension._get_sklearn_description(model)
278+ fixture_description = "Pipeline of transforms with a final estimator.\n \n Sequentially " \
279+ "apply a list of transforms and a final estimator.\n Intermediate " \
280+ "steps of the pipeline must be 'transforms', that is, they\n must " \
281+ "implement fit and transform methods.\n The final estimator only " \
282+ "needs to implement fit.\n The transformers in the pipeline can be " \
283+ "cached using ``memory`` argument.\n \n The purpose of the pipeline is" \
284+ " to assemble several steps that can be\n cross-validated together " \
285+ "while setting different parameters.\n For this, it enables setting " \
286+ "parameters of the various steps using their\n names and the " \
287+ "parameter name separated by a '__', as in the example below.\n A " \
288+ "step's estimator may be replaced entirely by setting the " \
289+ "parameter\n with its name to another estimator, or a transformer " \
290+ "removed by setting\n it to 'passthrough' or ``None``."
269291 fixture_structure = {
270292 fixture_name : [],
271293 'sklearn.preprocessing.data.StandardScaler' : ['scaler' ],
@@ -354,7 +376,20 @@ def test_serialize_pipeline_clustering(self):
354376 'scaler=sklearn.preprocessing.data.StandardScaler,' \
355377 'clusterer=sklearn.cluster.k_means_.KMeans)'
356378 fixture_short_name = 'sklearn.Pipeline(StandardScaler,KMeans)'
357- fixture_description = self .extension ._get_sklearn_description (model )
379+ # str obtained from self.extension._get_sklearn_description(model)
380+ fixture_description = "Pipeline of transforms with a final estimator.\n \n Sequentially " \
381+ "apply a list of transforms and a final estimator.\n Intermediate " \
382+ "steps of the pipeline must be 'transforms', that is, they\n must " \
383+ "implement fit and transform methods.\n The final estimator only " \
384+ "needs to implement fit.\n The transformers in the pipeline can be " \
385+ "cached using ``memory`` argument.\n \n The purpose of the pipeline is" \
386+ " to assemble several steps that can be\n cross-validated together " \
387+ "while setting different parameters.\n For this, it enables setting " \
388+ "parameters of the various steps using their\n names and the " \
389+ "parameter name separated by a '__', as in the example below.\n A " \
390+ "step's estimator may be replaced entirely by setting the parameter" \
391+ "\n with its name to another estimator, or a transformer removed " \
392+ "by setting\n it to 'passthrough' or ``None``."
358393 fixture_structure = {
359394 fixture_name : [],
360395 'sklearn.preprocessing.data.StandardScaler' : ['scaler' ],
@@ -446,7 +481,14 @@ def test_serialize_column_transformer(self):
446481 'numeric=sklearn.preprocessing.data.StandardScaler,' \
447482 'nominal=sklearn.preprocessing._encoders.OneHotEncoder)'
448483 fixture_short_name = 'sklearn.ColumnTransformer'
449- fixture_description = self .extension ._get_sklearn_description (model )
484+ # str obtained from self.extension._get_sklearn_description(model)
485+ fixture_description = 'Applies transformers to columns of an array or pandas DataFrame.\n ' \
486+ '\n This estimator allows different columns or column subsets of the ' \
487+ 'input\n to be transformed separately and the features generated by ' \
488+ 'each transformer\n will be concatenated to form a single feature ' \
489+ 'space.\n This is useful for heterogeneous or columnar data, to ' \
490+ 'combine several\n feature extraction mechanisms or transformations ' \
491+ 'into a single transformer.'
450492 fixture_structure = {
451493 fixture : [],
452494 'sklearn.preprocessing.data.StandardScaler' : ['numeric' ],
@@ -505,7 +547,20 @@ def test_serialize_column_transformer_pipeline(self):
505547 fixture_name : [],
506548 }
507549
508- fixture_description = self .extension ._get_sklearn_description (model )
550+ # str obtained from self.extension._get_sklearn_description(model)
551+ fixture_description = "Pipeline of transforms with a final estimator.\n \n Sequentially " \
552+ "apply a list of transforms and a final estimator.\n Intermediate " \
553+ "steps of the pipeline must be 'transforms', that is, they\n must " \
554+ "implement fit and transform methods.\n The final estimator only " \
555+ "needs to implement fit.\n The transformers in the pipeline can be " \
556+ "cached using ``memory`` argument.\n \n The purpose of the pipeline " \
557+ "is to assemble several steps that can be\n cross-validated together " \
558+ "while setting different parameters.\n For this, it enables setting " \
559+ "parameters of the various steps using their\n names and the " \
560+ "parameter name separated by a '__', as in the example below.\n A " \
561+ "step's estimator may be replaced entirely by setting the parameter" \
562+ "\n with its name to another estimator, or a transformer removed by " \
563+ "setting\n it to 'passthrough' or ``None``."
509564 serialization = self .extension .model_to_flow (model )
510565 structure = serialization .get_structure ('name' )
511566 self .assertEqual (serialization .name , fixture_name )
0 commit comments