12cd0759c82480173978bbeeb8ef9ec5829e6542,deepchem/models/tests/test_generalize.py,TestGeneralization,test_sklearn_transformed_regression,#TestGeneralization#,83

Before Change


    for transformer in transformers:
        transformer.transform(test_dataset)

    tasks = train_dataset.get_task_names()
    task_types = {task: "regression" for task in tasks}

    model_params = {
      "batch_size": None,
      "data_shape": train_dataset.get_data_shape()
    }

    verbosity = "high"
    regression_metric = Metric(metrics.r2_score, verbosity=verbosity)
    model = SklearnModel(tasks, task_types, model_params, self.model_dir,
                         mode="regression",
                         model_instance=LinearRegression())

    // Fit trained model
    model.fit(train_dataset)
    model.save()

    train_evaluator = Evaluator(model, train_dataset, transformers, verbosity=verbosity)
    train_scores = train_evaluator.compute_model_performance([regression_metric])
    print("train_scores")
    print(train_scores)

    assert train_scores[regression_metric.name] > .5

    // Eval model on test
    transformers = []
    evaluator = Evaluator(model, test_dataset, transformers, verbosity=verbosity)
    scores = evaluator.compute_model_performance([regression_metric])
    print("scores")
    print(scores)

    assert scores[regression_metric.name] > .5

  def test_sklearn_multitask_regression(self):

After Change



    verbosity = "high"
    regression_metric = Metric(metrics.r2_score, verbosity=verbosity)
    sklearn_model = LinearRegression()
    model = SklearnModel(sklearn_model, self.model_dir)

    // Fit trained model
    model.fit(train_dataset)
    model.save()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 16

Instances


Project Name: deepchem/deepchem
Commit Name: 12cd0759c82480173978bbeeb8ef9ec5829e6542
Time: 2016-09-19
Author: bharath.ramsundar@gmail.com
File Name: deepchem/models/tests/test_generalize.py
Class Name: TestGeneralization
Method Name: test_sklearn_transformed_regression


Project Name: deepchem/deepchem
Commit Name: 12cd0759c82480173978bbeeb8ef9ec5829e6542
Time: 2016-09-19
Author: bharath.ramsundar@gmail.com
File Name: deepchem/models/tests/test_generalize.py
Class Name: TestGeneralization
Method Name: test_sklearn_transformed_regression


Project Name: deepchem/deepchem
Commit Name: 12cd0759c82480173978bbeeb8ef9ec5829e6542
Time: 2016-09-19
Author: bharath.ramsundar@gmail.com
File Name: deepchem/models/tests/test_generalize.py
Class Name: TestGeneralization
Method Name: test_sklearn_classification


Project Name: deepchem/deepchem
Commit Name: 12cd0759c82480173978bbeeb8ef9ec5829e6542
Time: 2016-09-19
Author: bharath.ramsundar@gmail.com
File Name: deepchem/models/tests/test_generalize.py
Class Name: TestGeneralization
Method Name: test_sklearn_regression