Search code examples
pycaret

What is this paramater in Pycaret setup?


What are the values encoding_method can take for categorical encoding in setup, leaving the default leave one out method. I do not see the non default values it can take in the documentation

enter image description here


Solution

  • The argument that you are referring to is only valid for PyCaret 3.x and later.

    For PyCaret 2.x only One Hot Encoding is supported.

    From the source code it seems that LeaveOneOutEncoder (default), OneHotEncoder and OrdinalEncoder are supported.

    From what I can understand you can use them in the following manner:

    from category_encoders.leave_one_out import LeaveOneOutEncoder
    
    encoding_method = LeaveOneOutEncoder(
                            handle_missing="return_nan",
                            handle_unknown="value",
                            random_state=self.seed,
                        )
    

    Package documentation can also be found here for reference.