Dsxir.Example (dsxir v0.1.0)

Copy Markdown

A labeled example used as input to optimizers and to the demo channel.

Carries an inputs map and a labels map. The input_keys set determines which keys in the unified data view are inputs; the rest are labels.

Summary

Functions

Project data down to the input fields only.

Project data down to the label fields (the complement of the inputs).

Build an example from data. Pass :input_keys in opts to mark which keys are inputs; everything else is treated as a label.

Replace the example's input-key set with keys.

Types

t()

@type t() :: %Dsxir.Example{data: map(), input_keys: MapSet.t()}

Functions

inputs(example)

@spec inputs(t()) :: map()

Project data down to the input fields only.

labels(example)

@spec labels(t()) :: map()

Project data down to the label fields (the complement of the inputs).

new(data, opts \\ [])

@spec new(
  map(),
  keyword()
) :: t()

Build an example from data. Pass :input_keys in opts to mark which keys are inputs; everything else is treated as a label.

with_inputs(example, keys)

@spec with_inputs(t(), [atom()]) :: t()

Replace the example's input-key set with keys.