spires_opt_result
Struct populated by spires_optimize with the best configuration found and its performance statistics.
Definition
struct spires_opt_result {
spires_reservoir_config best_config;
double best_log10_ridge;
double best_score;
double metric_mean;
double metric_std;
};Fields
| Field | Type | Description |
|---|---|---|
best_config | spires_reservoir_config | The reservoir configuration that achieved the highest composite score. This struct can be passed directly to spires_reservoir_create to instantiate a reservoir with the optimized hyperparameters. |
best_log10_ridge | double | Base-10 logarithm of the best ridge regularization parameter. To obtain the actual lambda, compute pow(10.0, best_log10_ridge). The optimizer searches over log-space because good ridge values typically span several orders of magnitude. |
best_score | double | The composite score of the best configuration, computed as metric_mean - lambda_var * metric_std - lambda_cost * relative_cost. Higher is better. |
metric_mean | double | Mean of the selected performance metric (AUROC or AUPRC) across all seeds evaluated in the final budget stage for the best configuration. |
metric_std | double | Standard deviation of the selected performance metric across seeds in the final budget stage. A low value indicates that the configuration performs consistently across different random reservoir instantiations. |
Example
struct spires_opt_result result;
int rc = spires_optimize(&base, budgets, 3, &score, &result,
input, target, series_length);
if (rc != 0) {
fprintf(stderr, "optimization failed\n");
return 1;
}
printf("Best neurons: %zu\n", result.best_config.num_neurons);
printf("Best spectral radius: %.3f\n", result.best_config.spectral_radius);
printf("Best log10(lambda): %.2f\n", result.best_log10_ridge);
printf("Composite score: %.4f\n", result.best_score);
printf("Metric: %.4f +/- %.4f\n",
result.metric_mean, result.metric_std);
/* Build the final reservoir using the optimized config */
double lambda = pow(10.0, result.best_log10_ridge);
spires_reservoir *r = NULL;
spires_reservoir_create(&result.best_config, &r);
spires_train_ridge(r, input, target, series_length, lambda);Notes
- neuron_params lifetime. The
best_config.neuron_paramspointer inside the result struct points to internally managed memory. It remains valid until the next call tospires_optimizeor program termination. If you need the neuron parameters to outlive this window, copy them into your own buffer before callingspires_optimizeagain. - Score interpretation. The
best_scoreis a composite that includes variance and cost penalties (seespires_opt_score). To evaluate raw classification performance, usemetric_meandirectly. - Reproducibility. To reproduce the exact performance of the best configuration, create a reservoir from
best_configand train withpow(10.0, best_log10_ridge). Note that different RNG seeds will produce different weight matrices, sometric_stdquantifies the expected variation.
See Also
- spires_optimize — populates this struct.
- spires_opt_budget — budget stage configuration.
- spires_opt_score — scoring configuration that determines
best_score. - spires_reservoir_config — the
best_configfield is this type. - spires_reservoir_create — create a reservoir from the optimized config.
Last updated on