Hi Rujing, You can integrate the preprocessing into the estimator by placing an estimator at the end of the pipeline.
For example: make_pipeline(StandardScaler(), SVC()) This pipeline has a Support vector classifier at the end. Calling a function of the pipeline, for example fit(X, y), will first apply the StandardScaler to X, and then use the preprocessed X to fit the SVC. When you use such an estimator in the cross_validate function, the result is that the preprocessing will be applied during cross validation, like you wanted. Let me know if you have more questions. Oliver On Tue, Jul 9, 2019 at 03:04 charujing123 <charujing...@163.com> wrote: > Hi Oliver, > Thanks for your kind reply. I read the manual, however, i did not find any > options in the function of cross_validate to control the fit > transformation. The fit_transform could be used to preprocessing in the > pipeline, however, how to integrate this into the function of > sklearn.model_selection.cross_validate? > Thanks. > Rujing > > 2019-07-09 > ------------------------------ > charujing123 > ------------------------------ > > *发件人:*Oliver Rausch <oliverrausc...@gmail.com> > *发送时间:*2019-07-07 16:03 > *主题:*Re: [scikit-learn] how to preprocess in the cross_validate > *收件人:*"Scikit-learn mailing list"<scikit-learn@python.org> > *抄送:* > > Hi Rujing, > The Pipeline [0] from sklearn may be of interest to you. > > Best regards, > Oliver > — > [0] https://scikit-learn.org/stable/modules/compose.html > > On Sun, Jul 7, 2019 at 08:50 charujing123 <charujing...@163.com> wrote: > >> Hi >> It's easy to preprocess when i used part of data to train and test. >> However, how to preprocess within the function of >> sklearn.model_selection.cross_validate? >> Thanks. >> Rujing >> >> 2019-07-07 >> ------------------------------ >> charujing123 >> _______________________________________________ >> scikit-learn mailing list >> scikit-learn@python.org >> https://mail.python.org/mailman/listinfo/scikit-learn >> > -- > Best Regards, > Oliver > > _______________________________________________ > scikit-learn mailing list > scikit-learn@python.org > https://mail.python.org/mailman/listinfo/scikit-learn > -- Best Regards, Oliver
_______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn