机器学习估计器训练步骤无法在终端中显示

时间:2021-04-30 13:58:14

标签: tensorflow machine-learning tensorflow-estimator

我正在尝试在 tensorflow 中构建一个线性分类器,下面是我的代码:

model = tf.estimator.LinearClassifier(
  n_classes = 2,
  model_dir = "ongoing",
  feature_columns = categorical_features + continuous_features ///these are the feature columns
)

FEATURES = ['Age', 'Gender', 'ICD9Code']
LABEL = 'Condition'

def get_input_fn(data_set, num_epochs, n_batch, shuffle):
    input = tf.compat.v1.estimator.inputs.pandas_input_fn(
       x = pd.DataFrame({k: data_set[k].values for k in FEATURES}),
       # x = data_dic,
       y = pd.Series(data_set[LABEL].values),
       batch_size = n_batch,
       num_epochs = num_epochs,
       shuffle = shuffle
     )
    return input

model.train(
  input_fn = get_input_fn(csv_data, num_epochs = 40, n_batch = 10461, shuffle = False
  ),
  steps = 1000
)

得到这样的终端,你能帮忙解决这个问题吗?谢谢!

附言我的 tensorflow 版本是 2.4.1

enter image description here

0 个答案:

没有答案