hi satra, wouldn't a pipeline solve your pb?
see eg. : http://scikit-learn.org/stable/auto_examples/feature_selection_pipeline.html#example-feature-selection-pipeline-py Alex On Wed, Nov 9, 2011 at 10:55 AM, Andreas Müller <[email protected]> wrote: > Hi Satra. > Can you explain the use-case a bit more? > I don't understand it from the code, sorry. > Cheers, > Andy > > On 11/09/2011 04:51 PM, Satrajit Ghosh wrote: > > i often find myself doing the following for cross-validation. i.e. > estimating the transform from the training set. would this be useful as a > parameter on cross_val_score, gridsearchcv, etc.,. if so i'll send a pr. > ---- > class NoTransform(): > def fit(self, X): > return self > def transform(self, X): > return X > def doCV(clf, X, y, Tx, cvf): > result = [] > for train, test in cvf: > if Tx is None: > T = NoTransform() > else: > T = Tx() > result.append((y1[test], > clf.fit(T.fit(X[train]).transform(X[train]), > y[train]).predict(T.transform(X[test])) > )) > return result > ---- > cheers, > > satra > > > ------------------------------------------------------------------------------ > RSA(R) Conference 2012 > Save $700 by Nov 18 > Register now > http://p.sf.net/sfu/rsa-sfdev2dev1 > > _______________________________________________ > Scikit-learn-general mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/scikit-learn-general > > > ------------------------------------------------------------------------------ > RSA(R) Conference 2012 > Save $700 by Nov 18 > Register now > http://p.sf.net/sfu/rsa-sfdev2dev1 > _______________________________________________ > Scikit-learn-general mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/scikit-learn-general > > ------------------------------------------------------------------------------ RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 _______________________________________________ Scikit-learn-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
