-
-
Notifications
You must be signed in to change notification settings - Fork 26.2k
Closed
Description
Description
sklearn.mixture.GaussianMixture
does not implement the transform
or fit_transform
functions. This precludes it from being used as part of a Pipeline
.
Steps/Code to Reproduce
from sklearn.decomposition import PCA
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.ensemble import ExtraTreesClassifier
from sklearn.mixture import GaussianMixture
clf = Pipeline([
('scaler', StandardScaler()),
('pca', PCA()),
('gmm', GaussianMixture()),
('model', ExtraTreesClassifier())
])
Expected Results
No error is thrown.
Actual Results
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-16-9adcdd00f09c> in <module>()
3 ('pca', PCA()),
4 ('gmm', GaussianMixture()),
----> 5 ('model', ExtraTreesClassifier())
6 ])
/Users/samuelainsworth/research/res-venv/lib/python2.7/site-packages/sklearn/pipeline.pyc in __init__(self, steps)
151 # shallow copy of steps
152 self.steps = tosequence(steps)
--> 153 self._validate_steps()
154
155 def get_params(self, deep=True):
/Users/samuelainsworth/research/res-venv/lib/python2.7/site-packages/sklearn/pipeline.pyc in _validate_steps(self)
198 raise TypeError("All intermediate steps should be "
199 "transformers and implement fit and transform."
--> 200 " '%s' (type %s) doesn't" % (t, type(t)))
201
202 # We allow last estimator to be None as an identity transformation
TypeError: All intermediate steps should be transformers and implement fit and transform. 'GaussianMixture(covariance_type='full', init_params='kmeans', max_iter=100,
means_init=None, n_components=1, n_init=1, precisions_init=None,
random_state=None, reg_covar=1e-06, tol=0.001, verbose=0,
verbose_interval=10, warm_start=False, weights_init=None)' (type <class 'sklearn.mixture.gaussian_mixture.GaussianMixture'>) doesn't
Versions
Darwin-15.6.0-x86_64-i386-64bit
('Python', '2.7.10 (default, Oct 23 2015, 19:19:21) \n[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)]')
('NumPy', '1.11.2')
('SciPy', '0.18.1')
('Scikit-Learn', '0.18')
Metadata
Metadata
Assignees
Labels
No labels