package modelkit

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Modelkit.Grid_search

Typed exhaustive search over finite immutable configuration grids.

Axes retain declaration order and their values retain caller order. The Cartesian product varies the last axis fastest. Each candidate is evaluated on identical split membership, while fitted fold RNGs derive from the logical candidate and fold identities. Ranking uses the named refit scorer's mean test score in descending order; equal scores receive equal competition ranks and the lowest candidate index wins a tie.

Record keeps failed candidates and selects from candidates whose primary test score aggregates successfully. Abort returns the first failure in candidate order. The winning immutable specification is fitted once on the complete dataset. For c candidates, f folds, and s scorers, search performs at most c * f + 1 fits and retains O(c * (f + s)) report data. An empty axis array evaluates the base configuration once. execution controls each candidate's fold evaluation and defaults to sequential execution; candidates themselves are evaluated in stable sequential order.

type parameter_value =
  1. | Bool of bool
  2. | Int of int
  3. | Float of float
  4. | String of string
type parameter = {
  1. parameter_name : string;
  2. parameter_value : parameter_value;
}
type 'configuration axis
val axis : name:string -> values:'value array -> encode:('value -> parameter_value) -> set:('configuration -> 'value -> ('configuration, Error.t) result) -> ('configuration axis, Error.t) result

Creates one non-empty typed axis. set must return a new configuration without mutating its input.

type ('configuration, 'target, 'prediction) grid
val create : base:'configuration -> build:('configuration -> (('target, 'prediction) Pipeline.t, Error.t) result) -> 'configuration axis array -> (('configuration, 'target, 'prediction) grid, Error.t) result
val candidate_count : ('configuration, 'target, 'prediction) grid -> int
type score_summary = {
  1. scorer_name : string;
  2. train : (Score_aggregation.t, Error.t) result option;
  3. test : (Score_aggregation.t, Error.t) result;
}
type 'model candidate = {
  1. candidate_index : int;
  2. parameters : parameter array;
  3. rank : int option;
  4. mean_fit_time : float;
  5. mean_score_time : float;
  6. scores : score_summary array;
  7. evaluation : 'model Cross_validation.report option;
  8. build_error : Error.t option;
}
type 'model selected = {
  1. selected_candidate_index : int;
  2. selected_model : 'model;
}
type 'model report
val candidates : 'model report -> 'model candidate array
val selection : 'model report -> ('model selected, Error.t) result
module Regression : sig ... end
module Binary_classification : sig ... end
module Multiclass_classification : sig ... end