Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The Hitchhiker's Guide to scikit-learn

The Hitchhiker's Guide to scikit-learn

7dc8611c26c3ca62c551109c65d04270?s=128

Yuichiro Someya

August 10, 2017
Tweet

Transcript

  1. The Hitchhiker's Guide to scikit-learn

  2. ‣ TLMFBSO$PEFSFBEJOH ‣ #VJMEZPVSPXO&TUJNBUPS  "HFOEB

  3. ‣ *UT&TUJNBUPS OPU.PEFM  ‣ $POTUJUVUFMBSHFQBSUPGTLMFBSO ‣ 4VCDMBTTFTPG
 sklearn.base.BaseEstimator
 FYQMBJOFEMBUFS

     .PEFM*NQMFNFOUBUJPOT TLMFBSODMVTUFS TLMFBSOFOTFNCMF TLMFBSODPWBSJBODF TLMFBSOTWN TLMFBSOLFSOFM@SJEHF TLMFBSOLFSOFM@BQQSPYJNBUJPO TLMFBSOJTPUPOJD TLMFBSOHBVTTJBO@QSPDFTT TLMFBSOGFBUVSF@TFMFDUJPO BOENPSF
  4. 

  5.  #BTF$MBTTFT .JYJOT *NQMFNFOUBUJPOT

  6. ‣ "MNPTU FWFSZUIJOHJTBO&TUJNBUPS  ,FSOFM3JEHF3FHSFTTPSJTB&TUJNBUPS ‣ 5IFZEJGGFSJOJUTBCJMJUJFT .JYJOT  

    ,FSOFM3JEHF3FHSFTTPSDBOEPSFHSFTTJPOT  .JYJOT5SBOTGPSNFS $MBTTJpFS 3FHSFTTPS 
  7. ‣ TLMFBSOLFSOFM@SJEHFQZ 

  8.  class KernelRidge(BaseEstimator, RegressorMixin): """Kernel ridge regression. Kernel ridge regression

    (KRR) combines ridge regression (linear least squares with l2-norm regularization) with the kernel trick. It thus learns a linear function in the space induced by the respective kernel and the data. For non-linear kernels, this corresponds to a non-linear function in the original space. The form of the model learned by KRR is identical to support vector regression (SVR). However, different loss functions are used: KRR uses squared error loss while support vector regression uses epsilon-insensitive loss, both combined with l2 regularization. In contrast to SVR, fitting a KRR model can be done in closed-form and is typically faster for medium-sized datasets. On the other hand, the learned model is non-sparse and thus slower than SVR, which learns a sparse model for epsilon > 0, at prediction-time. This estimator has built-in support for multi-variate regression (i.e., when y is a 2d-array of shape [n_samples, n_targets]). Read more in the :ref:`User Guide <kernel_ridge>`.
  9. ‣ TLMFBSOCBTFQZ #BTF&TUJNBUPS 3FHSFTTPS.JYJO 

  10. ‣ $SFBUFOFXQZUIPOTPVSDFpMF ‣ *NQPSUTLMFBSOCBTF#BTF&TUJNBUPSBOE TLMFBSOCBTF$MBTTJpFS.JYJO ‣ 8SJUFOFXDMBTT.Z$MBTTJpFSBOEJOIFSJUCBTFDMBTTBOENJYJO  #VJMEZPVSPXO&TUJNBUPST $MBTTJpFS

  11. ‣ $MPOFBOESFBEUIFN  "1*3FGFSFODFTIPVMECFpOF
 IUUQTDJLJUMFBSOPSHTUBCMFNPEVMFTDMBTTFTIUNM ‣ <TLMFBSOCBTFQZ TLMFBSO CBTFQZ>
 BSFUIFHPPETUBSUFST

     $PODMVTJPO