<div><div dir="auto">Hi Rujing,</div></div><div dir="auto">You can integrate the preprocessing into the estimator by placing an estimator at the end of the pipeline.</div><div dir="auto"><br></div><div dir="auto">For example:</div><div dir="auto">make_pipeline(StandardScaler(), SVC())</div><div dir="auto"><br></div><div dir="auto">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.</div><div dir="auto"><br></div><div dir="auto">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.</div><div dir="auto"><br></div><div dir="auto">Let me know if you have more questions.</div><div dir="auto">Oliver </div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 9, 2019 at 03:04 charujing123 <<a href="mailto:charujing123@163.com">charujing123@163.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>





<div style="BORDER-LEFT-WIDTH:0px;FONT-SIZE:10.5pt;FONT-FAMILY:微软雅黑;BORDER-RIGHT-WIDTH:0px;BORDER-BOTTOM-WIDTH:0px;COLOR:#000000;MARGIN:12px;LINE-HEIGHT:1.5;BORDER-TOP-WIDTH:0px" marginheight="0" marginwidth="0">
<div>Hi Oliver,</div>
<div style="TEXT-INDENT:2em">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?</div>
<div style="TEXT-INDENT:2em">Thanks.</div>
<div>Rujing</div>
<div> </div>
<div style="FONT-SIZE:10pt;FONT-FAMILY:Verdana;COLOR:#c0c0c0" align="left">2019-07-09 
<hr id="m_-4406773825361244235SignNameHR" style="BORDER-TOP:#c0c0c0 1px solid;HEIGHT:1px;BORDER-RIGHT:0px;WIDTH:122px;BORDER-BOTTOM:0px;BORDER-LEFT:0px" align="left">
<span id="m_-4406773825361244235_FlashSignName">charujing123</span> </div>
<hr style="BORDER-TOP:#c0c0c0 1px solid;HEIGHT:1px;BORDER-RIGHT:0px;BORDER-BOTTOM:0px;BORDER-LEFT:0px">

<blockquote id="m_-4406773825361244235ntes-flashmail-quote" style="FONT-SIZE:10pt;FONT-FAMILY:Verdana;PADDING-LEFT:0px;MARGIN-LEFT:0px">
  <div><strong>发件人:</strong>Oliver Rausch <<a href="mailto:oliverrausch99@gmail.com" target="_blank">oliverrausch99@gmail.com</a>></div>
  <div><strong>发送时间:</strong>2019-07-07 16:03</div>
  <div><strong>主题:</strong>Re: [scikit-learn] how to preprocess in the 
  cross_validate</div>
  <div><strong>收件人:</strong>"Scikit-learn mailing 
  list"<<a href="mailto:scikit-learn@python.org" target="_blank">scikit-learn@python.org</a>></div>
  <div><strong>抄送:</strong></div>
  <div> </div>
  <div>
  <div>
  <div>Hi Rujing,</div></div>
  <div>The Pipeline [0] from sklearn may be of interest to you.</div>
  <div><br></div>
  <div>Best regards,</div>
  <div>Oliver </div>
  <div>—</div>
  <div>[0] <a href="https://scikit-learn.org/stable/modules/compose.html" target="_blank">https://scikit-learn.org/stable/modules/compose.html</a></div>
  <div><br>
  <div class="gmail_quote">
  <div class="gmail_attr" dir="ltr">On Sun, Jul 7, 2019 at 08:50 charujing123 <<a href="mailto:charujing123@163.com" target="_blank">charujing123@163.com</a>> 
  wrote:<br></div>
  <blockquote class="gmail_quote" style="PADDING-LEFT:1ex;BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex"><u></u>
    <div style="BORDER-LEFT-WIDTH:0px;FONT-SIZE:10.5pt;FONT-FAMILY:微软雅黑;BORDER-RIGHT-WIDTH:0px;BORDER-BOTTOM-WIDTH:0px;COLOR:#000000;MARGIN:12px;LINE-HEIGHT:1.5;BORDER-TOP-WIDTH:0px" marginheight="0" marginwidth="0"><u></u>
    <div>Hi</div>
    <div style="TEXT-INDENT:2em">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?</div>
    <div style="TEXT-INDENT:2em">Thanks.</div>
    <div>Rujing</div>
    <div> </div>
    <div style="FONT-SIZE:10pt;FONT-FAMILY:Verdana;COLOR:#c0c0c0">
    <div align="left">2019-07-07</div>
    <hr id="m_-4406773825361244235m_6634395620715337401SignNameHR" style="BORDER-TOP:#c0c0c0 1px solid;HEIGHT:1px;BORDER-RIGHT:0px;WIDTH:122px;BORDER-BOTTOM:0px;BORDER-LEFT:0px" align="left">
    </div></div>
    <div style="BORDER-LEFT-WIDTH:0px;FONT-SIZE:10.5pt;FONT-FAMILY:微软雅黑;BORDER-RIGHT-WIDTH:0px;BORDER-BOTTOM-WIDTH:0px;COLOR:#000000;MARGIN:12px;LINE-HEIGHT:1.5;BORDER-TOP-WIDTH:0px" marginheight="0" marginwidth="0">
    <div style="FONT-SIZE:10pt;FONT-FAMILY:Verdana;COLOR:#c0c0c0"><span id="m_-4406773825361244235m_6634395620715337401_FlashSignName">charujing123</span> 
    </div><u></u></div>_______________________________________________<br>scikit-learn 
    mailing list<br><a href="mailto:scikit-learn@python.org" target="_blank">scikit-learn@python.org</a><br><a href="https://mail.python.org/mailman/listinfo/scikit-learn" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/scikit-learn</a><br></blockquote></div></div>-- 
  <br>
  <div class="m_-4406773825361244235gmail_signature" dir="ltr" data-smartmail="gmail_signature">Best 
  Regards,<br>Oliver<br><br></div></div></blockquote></div>_______________________________________________<br>
scikit-learn mailing list<br>
<a href="mailto:scikit-learn@python.org" target="_blank">scikit-learn@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/scikit-learn" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/scikit-learn</a><br>
</blockquote></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Best Regards,<br>Oliver<br><br></div>