【发布时间】:2021-10-24 16:13:20
【问题描述】:
我目前正在尝试在 Jupyter 笔记本上本地运行 XGBOOST 模型。我有一个形状为 (68799, 85) 的数据集。这个想法是使用 Optuna 进行超参数调整。但是,Jupyter 笔记本上的内核会因消息The kernel appears to have died. It will restart automatically. 而死去
当我在任何模型拟合/调整开始之前将我的训练集、测试集和验证集转换为 DMatrix 数据类型时,笔记本就会死机:
features = df.drop(["Target"], axis = 1) # X
target = df["Target"] # Y
train_ratio = 0.8
val_ratio = 0.1
test_ratio = 0.1
# Creating train and test sets
X_train, X_test, y_train, y_test = train_test_split(features,
target,
test_size = 1 - train_ratio,
random_state = 42)
# Creating validation set
X_val, X_test, y_val, y_test = train_test_split(X_test,
y_test,
test_size = test_ratio/(test_ratio + val_ratio),
random_state = 42)
# Converting to DMatrix
d_train = xgb.DMatrix(X_train,
label = y_train)
d_test = xgb.DMatrix(X_test,
label = y_test)
d_val = xgb.DMatrix(X_val,
label = y_val)
我最终将在 AWS 上预置 EC2 资源,但我想检查 Jupyter 是否崩溃,因为我有一个大型数据集,或者 Jupyter 甚至我的机器是否存在一些潜在问题:
Processor: 2.6 GHz 6-Core Intel Core i7
Memory: 16 GB 2667 MHz DDR4
Graphics: AMD Radeon Pro 5300M 4 GB Intel UHD Graphics 630 1536 MB
以前有人遇到过这样的问题吗?在模型训练之前内核就死掉了,这似乎很奇怪。
【问题讨论】:
-
您应该通过在应该提供真实错误消息的 python shell(jupyter 外部)中运行代码来获得更有意义的错误消息。
标签: python machine-learning jupyter-notebook xgboost