Tune.Score behaviour (Tune v0.5.0)

Copy Markdown View Source

One named score declaration and its execution contract.

Summary

Types

t()

@type t() :: %Tune.Score{
  argument: :output | :prediction,
  direction: :maximize | :minimize,
  failure_score: number() | nil,
  metric: function() | module() | struct(),
  name: atom(),
  range: {number(), number()} | nil
}

Callbacks

model_calls?(struct)

(optional)
@callback model_calls?(struct()) :: boolean()

score(struct, t, term)

@callback score(struct(), Tune.Case.t(), term()) ::
  number()
  | map()
  | {:ok, number() | map()}
  | {:error, term()}
  | {:error, term(), map()}