flowchart LR
A["学習データ"] --> B["ヒストグラム\n近似で離散化"]
B --> C["損失最大の\n葉を分割\n(Leaf-wise)"]
C --> D["学習率ηで\n予測に加算"]
D --> E{"収束?"}
E -->|No| C
E -->|Yes| F["最終予測"]
style A fill:#2563eb,color:#fff
style C fill:#1e40af,color:#fff
style F fill:#10b981,color:#fff
flowchart TD
A["学習データ\n(N × D)"] --> B["EFB: 排他的特徴量を\nバンドル化 D→D'"]
B --> C["ヒストグラム離散化\n(255 bins)"]
C --> D["GOSS: 勾配ベースの\nサンプリング N→N'"]
D --> E["Leaf-wise\n分割探索"]
E --> F["損失改善が\n最大の葉を分割"]
F --> G{"収束?"}
G -->|No| D
G -->|Yes| H["最終モデル"]
style A fill:#2563eb,color:#fff
style E fill:#1e40af,color:#fff
style H fill:#10b981,color:#fff
参考リンク
Ke, G., Meng, Q., Finley, T., Wang, T., Chen, W., Ma, W., Ye, Q., & Liu, T.-Y. (2017). LightGBM: A Highly Efficient Gradient Boosting Decision Tree. Advances in Neural Information Processing Systems (NeurIPS), 30.
leaves_list=[8,16,31,63,127]train_scores,test_scores=[],[]fornlinleaves_list:m=LGBMClassifier(n_estimators=100,num_leaves=nl,learning_rate=0.1,random_state=42,verbose=-1,)m.fit(X_train,y_train)train_scores.append(roc_auc_score(y_train,m.predict_proba(X_train)[:,1]))test_scores.append(roc_auc_score(y_test,m.predict_proba(X_test)[:,1]))plt.figure(figsize=(8,4))plt.plot(leaves_list,train_scores,"o-",label="Train")plt.plot(leaves_list,test_scores,"s--",label="Test")plt.xlabel("num_leaves")plt.ylabel("ROC-AUC")plt.title("num_leaves vs ROC-AUC")plt.legend()plt.grid(True,alpha=0.3)plt.show()
rates=[0.01,0.05,0.1,0.3,0.5]train_scores,test_scores=[],[]forlrinrates:m=LGBMClassifier(n_estimators=200,num_leaves=31,learning_rate=lr,random_state=42,verbose=-1,)m.fit(X_train,y_train)train_scores.append(roc_auc_score(y_train,m.predict_proba(X_train)[:,1]))test_scores.append(roc_auc_score(y_test,m.predict_proba(X_test)[:,1]))plt.figure(figsize=(8,4))plt.plot(rates,train_scores,"o-",label="Train")plt.plot(rates,test_scores,"s--",label="Test")plt.xlabel("learning_rate")plt.ylabel("ROC-AUC")plt.title("learning_rate vs ROC-AUC")plt.legend()plt.grid(True,alpha=0.3)plt.show()
min_samples=[5,10,20,50,100]train_scores,test_scores=[],[]formsinmin_samples:m=LGBMClassifier(n_estimators=100,num_leaves=31,learning_rate=0.1,min_child_samples=ms,random_state=42,verbose=-1,)m.fit(X_train,y_train)train_scores.append(roc_auc_score(y_train,m.predict_proba(X_train)[:,1]))test_scores.append(roc_auc_score(y_test,m.predict_proba(X_test)[:,1]))plt.figure(figsize=(8,4))plt.plot(min_samples,train_scores,"o-",label="Train")plt.plot(min_samples,test_scores,"s--",label="Test")plt.xlabel("min_child_samples")plt.ylabel("ROC-AUC")plt.title("min_child_samples vs ROC-AUC")plt.legend()plt.grid(True,alpha=0.3)plt.show()