Skip to content

Commit bc8592c

Browse files
committed
Pushing the docs to dev/ for branch: main, commit f811a03991d0bcd04bc52ee9f659dcd2de1cf4de
1 parent afd4416 commit bc8592c

193 files changed

Lines changed: 21219 additions & 21216 deletions

File tree

Some content is hidden

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

dev/_downloads/198ad5d07740cb53545df898265e9ffe/02_text_with_string_encoders.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def plot_box_results(named_results):
237237
# case, 30.
238238
from skrub import StringEncoder
239239

240-
string_encoder = StringEncoder(ngram_range=(3, 4), analyzer="char_wb")
240+
string_encoder = StringEncoder(ngram_range=(3, 4), analyzer="char_wb", random_state=0)
241241

242242
string_encoder_pipe = make_pipeline(
243243
TableVectorizer(high_cardinality=string_encoder),
@@ -302,12 +302,13 @@ def plot_performance_tradeoff(results):
302302
ax.set_title("Prediction performance / training time trade-off")
303303

304304
ax.annotate(
305-
"",
306-
xy=(1.5, 0.98),
307-
xytext=(8.5, 0.90),
308-
arrowprops=dict(arrowstyle="->", mutation_scale=15),
305+
"Best time / \nperformance trade-off",
306+
xy=(0.05, 0.95),
307+
xycoords="axes fraction",
308+
xytext=(0.2, 0.8),
309+
textcoords="axes fraction",
310+
arrowprops=dict(arrowstyle="->", lw=1.5, mutation_scale=15),
309311
)
310-
ax.text(5.8, 0.86, "Best time / \nperformance trade-off")
311312
ax.legend(bbox_to_anchor=(1.02, 0.3))
312313
plt.show()
313314

Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.

dev/_downloads/32eb7122d28304b1f0e44f3a61f9889b/02_text_with_string_encoders.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
},
149149
"outputs": [],
150150
"source": [
151-
"from skrub import StringEncoder\n\nstring_encoder = StringEncoder(ngram_range=(3, 4), analyzer=\"char_wb\")\n\nstring_encoder_pipe = make_pipeline(\n TableVectorizer(high_cardinality=string_encoder),\n HistGradientBoostingClassifier(),\n)\n\nstring_encoder_results = cross_validate(string_encoder_pipe, X, y, scoring=\"roc_auc\")\nresults.append((\"StringEncoder\", string_encoder_results))\n\nplot_box_results(results)"
151+
"from skrub import StringEncoder\n\nstring_encoder = StringEncoder(ngram_range=(3, 4), analyzer=\"char_wb\", random_state=0)\n\nstring_encoder_pipe = make_pipeline(\n TableVectorizer(high_cardinality=string_encoder),\n HistGradientBoostingClassifier(),\n)\n\nstring_encoder_results = cross_validate(string_encoder_pipe, X, y, scoring=\"roc_auc\")\nresults.append((\"StringEncoder\", string_encoder_results))\n\nplot_box_results(results)"
152152
]
153153
},
154154
{
@@ -166,7 +166,7 @@
166166
},
167167
"outputs": [],
168168
"source": [
169-
"def plot_performance_tradeoff(results):\n fig, ax = plt.subplots(figsize=(5, 4), dpi=200)\n markers = [\"s\", \"o\", \"^\", \"x\"]\n for idx, (name, result) in enumerate(results):\n ax.scatter(\n result[\"fit_time\"],\n result[\"test_score\"],\n label=name,\n marker=markers[idx],\n )\n mean_fit_time = np.mean(result[\"fit_time\"])\n mean_score = np.mean(result[\"test_score\"])\n ax.scatter(\n mean_fit_time,\n mean_score,\n color=\"k\",\n marker=markers[idx],\n )\n std_fit_time = np.std(result[\"fit_time\"])\n std_score = np.std(result[\"test_score\"])\n ax.errorbar(\n x=mean_fit_time,\n y=mean_score,\n yerr=std_score,\n fmt=\"none\",\n c=\"k\",\n capsize=2,\n )\n ax.errorbar(\n x=mean_fit_time,\n y=mean_score,\n xerr=std_fit_time,\n fmt=\"none\",\n c=\"k\",\n capsize=2,\n )\n ax.set_xscale(\"log\")\n\n ax.set_xlabel(\"Time to fit (seconds)\")\n ax.set_ylabel(\"ROC AUC\")\n ax.set_title(\"Prediction performance / training time trade-off\")\n\n ax.annotate(\n \"\",\n xy=(1.5, 0.98),\n xytext=(8.5, 0.90),\n arrowprops=dict(arrowstyle=\"->\", mutation_scale=15),\n )\n ax.text(5.8, 0.86, \"Best time / \\nperformance trade-off\")\n ax.legend(bbox_to_anchor=(1.02, 0.3))\n plt.show()\n\n\nplot_performance_tradeoff(results)"
169+
"def plot_performance_tradeoff(results):\n fig, ax = plt.subplots(figsize=(5, 4), dpi=200)\n markers = [\"s\", \"o\", \"^\", \"x\"]\n for idx, (name, result) in enumerate(results):\n ax.scatter(\n result[\"fit_time\"],\n result[\"test_score\"],\n label=name,\n marker=markers[idx],\n )\n mean_fit_time = np.mean(result[\"fit_time\"])\n mean_score = np.mean(result[\"test_score\"])\n ax.scatter(\n mean_fit_time,\n mean_score,\n color=\"k\",\n marker=markers[idx],\n )\n std_fit_time = np.std(result[\"fit_time\"])\n std_score = np.std(result[\"test_score\"])\n ax.errorbar(\n x=mean_fit_time,\n y=mean_score,\n yerr=std_score,\n fmt=\"none\",\n c=\"k\",\n capsize=2,\n )\n ax.errorbar(\n x=mean_fit_time,\n y=mean_score,\n xerr=std_fit_time,\n fmt=\"none\",\n c=\"k\",\n capsize=2,\n )\n ax.set_xscale(\"log\")\n\n ax.set_xlabel(\"Time to fit (seconds)\")\n ax.set_ylabel(\"ROC AUC\")\n ax.set_title(\"Prediction performance / training time trade-off\")\n\n ax.annotate(\n \"Best time / \\nperformance trade-off\",\n xy=(0.05, 0.95),\n xycoords=\"axes fraction\",\n xytext=(0.2, 0.8),\n textcoords=\"axes fraction\",\n arrowprops=dict(arrowstyle=\"->\", lw=1.5, mutation_scale=15),\n )\n ax.legend(bbox_to_anchor=(1.02, 0.3))\n plt.show()\n\n\nplot_performance_tradeoff(results)"
170170
]
171171
},
172172
{
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)