8118fe98fb3c10515476ca49fceef2162a9754af,test/test_pipeline/test_classification.py,SimpleClassificationPipelineTest,test_predict_batched_sparse,#SimpleClassificationPipelineTest#,417

Before Change


    def test_predict_batched_sparse(self):
        cs = SimpleClassificationPipeline.get_hyperparameter_search_space(
            dataset_properties={"sparse": True})
        config = Configuration(cs,
            values={"balancing:strategy": "none",
                    "classifier:__choice__": "random_forest",
                    "imputation:strategy": "mean",
                    "one_hot_encoding:minimum_fraction": 0.01,
                    "one_hot_encoding:use_minimum_fraction": "True",
                    "preprocessor:__choice__": "no_preprocessing",
                    "classifier:random_forest:bootstrap": "True",
                    "classifier:random_forest:criterion": "gini",
                    "classifier:random_forest:max_depth": "None",
                    "classifier:random_forest:min_samples_split": 2,
                    "classifier:random_forest:min_samples_leaf": 2,
                    "classifier:random_forest:max_features": 0.5,
                    "classifier:random_forest:max_leaf_nodes": "None",
                    "classifier:random_forest:n_estimators": 100,
                    "classifier:random_forest:min_weight_fraction_leaf": 0.0,
                    "rescaling:__choice__": "standardize"})
        cls = SimpleClassificationPipeline(config)

        // Multiclass
        X_train, Y_train, X_test, Y_test = get_dataset(dataset="digits",
                                                       make_sparse=True)
        cls.fit(X_train, Y_train)
        X_test_ = X_test.copy()
        prediction_ = cls.predict(X_test_)
        cls_predict = mock.Mock(wraps=cls.pipeline_)
        cls.pipeline_ = cls_predict
        prediction = cls.predict(X_test, batch_size=20)
        self.assertEqual((1647,), prediction.shape)

After Change


        assert_array_almost_equal(prediction_, prediction)

    def test_predict_batched_sparse(self):
        config = {"balancing:strategy": "none",
                  "classifier:__choice__": "random_forest",
                  "imputation:strategy": "mean",
                  "one_hot_encoding:minimum_fraction": 0.01,
                  "one_hot_encoding:use_minimum_fraction": "True",
                  "preprocessor:__choice__": "no_preprocessing",
                  "classifier:random_forest:bootstrap": "True",
                  "classifier:random_forest:criterion": "gini",
                  "classifier:random_forest:max_depth": "None",
                  "classifier:random_forest:min_samples_split": 2,
                  "classifier:random_forest:min_samples_leaf": 2,
                  "classifier:random_forest:max_features": 0.5,
                  "classifier:random_forest:max_leaf_nodes": "None",
                  "classifier:random_forest:n_estimators": 100,
                  "classifier:random_forest:min_weight_fraction_leaf": 0.0,
                  "rescaling:__choice__": "standardize"}
        cls = SimpleClassificationPipeline(config=config,
                                           dataset_properties={"sparse": True})

        // Multiclass
        X_train, Y_train, X_test, Y_test = get_dataset(dataset="digits",
                                                       make_sparse=True)
        cls.fit(X_train, Y_train)
        X_test_ = X_test.copy()
        prediction_ = cls.predict_proba(X_test_)
        // The object behind the last step in the pipeline
        cls_predict = mock.Mock(wraps=cls.steps[-1][1].predict_proba)
        cls.steps[-1][-1].predict_proba = cls_predict
        prediction = cls.predict_proba(X_test, batch_size=20)
        self.assertEqual((1647, 10), prediction.shape)
        self.assertEqual(84, cls_predict.call_count)
        assert_array_almost_equal(prediction_, prediction)

        // Multilabel
        X_train, Y_train, X_test, Y_test = get_dataset(dataset="digits",
                                                       make_sparse=True)
        Y_train = np.array(list([(list([1 if i != y else 0 for i in range(10)]))
                                 for y in Y_train]))
        cls.fit(X_train, Y_train)
        X_test_ = X_test.copy()
        prediction_ = cls.predict_proba(X_test_)
        // The object behind the last step in the pipeline
        cls_predict = mock.Mock(wraps=cls.steps[-1][1].predict_proba)
        cls.steps[-1][-1].predict_proba = cls_predict
        prediction = cls.predict_proba(X_test, batch_size=20)
        self.assertEqual((1647, 10), prediction.shape)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 15

Instances


Project Name: automl/auto-sklearn
Commit Name: 8118fe98fb3c10515476ca49fceef2162a9754af
Time: 2016-07-13
Author: feurerm@informatik.uni-freiburg.de
File Name: test/test_pipeline/test_classification.py
Class Name: SimpleClassificationPipelineTest
Method Name: test_predict_batched_sparse


Project Name: automl/auto-sklearn
Commit Name: 9a62e98e14c1ad88b29baee3e5ba55cb45ac7aec
Time: 2016-12-31
Author: feurerm@informatik.uni-freiburg.de
File Name: test/test_pipeline/test_classification.py
Class Name: SimpleClassificationPipelineTest
Method Name: test_predict_batched_sparse


Project Name: automl/auto-sklearn
Commit Name: 9a62e98e14c1ad88b29baee3e5ba55cb45ac7aec
Time: 2016-12-31
Author: feurerm@informatik.uni-freiburg.de
File Name: test/test_pipeline/test_classification.py
Class Name: SimpleClassificationPipelineTest
Method Name: test_predict_proba_batched_sparse


Project Name: automl/auto-sklearn
Commit Name: 8118fe98fb3c10515476ca49fceef2162a9754af
Time: 2016-07-13
Author: feurerm@informatik.uni-freiburg.de
File Name: test/test_pipeline/test_classification.py
Class Name: SimpleClassificationPipelineTest
Method Name: test_predict_proba_batched_sparse