Skip to content

Commit

Permalink
blog figures added
Browse files Browse the repository at this point in the history
  • Loading branch information
corbt committed Oct 23, 2024
1 parent ff84d24 commit d4c4c4d
Show file tree
Hide file tree
Showing 3 changed files with 766 additions and 1 deletion.
713 changes: 713 additions & 0 deletions blog-figures.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion deps/sglang
52 changes: 52 additions & 0 deletions stories-inference.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"import seaborn as sns\n",
"import numpy as np\n",
"\n",
"# Define the range for the heatmap\n",
"min_score = min(stories[\"log_score\"].min(), stories[\"predictions\"].min())\n",
"max_score = max(stories[\"log_score\"].max(), stories[\"predictions\"].max())\n",
"\n",
"# Create a more continuous 2D histogram\n",
"plt.figure(figsize=(12, 10))\n",
"sns.kdeplot(\n",
" data=stories.sample(10000, seed=42),\n",
" x=\"log_score\",\n",
" y=\"predictions\",\n",
" cmap=\"YlOrRd\",\n",
" fill=True,\n",
" cbar=True,\n",
" cbar_kws={\"label\": \"Density\"},\n",
")\n",
"\n",
"plt.title(\"Density Heatmap of Predicted Score vs Actual Score\")\n",
"plt.xlabel(\"Actual Score (log_score)\")\n",
"plt.ylabel(\"Predicted Score\")\n",
"\n",
"# Set axis limits to match the data range\n",
"plt.xlim(min_score, max_score)\n",
"plt.ylim(min_score, max_score)\n",
"\n",
"# Add a diagonal line for reference\n",
"plt.plot([min_score, max_score], [min_score, max_score], \"k--\", alpha=0.5)\n",
"\n",
"plt.tight_layout()\n",
"plt.show()"
]
}
],
"metadata": {
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

0 comments on commit d4c4c4d

Please sign in to comment.