plot_score_per_step¶
yohou.plotting.plot_score_per_step(scorer, y_truth, y_pred, *, kind='line', compare_by='scorer', show_trend=False, columns=None, groups=None, facet_by='member', facet_n_cols=2, color_palette=None, show_legend=True, title=None, x_label=None, y_label=None, width=None, height=None, line_width=2.0, marker_size=8.0, marker_opacity=0.8, bar_opacity=0.85)
¶
Plot scorer value by forecast horizon step.
Evaluates forecast quality using componentwise aggregation and treats the
resulting score sequence as a horizon-step profile, plotting score[i]
against step i = 1, 2, .... This reveals how forecast accuracy
degrades as the horizon increases.
Parameters ¶
| Name | Type | Description | Default |
|---|---|---|---|
scorer
|
BaseScorer or dict[str, BaseScorer]
|
Yohou scorer instance. Will be cloned with
|
required |
y_truth
|
DataFrame
|
Ground truth with |
required |
y_pred
|
DataFrame or dict[str, DataFrame]
|
Predictions with
|
required |
kind
|
str
|
Plot kind:
|
"line"
|
compare_by
|
str
|
When both
Ignored when either |
"scorer"
|
show_trend
|
bool
|
Overlay a linear trend line ( |
False
|
columns
|
str | list[str] | None
|
Target column name(s) to score. When groups is set
this acts as a member postfix filter. |
None
|
groups
|
list[str] | None
|
Panel group prefixes to plot (faceted layout). |
None
|
facet_by
|
Literal['group', 'member'] | None
|
Faceting axis for panel data. |
"member"
|
facet_n_cols
|
int
|
Columns in the faceted grid. |
2
|
color_palette
|
list[str] | None
|
Custom colour palette. |
None
|
show_legend
|
bool
|
Whether to show the legend. |
True
|
title
|
str | None
|
Plot title. Defaults to |
None
|
x_label
|
str | None
|
X-axis label. Defaults to |
None
|
y_label
|
str | None
|
Y-axis label. Defaults to the scorer class name. |
None
|
width
|
int | None
|
Plot width in pixels. |
None
|
height
|
int | None
|
Plot height in pixels. |
None
|
line_width
|
float
|
Width of score lines. |
2.0
|
marker_size
|
float
|
Marker size for line+marker traces. |
8.0
|
marker_opacity
|
float
|
Opacity of scatter markers. |
0.8
|
bar_opacity
|
float
|
Opacity of bars when |
0.85
|
Returns ¶
| Type | Description |
|---|---|
Figure
|
Plotly figure object. |
Raises ¶
| Type | Description |
|---|---|
TypeError
|
If y_truth or y_pred is not a Polars DataFrame. |
ValueError
|
If kind is not |
Examples ¶
>>> import polars as pl
>>> from datetime import datetime
>>> from yohou.metrics import MeanAbsoluteError
>>> from yohou.plotting import plot_score_per_step
>>> y_truth = pl.DataFrame({
... "time": [datetime(2020, 1, i) for i in range(1, 6)],
... "value": [10.0, 20.0, 30.0, 40.0, 50.0],
... })
>>> y_pred = pl.DataFrame({
... "vintage_time": [datetime(2019, 12, 31)] * 5,
... "time": [datetime(2020, 1, i) for i in range(1, 6)],
... "value": [12.0, 19.0, 28.0, 42.0, 48.0],
... })
See Also ¶
plot_score_summary: Grouped bar chart of aggregate scores.plot_score_time_series: Score values over time.plot_score_distribution: Score distribution histogram/KDE.
Source Code ¶
Source code in src/yohou/plotting/evaluation.py
2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 | |
Tutorials¶
The following example notebooks use this component:
-
Decomposition
Chain PolynomialTrendForecaster, PatternSeasonalityForecaster, and FourierSeasonalityForecaster inside DecompositionPipeline with component visualisation.
-
Direct, Recursive, and MIMO Strategies
Compare direct, recursive, and MIMO reduction strategies across forecasting horizons to understand the trade-offs for your use case.
-
How to Apply Time-Weighted Training
Use time_weight and sample_weight_alignment to emphasise recent or seasonal training samples in PointReductionForecaster, with visualisation of weight curves and alignment strategy comparison.
-
How to Combine Forecasters with VotingPointForecaster
Build point ensembles with VotingPointForecaster using mean, weighted, and median aggregation strategies.
-
How to Forecast Intervals with CatBoost Multiquantile
Use IntervalReductionForecaster with CatBoost's native multiquantile objective for simultaneous lower and upper bound estimation.
-
How to Run Hyperparameter Search
Tune forecaster hyperparameters with GridSearchCV and RandomizedSearchCV using temporal cross-validation splitters and result scatter visualisation.