diff --git a/HospitalWaitTimeCalc.ipynb b/HospitalWaitTimeCalc.ipynb index f733c21..00e5a8e 100644 --- a/HospitalWaitTimeCalc.ipynb +++ b/HospitalWaitTimeCalc.ipynb @@ -2360,11 +2360,6 @@ "print(\"RMSE:\", np.sqrt(mean_squared_error(y_test, y_pred)))" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [] - }, { "cell_type": "markdown", "metadata": {}, @@ -2456,6 +2451,545 @@ "plt.title(\"Feature Importance\")\n", "plt.show()\n" ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Adjust the relevant hyperparameters of the algorithm to improve the outputs. - Rayyan Hodges" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": {}, + "outputs": [], + "source": [ + "import xgboost as xgb\n", + "\n", + "model = xgb.XGBRegressor(\n", + " objective='reg:squarederror',\n", + " n_estimators=400, # Double the model size\n", + " learning_rate=0.1,\n", + " max_depth=5,\n", + " subsample=0.8,\n", + " colsample_bytree=0.8,\n", + " random_state=42\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Retrain the adjusted ML model with the training data. - Rayyan Hodges" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
XGBRegressor(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", + " feature_weights=None, gamma=None, grow_policy=None,\n", + " importance_type=None, interaction_constraints=None,\n", + " learning_rate=0.1, max_bin=None, max_cat_threshold=None,\n", + " max_cat_to_onehot=None, max_delta_step=None, max_depth=5,\n", + " max_leaves=None, min_child_weight=None, missing=nan,\n", + " monotone_constraints=None, multi_strategy=None, n_estimators=400,\n", + " n_jobs=None, num_parallel_tree=None, ...)In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
XGBRegressor(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", + " feature_weights=None, gamma=None, grow_policy=None,\n", + " importance_type=None, interaction_constraints=None,\n", + " learning_rate=0.1, max_bin=None, max_cat_threshold=None,\n", + " max_cat_to_onehot=None, max_delta_step=None, max_depth=5,\n", + " max_leaves=None, min_child_weight=None, missing=nan,\n", + " monotone_constraints=None, multi_strategy=None, n_estimators=400,\n", + " n_jobs=None, num_parallel_tree=None, ...)