3ce15cf0b1b83503d0a35a0077cb93322c2cc710,finetune/base.py,BaseModel,_inference,#BaseModel#Any#Any#,239

Before Change


    def _inference(self, Xs, mode=None):
        self._data = list(self.input_pipeline._format_for_inference(Xs))
        self._closed = False
        n = len(self._data)

        if not getattr(self, "estimator", None):
            self.estimator = self.get_estimator()
            self._input_fn = lambda: self.input_pipeline._dataset_without_targets(
                self._data_generator, train=None
            ).batch(self.config.batch_size)
            self._predictions = self.estimator.predict(input_fn=self._input_fn)

        predictions = [None] * n
        for i in range(n):
            y = next(self._predictions)
            y = y[mode] if mode else y
            predictions[i] = y
        return predictions
        
    def fit(self, *args, **kwargs):
         An alias for finetune. 
        return self.finetune(*args, **kwargs)

After Change


            input_fn = self.input_pipeline.get_predict_input_fn(Xs)
            length = len(Xs) if not callable(Xs) else None

            predictions = tqdm.tqdm(
                estimator.predict(
                    input_fn=input_fn, predict_keys=mode
                ),
                total=length,
                desc="Inference"
            )
            return [pred[mode] if mode else pred for pred in predictions]
        
    def fit(self, *args, **kwargs):
         An alias for finetune. 
        return self.finetune(*args, **kwargs)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 7

Instances


Project Name: IndicoDataSolutions/finetune
Commit Name: 3ce15cf0b1b83503d0a35a0077cb93322c2cc710
Time: 2018-11-13
Author: madison@indico.io
File Name: finetune/base.py
Class Name: BaseModel
Method Name: _inference


Project Name: catalyst-cooperative/pudl
Commit Name: 2069e3e1664cff1a4a6fb90dbefd398b8bfd3205
Time: 2018-09-30
Author: zane.selvans@catalyst.coop
File Name: pudl/transform/ferc1.py
Class Name: FERCPlantClassifier
Method Name: score


Project Name: scikit-optimize/scikit-optimize
Commit Name: 9cdd21160f4b4352b05f7b7ce9f0f63506c585c9
Time: 2017-04-17
Author: iaroslav-ai@users.noreply.github.com
File Name: benchmarks/bench_ml.py
Class Name: MLBench
Method Name: evaluate


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 542ed06a15484f4174fa3290dda6b753fd488ed5
Time: 2019-05-22
Author: beat.buesser@ie.ibm.com
File Name: art/classifiers/sklearn_svm.py
Class Name: SklearnSVC
Method Name: predict