Remian-Feral
Remian-Feral

Reputation: 5

In ordinal encoder what does handle_unknown= use_encoded_values do?

I've done my research about but I'm not satisfied with the answer I looked up both on the documentation and gemini. use_encoded_value what does it mean? Do I have to pass an argument to act as an encoded values? If so could you give an example on its usage?

Upvotes: 0

Views: 16

Answers (1)

rehaqds
rehaqds

Reputation: 2055

You just need to add the parameter unknown_value and give it a constant value like -1 or 9999 or whatever you like. This value will be given to all the categories that were not in the data used to fit the encoder. For example:

    enc = OrdinalEncoder(handle_unknown="use_encoded_value", unknown_value=-1)

Upvotes: 0

Related Questions