逻辑回归与交叉验证

时间:2018-11-28 23:49:03

标签: python-3.x cross-validation

我正在尝试对逻辑回归应用交叉验证。我还缩放了数据。我收到一条错误消息,提示未在最后第二行定义y。错误:名称'y'未定义。

scalar = StandardScaler()
classifier=LogisticRegression() 
data_dummy = pd.get_dummies(dtrain2[['Percent Black or African American','Percent 65 and Older','Percent Below Poverty Level','2014 Population']], drop_first = True)
result = cross_val_score(classifier,X = data_dummy,y = dtrain2['Party'],cv = folds)
pipeline = Pipeline([('transformer', scalar), ('estimator',classifier)])
print(metrics.classification_report(y,result))
print(metrics.classification_report(y,result)) 

0 个答案:

没有答案