Categorical Pipeline

    0

    0

    Wyx Smrf

    Pipeline

    The code creates a pipeline using the SimpleImputer() algorithm and the OneHotEncoder() transformer. The pipeline has a preprocessing column that will include any values that are not encoder handles that are unknown.

    Library: Scikit-Learn

    Filename pattern: .ipynb, .py

    from sklearn.impute import SimpleImputer
    from sklearn.preprocessing import OneHotEncoder
    from sklearn.compose import make_column_transformer, make_column_selector
    
    cat_pipeline = make_pipeline(
      SimpleImputer(strategy="most_frequent"),
      OneHotEncoder(handle_unknown="ignore"))
    
    preprocessing = make_column_transformer((cat_pipeline, make_column_selector(dtype_include=object)))
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.