plot_cv_results_scatter¶
yohou.plotting.model_selection.plot_cv_results_scatter(cv_results, param_name, scorer_name=None, *, higher_is_better=True, highlight_best=True, color_palette=None, show_legend=True, title=None, x_label=None, y_label=None, width=None, height=None, marker_size=10.0, marker_opacity=0.8, best_marker_size=16.0, best_marker_color='#dc2626', show_std=True)
¶
Plot hyperparameter search results as a scatter plot.
Creates a scatter plot showing the relationship between a hyperparameter and the cross-validation score, with optional highlighting of the best result.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
cv_results
|
dict
|
The cv_results_ dictionary from GridSearchCV or RandomizedSearchCV.
Must contain keys like |
required |
param_name
|
str
|
Name of the hyperparameter to plot on x-axis (without |
required |
scorer_name
|
str | None
|
Name of the scorer (without |
None
|
higher_is_better
|
bool
|
Whether higher score values are better. When False, scores are negated
for display so that metrics like |
True
|
highlight_best
|
bool
|
Whether to highlight the best parameter value. |
True
|
color_palette
|
list[str] | None
|
Custom color palette. If None, uses yohou palette. |
None
|
show_legend
|
bool
|
Whether to show the legend. |
True
|
title
|
str | None
|
Plot title. Defaults to "CV Results: {param_name}". |
None
|
x_label
|
str | None
|
X-axis label. Defaults to the parameter name. |
None
|
y_label
|
str | None
|
Y-axis label. Defaults to "Mean Test Score". |
None
|
width
|
int | None
|
Plot width in pixels. |
None
|
height
|
int | None
|
Plot height in pixels. |
None
|
marker_size
|
float
|
Size of the scatter markers. |
10.0
|
marker_opacity
|
float
|
Opacity of scatter markers. |
0.8
|
best_marker_size
|
float
|
Size of the best-result star marker. |
16.0
|
best_marker_color
|
str
|
Color of the best-result star marker. |
"#dc2626"
|
show_std
|
bool
|
Whether to show error bars (if std_test_{scorer} exists in cv_results). |
True
|
Returns¶
| Type | Description |
|---|---|
Figure
|
Plotly figure object. |
Raises¶
| Type | Description |
|---|---|
ValueError
|
If required keys are not found in cv_results. |
Examples¶
>>> # Example cv_results_ structure from GridSearchCV
>>> cv_results = {
... "param_alpha": [0.01, 0.1, 1.0, 10.0],
... "mean_test_score": [-0.5, -0.3, -0.2, -0.4],
... "std_test_score": [0.05, 0.03, 0.02, 0.06],
... "rank_test_score": [3, 2, 1, 4],
... }
See Also¶
plot_splits : Plot cross-validation splits.
GridSearchCV : Grid search with cross-validation.
RandomizedSearchCV : Randomized search with cross-validation.
Source Code¶
Show/Hide source
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | |
Tutorials¶
The following example notebooks use this component:
-
How to Run Hyperparameter Search
Evaluation-Search
Tune forecaster hyperparameters with GridSearchCV and RandomizedSearchCV using temporal cross-validation splitters and result scatter visualisation.
-
Reduction Forecasting Walkthrough
Getting-Started
Walk through the full fit/predict/evaluate cycle with PointReductionForecaster, cross-validation, and grid search on a real dataset.
-
Quickstart
Quickstart
Comprehensive end-to-end tour of yohou beyond the Getting Started tutorials, covering data loading, baseline forecasting, preprocessing pipelines, decomposition, cross-validation search, and interval prediction.
-
How to Visualize Model Selection Results
Visualization
Visualise CV fold geometry with expanding and sliding window splitters and hyperparameter search results with plot_splits and plot_cv_results_scatter.