Skip to content

How to use categorical features? #1

@schachem

Description

@schachem

I would be very thankful if you could provide a small example on how to use the categorical features parameter during fitting?
I am trying to put a string denoting the column of the dataframe, but that is not working.

Let's say we have dataframe with a column for protocol and we already encoded them to numerical values.
Now when calling fit, I would try it like clf.fit(train_df, train_target, categorical_columns=['protocol'], base_class=0)

However it tells me: ValueError: Specifying the columns using strings is only supported for pandas DataFrames
But I did pass a dataframe, i.e. train_df to the fit function.
The train_df dataframe does contain multiple columns (including the protocol column, where TCP and UDP are encoded to 30 and 31; arbitrary values).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions