Skip to content

Commit

Permalink
pushing and eating
Browse files Browse the repository at this point in the history
  • Loading branch information
jwagner31 committed Dec 13, 2023
1 parent f9d6cee commit 1d40e5f
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions notebooks/FinalMilestone.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -118673,7 +118673,7 @@
"id": "fb769a60",
"metadata": {},
"source": [
"Now let's do some predictions on the test set for the hot data. The mean absolute percentage error is 0.471, which we will explain below after we predict on the cold data."
"Now let's do some predictions on the test set for the hot data. The mean absolute percentage error is 0.471, which we will explain below after we model the cold data."
]
},
{
Expand Down Expand Up @@ -118773,7 +118773,7 @@
"\n",
"cold_X_train, cold_X_test, cold_y_train, cold_y_test = train_test_split(cold_X, cold_y, test_size = 0.20, random_state = 0)\n",
"\n",
"coldgam = PoissonGAM()\n",
"coldgam = PoissonGAM() \n",
"\n",
"lam_grid = [0, 0.0001, 0.0002, 0.0003, 0.0004, 0.0005, 0.0006, 0.0007, 0.0008, 0.0009, 0.001]\n",
"splines_grid = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n",
Expand All @@ -118783,6 +118783,14 @@
"print(coldgam.summary())"
]
},
{
"cell_type": "markdown",
"id": "97bbd835",
"metadata": {},
"source": [
"We then calculate and print the MAPE of the cold GAM model below."
]
},
{
"cell_type": "code",
"execution_count": 236,
Expand Down Expand Up @@ -118813,6 +118821,14 @@
"print(mape)\n"
]
},
{
"cell_type": "markdown",
"id": "c4537ded",
"metadata": {},
"source": [
"Now we compare each model's ability to predict the violent crime counts on the entire dataset. We use the mean absolute percentage error because it better explains the difference in forecasting between the two models. As you see below, the hot model has a much lower MAPE than the cold model despite them having similar mean absolute errors. This suggest their forecasting abilities differ drastically, which suggest less of a predictive utility for this model. "
]
},
{
"cell_type": "code",
"execution_count": 237,
Expand Down Expand Up @@ -120475,14 +120491,16 @@
"id": "e6d691c5-349f-4a11-b172-f27753329f59",
"metadata": {},
"source": [
"Our Generalized Addititive Model does an effective job of fitting to the data, as demonstrated above by the psuedo R-square parameter. Perhaps this is due to our high effective degrees of freedom, which gets into the trade-off of bias versus variance, but we attempted to minimize this as much as we could. Poisson GAM was our most effective model due to the Poissonian error distribution conforming nicely to the errors associated with a strictly-positive count variable. We are able to explain much of the variance when it comes to "
"Our Generalized Addititive Models do an effective job of fitting to the data, as demonstrated above by the psuedo R-square parameter. Perhaps this is due to our high effective degrees of freedom, which gets into the trade-off of bias versus variance, but we attempted to minimize that as much as we could. Poisson GAM was our most effective model due to the Poissonian error distribution conforming nicely to the errors associated with a strictly-positive count variable. We are able to explain much of the variance when it comes to the violent crime counts per day based on the temperature, but the predictive utility is obviously not very good. This is expected, as we were primarily looking for a relationship between weather factors and crime, but not intending to do crime forecasting. That is an entire area of research that would require much more data than the weather on a given day. "
]
},
{
"cell_type": "markdown",
"id": "48c9cc01",
"metadata": {},
"source": []
"source": [
"Not finished yet..."
]
}
],
"metadata": {
Expand Down

0 comments on commit 1d40e5f

Please sign in to comment.