From e6114cb4c841529d245dec9d04feed11a73badc2 Mon Sep 17 00:00:00 2001 From: Daan Wynen Date: Tue, 13 Oct 2015 14:10:59 +0200 Subject: [PATCH] Pass pairwise attribute through MetaEstimatorMixin if present. --- sklearn/base.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sklearn/base.py b/sklearn/base.py index 8de001f06b9ba..5071bdec85031 100644 --- a/sklearn/base.py +++ b/sklearn/base.py @@ -461,7 +461,11 @@ def fit_transform(self, X, y=None, **fit_params): ############################################################################### class MetaEstimatorMixin(object): """Mixin class for all meta estimators in scikit-learn.""" - # this is just a tag for the moment + + @property + def _pairwise(self): + # Indicate if the wrapped estimator is one using a precomputed Gram matrix + return getattr(self.estimator, "_pairwise", False) ###############################################################################