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

Reply via email to