Boolean

Use Boolean for a true/false input or target. It needs no vocabulary. Use Category when the source contains several named outcomes.

events:
  - succeeded: true
  - succeeded: false
converted: true
import relflow as rf

model = rf.Model(
    d_model=64, n_layers=2, n_heads=4,
    events=rf.Branch(length=32, succeeded=rf.Boolean),
    converted=rf.Boolean(mask=True, threshold=[0.5, 0.8]),
)

Input and options

The Arrow leaf must be Boolean; integer and string labels are rejected. A null has its own state. Internally, false and true use fixed content values of -1 and 1, combined with a learned state embedding. Non-valued content is zero.

Option Default Meaning
threshold 0.5 One threshold or a nonempty list in [0, 1] for decision metrics. Duplicates are removed in first-seen order.

See shared leaf options for masks, decoder pooling, and embeddings.

Learning and output

Reconstruction combines state cross entropy with frequency-weighted binary cross entropy for valued targets. relflow tracks AUC and decision accuracy, precision, recall, and specificity for each configured threshold; names include accuracy@0.5 and recall@0.8.

Prediction content.probability is the probability of true. Thresholds affect metrics only; they never turn the output into a Boolean. Read it with the shared state and inferred members in the prediction envelope.

For an application-supplied trained model:

counts = rf.Boolean.counts(model, "record/converted")

Counts include pristine valued training presentations, even when masked, and exclude the smoothing prior. Repeated epochs count again. DDP counts synchronize at epoch end, so mid-epoch snapshots may be rank-local.