我目前正在设置一个带有Pandas的TF模块。它遇到了一些错误,但第一个错误是“数据”没有定义。另外NameError:名称'train'未定义。我尝试对每个运行def但是然后抛出多个语法错误。
import tensorflow as myTensorFlow
mysession = myTensorFlow.Session()
import pandas
dataset = pandas.read_csv('linear.csv')
dataset.shape
(1000, 5)
data.columns
Index([u'Classification', u'DGMLEN', u'IPLEN', u'TTL', u'IP'],dtype='object')
y, X = train['Classification'], train[['DGMLEN', 'IPLEN', 'IP']].fillna(0)
X_Modeltrain, X_Modeltest, y_Modeltrain, y_Modeltest = train_Modeltest_split(X, y, test_size=0.1, random_state=29)
lr = LogisticRegression()
lr.fit(X_Modeltrain, y_Modeltrain)
print accuracy_score(y_Modeltest, lr.predict(X_Modeltest))