From 46f8fa4317b84f44d63c230f3cbdf96250478fa0 Mon Sep 17 00:00:00 2001 From: Jiting Xu <126802425+jitingxu1@users.noreply.github.com> Date: Thu, 27 Jun 2024 16:17:47 -0700 Subject: [PATCH] xgboost --- ...Credit - Credit Risk Model Stability.ipynb | 494 +++++++++++++++++- 1 file changed, 487 insertions(+), 7 deletions(-) diff --git a/examples/Home Credit - Credit Risk Model Stability.ipynb b/examples/Home Credit - Credit Risk Model Stability.ipynb index 1c061ae..e71f97b 100644 --- a/examples/Home Credit - Credit Risk Model Stability.ipynb +++ b/examples/Home Credit - Credit Risk Model Stability.ipynb @@ -1487,7 +1487,455 @@ "cell_type": "code", "execution_count": 31, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
XGBClassifier(base_score=None, booster=None, callbacks=None,\n",
+                            "              colsample_bylevel=None, colsample_bynode=None,\n",
+                            "              colsample_bytree=0.8, device=None, early_stopping_rounds=None,\n",
+                            "              enable_categorical=False, eval_metric=None, feature_types=None,\n",
+                            "              gamma=None, grow_policy=None, importance_type=None,\n",
+                            "              interaction_constraints=None, learning_rate=0.05, max_bin=None,\n",
+                            "              max_cat_threshold=None, max_cat_to_onehot=None,\n",
+                            "              max_delta_step=None, max_depth=4, max_leaves=None,\n",
+                            "              min_child_weight=None, missing=nan, monotone_constraints=None,\n",
+                            "              multi_strategy=None, n_estimators=100, n_jobs=None,\n",
+                            "              num_parallel_tree=None, random_state=42, ...)
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.
" + ], + "text/plain": [ + "XGBClassifier(base_score=None, booster=None, callbacks=None,\n", + " colsample_bylevel=None, colsample_bynode=None,\n", + " colsample_bytree=0.8, device=None, early_stopping_rounds=None,\n", + " enable_categorical=False, eval_metric=None, feature_types=None,\n", + " gamma=None, grow_policy=None, importance_type=None,\n", + " interaction_constraints=None, learning_rate=0.05, max_bin=None,\n", + " max_cat_threshold=None, max_cat_to_onehot=None,\n", + " max_delta_step=None, max_depth=4, max_leaves=None,\n", + " min_child_weight=None, missing=nan, monotone_constraints=None,\n", + " multi_strategy=None, n_estimators=100, n_jobs=None,\n", + " num_parallel_tree=None, random_state=42, ...)" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "import xgboost as xgb\n", "\n", @@ -1506,9 +1954,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 32, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "array([0.0339 , 0.03305925, 0.03192892, ..., 0.02614957, 0.02793066,\n", + " 0.02849679], dtype=float32)" + ] + }, + "execution_count": 32, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "# Predict\n", "xgboost.predict_proba(X_train_transformed)[:, 1]" @@ -1523,18 +1983,38 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 33, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Requirement already satisfied: lightgbm in /Users/claypot/miniconda3/envs/ibisml-dev/lib/python3.12/site-packages (4.3.0)\n", + "Requirement already satisfied: numpy in /Users/claypot/miniconda3/envs/ibisml-dev/lib/python3.12/site-packages (from lightgbm) (1.26.4)\n", + "Requirement already satisfied: scipy in /Users/claypot/miniconda3/envs/ibisml-dev/lib/python3.12/site-packages (from lightgbm) (1.13.1)\n", + "Note: you may need to restart the kernel to use updated packages.\n" + ] + } + ], "source": [ "pip install lightgbm" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 34, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "p = {'boosting_type': 'gbdt', 'colsample_bytree': 0.8, 'learning_rate': 0.05, 'max_depth': 4, 'min_child_samples': 20, 'min_child_weight': 0.001, 'min_split_gain': 0.0, 'num_leaves': 31, 'random_state': 5, 'reg_alpha': 0.0, 'reg_lambda': 0.0, 'subsample': 0.8, 'subsample_for_bin': 200000, 'subsample_freq': 0, 'objective': 'binary', 'metric': ['binary'], 'num_threads': 8}\n", + "early_stopping_round\n" + ] + } + ], "source": [ "from lightgbm import LGBMClassifier\n", "\n",