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

『機械学習を解釈する技術』の紹介 / Devsumi2022

『機械学習を解釈する技術』の紹介 / Devsumi2022

Developers Summit 2022の「ITエンジニア本大賞2022」プレゼン大会での発表資料です。

https://event.shoeisha.jp/devsumi/20220217/session/3650/

機械学習解釈する技術はこちらからご購入いただけます
https://gihyo.jp/book/2021/978-4-297-12226-3

森下光之助

February 17, 2022
Tweet

More Decks by 森下光之助

Other Decks in Technology

Transcript

  1. 2022/2/17
    Developers Summit 2022
    @dropout009

    View Slide

  2. TVISION INSIGHTS
    Twitter: @dropout009
    Speaker Deck: dropout009
    Blog: https://dropout009.hatenablog.com/

    View Slide

  3. Deep Learning GBDT Random Forest

    View Slide

  4. View Slide

  5. 画像認識、⾳声認識、機械翻訳、…
    Deep Learning,
    Gradient Boosting Decision Tree,
    Random Forest, ...
    pytorch,
    LightGBM,
    scikit-learn, ...

    View Slide

  6. LM
    GBDT
    RF
    DL
    GLM

    View Slide

  7. View Slide

  8. LM
    GBDT
    RF
    DL
    GLM
    +

    View Slide

  9. View Slide

  10. 4
    PFI
    PD + ICE
    SHAP

    View Slide

  11. 1. PFI
    2. PD
    3. ICE
    4. SHAP
    住宅価格 = 𝛽!
    + 𝛽"
    部屋の数 + 𝛽#
    駅からの距離 + ノイズ

    View Slide

  12. Partial Dependence
    PD
    𝑌 = 𝑋! − 5𝑋" + 10𝑋"𝑋# + 𝜖
    𝑋!, 𝑋" ∼ Uniform −1, 1
    𝑋# ∼ Bernoulli 0.5
    𝜖 ∼ 𝒩(0, 0.01)

    View Slide

  13. Python
    Partial Dependence
    @dataclass
    class PartialDependence:
    """Partial Dependence (PD)"""
    estimator: Any
    X: np.ndarray
    var_names: list[str]
    def _counterfactual_prediction(
    self,
    idx_to_replace: int,
    value_to_replace: float
    ) -> np.ndarray:
    """ある特徴量の値を置き換えたときの予測値を求める"""
    X_replaced = self.X.copy()
    X_replaced[:, idx_to_replace] = value_to_replace
    y_pred = self.estimator.predict(X_replaced)
    return y_pred
    ………
    $
    PD>
    𝑥>
    =
    1
    𝑁
    *
    [email protected]"
    A
    +
    𝑓(𝑥>
    , 𝒙?,∖>
    )

    View Slide

  14. View Slide