连续和分类特性调用SMOTENC之前的数据缩放

2024-05-19 01:40:12 发布

您现在位置:Python中文网/ 问答频道 /正文

到目前为止,我的代码是运行SMOTENC的以下代码

from imblearn.over_sampling import SMOTENC
smt = SMOTENC(random_state=seed, categorical_features=[10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53], ratio=1.0, n_jobs = -1)     
# n_jobs = The number of threads to open if possible. ``-1`` means using all processors.
# default K=5 
X_res, y_res = smt.fit_sample(X_tra, y_tra)

这里的问题是我读到了SMOTE,因为它使用了欧氏距离的KNN算法,所以在调用SMOTENC()之前数据应该被缩放

如果数据集的前10个特征是整数,其余的是分类特征,那么在这种情况下,我应该如何进行缩放过程


Tags: 数据代码fromimportjobsresrandom特征

热门问题