Skip to content

Commit 13b2d59

Browse files
committed
Pushing the docs to dev/ for branch: main, commit fa5d7275ba4dd2627b6522e1ec4eaf0f3a2e3c05
1 parent 4f61eb8 commit 13b2d59

File tree

1,539 files changed

+5993
-5990
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,539 files changed

+5993
-5990
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

dev/_downloads/86c888008757148890daaf43d664fa71/plot_tweedie_regression_insurance_claims.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,8 +655,9 @@ def lorenz_curve(y_true, y_pred, exposure):
655655
ranked_pure_premium = y_true[ranking]
656656
cumulated_claim_amount = np.cumsum(ranked_pure_premium * ranked_exposure)
657657
cumulated_claim_amount /= cumulated_claim_amount[-1]
658-
cumulated_samples = np.linspace(0, 1, len(cumulated_claim_amount))
659-
return cumulated_samples, cumulated_claim_amount
658+
cumulated_exposure = np.cumsum(ranked_exposure)
659+
cumulated_exposure /= cumulated_exposure[-1]
660+
return cumulated_exposure, cumulated_claim_amount
660661

661662

662663
fig, ax = plt.subplots(figsize=(8, 8))
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

dev/_downloads/a97bf662e52d471b04e1ab480c0ad7f2/plot_tweedie_regression_insurance_claims.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@
242242
},
243243
"outputs": [],
244244
"source": [
245-
"from sklearn.metrics import auc\n\n\ndef lorenz_curve(y_true, y_pred, exposure):\n y_true, y_pred = np.asarray(y_true), np.asarray(y_pred)\n exposure = np.asarray(exposure)\n\n # order samples by increasing predicted risk:\n ranking = np.argsort(y_pred)\n ranked_exposure = exposure[ranking]\n ranked_pure_premium = y_true[ranking]\n cumulated_claim_amount = np.cumsum(ranked_pure_premium * ranked_exposure)\n cumulated_claim_amount /= cumulated_claim_amount[-1]\n cumulated_samples = np.linspace(0, 1, len(cumulated_claim_amount))\n return cumulated_samples, cumulated_claim_amount\n\n\nfig, ax = plt.subplots(figsize=(8, 8))\n\ny_pred_product = glm_freq.predict(X_test) * glm_sev.predict(X_test)\ny_pred_total = glm_pure_premium.predict(X_test)\n\nfor label, y_pred in [\n (\"Frequency * Severity model\", y_pred_product),\n (\"Compound Poisson Gamma\", y_pred_total),\n]:\n ordered_samples, cum_claims = lorenz_curve(\n df_test[\"PurePremium\"], y_pred, df_test[\"Exposure\"]\n )\n gini = 1 - 2 * auc(ordered_samples, cum_claims)\n label += \" (Gini index: {:.3f})\".format(gini)\n ax.plot(ordered_samples, cum_claims, linestyle=\"-\", label=label)\n\n# Oracle model: y_pred == y_test\nordered_samples, cum_claims = lorenz_curve(\n df_test[\"PurePremium\"], df_test[\"PurePremium\"], df_test[\"Exposure\"]\n)\ngini = 1 - 2 * auc(ordered_samples, cum_claims)\nlabel = \"Oracle (Gini index: {:.3f})\".format(gini)\nax.plot(ordered_samples, cum_claims, linestyle=\"-.\", color=\"gray\", label=label)\n\n# Random baseline\nax.plot([0, 1], [0, 1], linestyle=\"--\", color=\"black\", label=\"Random baseline\")\nax.set(\n title=\"Lorenz Curves\",\n xlabel=\"Fraction of policyholders\\n(ordered by model from safest to riskiest)\",\n ylabel=\"Fraction of total claim amount\",\n)\nax.legend(loc=\"upper left\")\nplt.plot()"
245+
"from sklearn.metrics import auc\n\n\ndef lorenz_curve(y_true, y_pred, exposure):\n y_true, y_pred = np.asarray(y_true), np.asarray(y_pred)\n exposure = np.asarray(exposure)\n\n # order samples by increasing predicted risk:\n ranking = np.argsort(y_pred)\n ranked_exposure = exposure[ranking]\n ranked_pure_premium = y_true[ranking]\n cumulated_claim_amount = np.cumsum(ranked_pure_premium * ranked_exposure)\n cumulated_claim_amount /= cumulated_claim_amount[-1]\n cumulated_exposure = np.cumsum(ranked_exposure)\n cumulated_exposure /= cumulated_exposure[-1]\n return cumulated_exposure, cumulated_claim_amount\n\n\nfig, ax = plt.subplots(figsize=(8, 8))\n\ny_pred_product = glm_freq.predict(X_test) * glm_sev.predict(X_test)\ny_pred_total = glm_pure_premium.predict(X_test)\n\nfor label, y_pred in [\n (\"Frequency * Severity model\", y_pred_product),\n (\"Compound Poisson Gamma\", y_pred_total),\n]:\n ordered_samples, cum_claims = lorenz_curve(\n df_test[\"PurePremium\"], y_pred, df_test[\"Exposure\"]\n )\n gini = 1 - 2 * auc(ordered_samples, cum_claims)\n label += \" (Gini index: {:.3f})\".format(gini)\n ax.plot(ordered_samples, cum_claims, linestyle=\"-\", label=label)\n\n# Oracle model: y_pred == y_test\nordered_samples, cum_claims = lorenz_curve(\n df_test[\"PurePremium\"], df_test[\"PurePremium\"], df_test[\"Exposure\"]\n)\ngini = 1 - 2 * auc(ordered_samples, cum_claims)\nlabel = \"Oracle (Gini index: {:.3f})\".format(gini)\nax.plot(ordered_samples, cum_claims, linestyle=\"-.\", color=\"gray\", label=label)\n\n# Random baseline\nax.plot([0, 1], [0, 1], linestyle=\"--\", color=\"black\", label=\"Random baseline\")\nax.set(\n title=\"Lorenz Curves\",\n xlabel=\"Fraction of policyholders\\n(ordered by model from safest to riskiest)\",\n ylabel=\"Fraction of total claim amount\",\n)\nax.legend(loc=\"upper left\")\nplt.plot()"
246246
]
247247
}
248248
],
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

dev/_downloads/scikit-learn-docs.zip

-10.5 KB
Binary file not shown.
-165 Bytes

0 commit comments

Comments
 (0)