用jupyter notebook 运行教程中下面这个cell时,总会报"The kernel appears to have died. It will restart automatically"错误。
params = {
'n_trees': 50,
'max_depth': 3,
'n_batches_per_layer': 1,
# You must enable center_bias = True to get DFCs. This will force the model to
# make an initial prediction before using any features (e.g. use the mean of
# the training labels for regression or log odds for classification when
# using cross entropy loss).
'center_bias': True
}
est = tf.estimator.BoostedTreesClassifier(feature_columns, **params)
est.train(train_input_fn, max_steps=100)
results = est.evaluate(eval_input_fn)
pd.Series(results).to_frame()
在网上搜了一圈后,大致有两种原因:
- OOM:OUT OF MEMORY
- 软件版本不一致
但是基于训练数据只有30k, 627条,我首先排除了OOM的可能行,把可能相关的包更新了一遍,然而这个错还在。
最终在fast.ai论坛上找到了解决方法:
Alex.Nikitin Alexander
Hi! Had the same issue on AWS P2.xlarge. Choosing lower batch size from the beginning should help.
因为数据量小,源代码将所有数据直接作为一个batch,将batch_size改小后,it works for me too!