diff --git a/nonconformist/__init__.py b/nonconformist/__init__.py index 7e6ce6b..7b6768f 100644 --- a/nonconformist/__init__.py +++ b/nonconformist/__init__.py @@ -6,6 +6,6 @@ # Authors: Henrik Linusson -__version__ = '1.1.0' +__version__ = '1.1.1' __all__ = ['icp', 'nc', 'acp'] \ No newline at end of file diff --git a/nonconformist/acp.py b/nonconformist/acp.py index 8ab5c5b..611b47a 100644 --- a/nonconformist/acp.py +++ b/nonconformist/acp.py @@ -215,11 +215,24 @@ def predict(self, x, significance=None): """ is_regression = self.cp_class.get_problem_type() == 'regression' - f = lambda p, x: p.predict(x, significance if is_regression else None) - predictions = np.dstack([f(p, x) for p in self.predictors]) - predictions = self.agg_func(predictions) - - if significance and not is_regression: - return predictions >= significance + n_examples = x.shape[0] + + if is_regression and significance is None: + signs = np.arange(0.01, 1.0, 0.01) + pred = np.zeros((n_examples, 2, signs.size)) + for i, s in enumerate(signs): + predictions = np.dstack([p.predict(x, s) + for p in self.predictors]) + predictions = self.agg_func(predictions) + pred[:, :, i] = predictions + return pred else: - return predictions \ No newline at end of file + f = lambda p, x: p.predict(x, + significance if is_regression else None) + predictions = np.dstack([f(p, x) for p in self.predictors]) + predictions = self.agg_func(predictions) + + if significance and not is_regression: + return predictions >= significance + else: + return predictions \ No newline at end of file