package modelkit

  1. Overview
  2. Docs
Portable classical machine learning workflows for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

modelkit-0.5.0.tbz
sha256=1fe8fa7c7f904dd098a21a2ca30fd69230750b8cf8aa2ae481b97a16531b47b4
sha512=c946cd1ac014726f4d21791e14d806a205680e6edfa2f80ed8d3680f24f48ca3c5a2f89d5afa68c11eac4053ead448b6381fb3d06dc8ff129097af6c69b262fb

doc/modelkit/Modelkit/Search_checkpoint/index.html

Module Modelkit.Search_checkpoint

Candidate-boundary search checkpoints and partial evaluation reports. Checkpoints contain data-only reports, including typed failures and timings; they contain no fitted models, configurations, functions, or callbacks.

type snapshot
type 'configuration t
type entry = {
  1. stage : string;
  2. candidate_index : int;
  3. configuration_id : string;
  4. evaluation : (unit Cross_validation.report, Error.t) result;
}

A completed candidate evaluation, or a recorded build failure. Halving stages are zero-based round numbers; other searches use "candidates". Fold model fields are always None.

val create : ?resume:snapshot -> specification_id:string -> configuration_id:('configuration -> string) -> unit -> ('configuration t, Error.t) result

Supply nonblank stable IDs. specification_id must version all behavior that cannot be inspected: pipeline builders, configuration defaults, samplers, scorers, selectors, and their code/dependency versions. configuration_id must cover the entire immutable configuration, including fields absent from reported parameters. Callers must supply the same pure specifications on resume; closure identity cannot be verified automatically.

Search checks feature/target values, schema, dataset and explicit metadata weights/groups, actual ordered splits, seed, task, options, encoded parameters, and configuration IDs before reusing results. Callback presence must match because metadata requests may require or reject it; the handler and execution concurrency may change. IDs and encoders must be deterministic.

A session admits one search at a time. Snapshots may be taken from its callbacks on the caller domain; other concurrent access is unsupported.

val snapshot : _ t -> snapshot
val completed : snapshot -> entry array

Defensive copies of committed candidate reports. A candidate is committed after its finished callback succeeds. Cancellation leaves earlier entries available, and the interrupted candidate restarts in full on resume. Ordinary recorded failures are committed; control errors are not.

val encode : snapshot -> (bytes, Error.t) result
val decode : bytes -> (snapshot, Error.t) result

Versioned, bounded data-only encoding with a 64 MiB limit and an integrity checksum. No Marshal or executable state is decoded. The checksum detects accidental corruption; it does not authenticate untrusted producers. The caller owns persistence and should replace checkpoint files atomically.

Resuming reconstructs specifications, candidate reports, promotion, and selection, skipping committed candidate fits. Candidate lifecycle callbacks may repeat, but cached CV/fit callbacks do not. Sampling/configuration IDs are checked before fitting, so checkpointed randomized search prepares all initial configurations eagerly. The final selector and full-data refit run again; neither fitted state nor their completion is checkpointed. Score-based selection agrees with uninterrupted execution for deterministic consumers. Timing-based or side-effect-dependent selectors cannot provide that guarantee.