python的scikit-learn将特征转成one-hot特征_python sklearn one-hot

2017-06-16     浏览次数:

enc = OneHotEncoder(categorical_features=np.array([0,1,2]),n_values=[5,4,2]) 
    enc.fit(train_data)  
    train_data = enc.transform(train_data).toarray()  
    test_data = enc.transform(test_data).toarray()
*转载请注明出处,更多资料尽在 吾爱编程
返回吾爱编程首页