Tinkex.Types.LossFnType (Tinkex v0.3.4)

View Source

Loss function type.

Mirrors Python tinker.types.LossFnType.

Supported Loss Functions

  • :cross_entropy - Standard cross-entropy loss
  • :importance_sampling - Importance-weighted sampling loss
  • :ppo - Proximal Policy Optimization loss
  • :cispo - Constrained Importance Sampling Policy Optimization loss
  • :dro - Distributionally Robust Optimization loss

Wire Format

String values: "cross_entropy" | "importance_sampling" | "ppo" | "cispo" | "dro"

Examples

iex> LossFnType.parse("cross_entropy")
:cross_entropy

iex> LossFnType.to_string(:ppo)
"ppo"

Summary

Functions

Parse wire format string to atom.

Convert atom to wire format string.

List all valid loss function types.

Types

t()

@type t() :: :cross_entropy | :importance_sampling | :ppo | :cispo | :dro

Functions

parse(arg1)

@spec parse(String.t() | nil) :: t() | nil

Parse wire format string to atom.

Examples

iex> LossFnType.parse("cross_entropy")
:cross_entropy

iex> LossFnType.parse("cispo")
:cispo

iex> LossFnType.parse("unknown")
nil

to_string(atom)

@spec to_string(t()) :: String.t()

Convert atom to wire format string.

Examples

iex> LossFnType.to_string(:cross_entropy)
"cross_entropy"

iex> LossFnType.to_string(:dro)
"dro"

values()

@spec values() :: [t()]

List all valid loss function types.