Pipeline evaluation
Cross-validated stage-over-stage comparison with persisted, rerun-safe results.
featurely.pipeline
add_pipeline_step(results_df, label, x, y, color=None, color_map=None, cv=10, results_path=None)
Run cross-validation for one pipeline step and upsert by stage name.
When results_path is provided, prior results are loaded from disk before
the update and saved back after the update. This supports sequential notebook
runs without duplicated stage rows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
results_df
|
DataFrame | None
|
Prior results frame, or None to start fresh or load from disk. |
required |
label
|
str
|
Stage name; an existing row with this name is replaced. |
required |
x
|
DataFrame
|
Feature matrix for this stage. |
required |
y
|
Series
|
Target series. |
required |
color
|
str | None
|
Optional explicit plot color for this stage. |
None
|
color_map
|
dict[str, str] | None
|
Optional stage-name-to-color mapping. When omitted, no package palette is applied and plotting uses Matplotlib defaults. |
None
|
cv
|
int
|
Number of cross-validation folds. |
10
|
results_path
|
str | Path | None
|
Optional pickle path for persisted, rerun-safe results. |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
The updated results frame with recomputed percent-vs-raw values. |
Source code in src/featurely/pipeline.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
plot_pipeline_steps(results_df, title='CV R2 pipeline steps', results_path=None)
Draw stage-wise cross-validation boxplots and print a text summary.
When results_path is provided, results are loaded from disk before plotting.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
results_df
|
DataFrame | None
|
Results frame from |
required |
title
|
str
|
Plot title. |
'CV R2 pipeline steps'
|
results_path
|
str | Path | None
|
Optional pickle path to load persisted results from. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If no results are available to plot. |
Source code in src/featurely/pipeline.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |