我试图训练泰坦尼克号的数据与谷歌合作,但我不能训练与预处理命令。它给我的名称'火车'是没有定义的错误。我怎么能与这个问题的数字?
import numpy as np
seed = 7
np.random.seed(seed)
import pandas as pd
train_df = pd.read_csv('/content/drive/MyDrive/Colab Notebooks/train.csv' , header=0)
preprocess(train)
group_titles(train)
num_epochs = 100
batch_size = 32
traindata, lengh_features = data_subset(train)
Y_train = np.array(train['Survived']).astype(int)
X_train = np.array(traindata).astype(float)
train_set_size = int(.67 * len(X_train))
model, history_model = create_model(train_set_size, lengh_features, num_epochs, batch_size)
plots(history_model)
X_validation = X_train[train_set_size:]
Y_validation = Y_train[train_set_size:]
loss_and_metrics = model.evaluate(X_validation, Y_validation, batch_size=batch_size)
print ("loss_and_metrics")
test(batch_size)
但我得到-〉名称'train'是未定义的错误你能帮助我吗?(我用谷歌colab)
2条答案
按热度按时间7kqas0il1#
这段代码在我系统上有效。
wsewodh22#
看起来您使用train_df定义了变量
精确摘录:
也许您需要使用train_df而不是train。