polars_online.spec.output_fields¶
- polars_online.spec.output_fields(spec: dict[str, Any]) list[str][source]¶
List the names of the fields a spec writes, in order.
Use it to see a spec’s fields before any row is fed: the fields are fixed by the spec. For a whole bank, read
polars_online.ModelBank.output_fields, and for what each field is, with the values its name encodes, useoutput_index().Parameters
specA spec, as a builder of
polars_online.specreturns it.
Returns
The field names, in the order the output column holds them.
Raises
ValueErrorspecis not a valid spec, with the builders’ message. A value that is not a spec at all is told what it lacks, such asinvalid spec: missing field `name`.
Examples
spec = po.spec.ewridge( "ridge", targets=["y"], features=["x0", "x1"], half_life=100.0, ridge=[1e-6, 0.1] ) fields = po.spec.output_fields(spec) print(fields[:4]) # each ridge value's prediction and residual print(fields[4:]) # the fields the ridge values share
['pred_y__r0.000001', 'resid_y__r0.000001', 'pred_y__r0.1', 'resid_y__r0.1'] ['weight_sum', 'settled_frac', 'withheld_reason', 'coef', 'support_coef']
See also
output_index(), each field with the values its name encodes.OUTPUTS.md, every model’s fields.