簡體   English   中英

XGBOOST 殺死 Jupyter Notebook 內核

[英]XGBOOST killing Jupyter Notebook Kernel

我目前正在嘗試在 Jupyter 筆記本上本地運行 XGBOOST 模型。 我有一個形狀為 (68799, 85) 的數據集。 這個想法是使用 Optuna 進行超參數調整。 但是,Jupyter Notebook 上的內核已死亡,並顯示消息The kernel appears to have died. It will restart automatically. 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

有沒有人遇到過這樣的問題? 內核在模型甚至訓練之前就死了,這似乎很奇怪。

我在每個討論這個問題的網頁上都嘗試了所有的東西。 唯一對我有用的是降級到以前的 xgboost 版本。 這是我所做的(在我的 MacOS 終端中)有效的:

pip uninstall xgboost
pip install xgboost==0.80

在這篇文章中找到了上面的答案(非常感謝回答它的 Евгений Куприков): XGBoost 在 jupyter notebook 中崩潰內核

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM