我有80%分类变量的机器学习分类问题.如果我想使用某种分类器进行分类,我必须使用一个热编码吗?我可以在没有编码的情况下将数据传递给分类器吗?
我正在尝试执行以下功能选择:
我读了火车文件:
num_rows_to_read = 10000
train_small = pd.read_csv("../../dataset/train.csv", nrows=num_rows_to_read)
Run Code Online (Sandbox Code Playgroud)我将分类要素的类型更改为"类别":
non_categorial_features = ['orig_destination_distance',
'srch_adults_cnt',
'srch_children_cnt',
'srch_rm_cnt',
'cnt']
for categorical_feature in list(train_small.columns):
if categorical_feature not in non_categorial_features:
train_small[categorical_feature] = train_small[categorical_feature].astype('category')
Run Code Online (Sandbox Code Playgroud)我使用一个热编码:
train_small_with_dummies = pd.get_dummies(train_small, sparse=True)
Run Code Online (Sandbox Code Playgroud)问题是第3部分经常卡住,虽然我使用的是强机.
因此,在没有热编码的情况下,我无法进行任何特征选择,以确定特征的重要性.
您有什么推荐的吗?