aab2ef03ff533c1160742fafd2bf12133e227ddb,nonconformist/ensemble.py,AggregatedCp,predict,#AggregatedCp#Any#Any#,41

Before Change


			self.predictors.append(predictor)

	def predict(self, x, significance=None):
		if self.cp_class.problem_type == "classification":
			p_values = None
			for predictor in self.predictors:
				if p_values is None:
					p_values = predictor.predict(x)
				else:
					p_values = np.dstack([p_values, predictor.predict(x)])

			p_values = self.p_agg_func(p_values)

			if significance:
				return p_values >= significance
			else:
				return p_values

		if self.cp_class.problem_type == "regression":
			intervals = None
			for predictor in self.predictors:
				if intervals is None:
					intervals = predictor.predict(x, significance)
				else:
					intervals = np.dstack([intervals,
					                       predictor.predict(x, significance)])

			p_values = self.p_agg_func(intervals)

			return p_values

After Change


	def predict(self, x, significance=None):
		is_regression = self.cp_class.problem_type == "regression"

		if is_regression:
			predictions = np.dstack([predictor.predict(x, significance) for
			                         predictor in self.predictors])
		else:
			predictions = np.dstack([predictor.predict(x) for
			                         predictor in self.predictors])

		predictions = self.p_agg_func(predictions)

		if significance and not is_regression:
			return predictions >= significance
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 15

Instances


Project Name: donlnz/nonconformist
Commit Name: aab2ef03ff533c1160742fafd2bf12133e227ddb
Time: 2015-03-19
Author: henrik.linusson@gmail.com
File Name: nonconformist/ensemble.py
Class Name: AggregatedCp
Method Name: predict


Project Name: Calamari-OCR/calamari
Commit Name: fb08a6d154a8aa5beabc18de4400476a928ed644
Time: 2021-01-19
Author: wick.chr@gmail.com
File Name: calamari_ocr/ocr/training/trainer.py
Class Name: CalamariTrainer
Method Name: train


Project Name: dpressel/mead-baseline
Commit Name: 8a420e8ef11ebf828e5e5b33e8a830eb74c39d6a
Time: 2020-03-09
Author: blester125@gmail.com
File Name: baseline/services.py
Class Name: ClassifierService
Method Name: predict