Cross-Validation¶
Leave-one-out jackknife cross-validation for assessing model predictive performance.
wrtds.cross_val
¶
Leave-one-out cross-validation for WRTDS.
cross_validate(sample, window_y=7.0, window_q=2.0, window_s=0.5, min_num_obs=100, min_num_uncen=50, edge_adjust=True)
¶
Leave-one-out jack-knife cross-validation.
For each sample observation i, the model is fitted on all other observations and used to predict at the held-out point. This gives an honest measure of prediction error.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sample
|
Populated sample DataFrame with |
required | |
window_y
|
Time half-window in years. |
7.0
|
|
window_q
|
Discharge half-window in log units. |
2.0
|
|
window_s
|
Season half-window in fraction of year. |
0.5
|
|
min_num_obs
|
Minimum observations with nonzero weight. |
100
|
|
min_num_uncen
|
Minimum uncensored observations with nonzero weight. |
50
|
|
edge_adjust
|
Expand time window near record edges. |
True
|
Returns:
| Type | Description |
|---|---|
|
Sample DataFrame with added columns |
|
|
Total MLE solves: n (one per sample observation). |