ValueError:在实现sklearn时无法将字符串转换为float

时间:2018-11-25 19:37:11

标签: python python-2.7 machine-learning scikit-learn sklearn-pandas

我是新来的,我遇到了这样的错误;

*[id^='tippy-']{
    pointer-events: initial;
}

我使用的数据集的形状为(30,216)

 File "C:\Users\Himanshu\Desktop\Project\ML\Pract\mlp1.py", line 268, in 
 <module> cv_results = model_selection.cross_val_score(model, X_train, Y_train, 
 cv=kfold, scoring=scoring)
 File "C:\Users\Himanshu\AppData\Roaming\Python\Python27\site-  
 packages\sklearn\model_selection\_validation.py", line 402, in cross_val_score
 error_score=error_score)
 .
 .
 etc..like above)
 ValueError: could not convert string to float: transact

我想知道,我是否正确分割了它。 有人可以建议为什么发生此错误。

已编辑: 我要添加其余的代码:

array = dataset.values
X = array[:,0:215]
Y = array[:,215]
validation_size = 0.20
seed = 7
X_train, X_validation, Y_train, Y_validation = 
model_selection.train_test_split(X, Y, test_size=validation_size, 
random_state=seed)

0 个答案:

没有答案