plot_cv_results_scatter¶
yohou.plotting.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 ¶
Source code in src/yohou/plotting/model_selection.py
626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 | |
Tutorials¶
The following example notebooks use this component:
-
How to Run Hyperparameter Search
Tune forecaster hyperparameters with GridSearchCV and RandomizedSearchCV using temporal cross-validation splitters and result scatter visualisation.
-
How to Search with Multiple Metrics
Evaluate hyperparameter configurations against multiple metrics simultaneously with dict-of-scorers, refit strategies, and Pareto-optimal selection.
-
How to Visualize Model Selection Results
Visualise CV fold geometry with expanding and sliding window splitters and hyperparameter search results with plot_splits and plot_cv_results_scatter.
-
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.
-
Reduction Forecasting Walkthrough
Walk through the full fit/predict/evaluate cycle with PointReductionForecaster, cross-validation, and grid search on a real dataset.