找出下面代码错误from sklearn.model_selection import train_test_split train_idx, test_idx = train_test_split(range(len(data)), test_size=0.1, random_state=42) train_idx, val_idx = train_test_split(train_idx, test_size=0.2, random_state=42 train_adj, train_features, train_labels = adj[train_idx], features[train_idx], data.iloc[train_idx]['LogS'] val_adj, val_features, val_labels = adj[val_idx], features[val_idx], data.iloc[val_idx]['LogS'] test_adj, test_features, test_labels = adj[test_idx], features[test_idx], data.iloc[test_idx]['LogS'] optimizer = tf.keras.optimizers.Adam(learning_rate=0.01) loss_fn = tf.keras.losses.MeanSquaredError() metrics=[tf.keras.metrics.MeanAbsoluteError(), tf.keras.metrics.RootMeanSquaredError()] model = GCNModel(hidden_dim=64, output_dim=32) model.compile(optimizer=optimizer, loss=loss_fn, metrics=metrics) history=model.fit((train_features,train_adj),train_labels,epochs=50,validation_data=((val_features, val_adj), val_labels)) test_scores = model.evaluate((test_features, test_adj), test_labels, verbose=0)
时间: 2023-06-06 15:08:07 浏览: 141
csl_css_宏定义_解析
代码中的错误是 train_idx, val_idx = train_test_split(train_idx, test_size=0.2, random_state=42 没有正确的闭合括号。正确的代码应该是 train_idx, val_idx = train_test_split(train_idx, test_size=0.2, random_state=42)。
阅读全文