package modelkit-nx

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

Module Modelkit_nxSource

Checked admission from Nx tensors into immutable ModelKit data.

Sourcetype 'a conversion = 'a Modelkit.Admission.conversion = {
  1. value : 'a;
  2. report : Modelkit.Conversion_report.t;
}
Sourcetype features = Modelkit.Admission.features = {
  1. matrix : Modelkit.Matrix.t;
  2. schema : Modelkit.Feature_schema.t;
  3. null_mask : Modelkit.Null_mask.t option;
  4. feature_reports : Modelkit.Conversion_report.t list;
}
Sourcetype 'kind admitted_dataset = 'kind Modelkit.Admission.dataset = {
  1. dataset : 'kind Modelkit.Dataset.t;
  2. feature_null_mask : Modelkit.Null_mask.t option;
  3. dataset_reports : Modelkit.Conversion_report.t list;
}
Sourceval features : ?names:string array -> ?null_mask:Nx.bool_t -> Nx.float64_t -> (features, Modelkit.Error.t) result

Admits a rank-two float64 tensor in logical row-major order.

Both contiguous tensors and strided views are accepted. Explicit nulls are represented by null_mask and stored as NaN in matrix, while the returned mask preserves their identity separately from genuine NaNs. Unmasked infinities are rejected.

Admits a finite rank-one float64 regression target.

Admits a rank-one int64 classification target whose labels fit OCaml int on the current platform.

Admits finite, non-negative rank-one weights with at least one positive value.

Admits rank-one group labels whose values fit OCaml int.

Sourceval regression_dataset : ?names:string array -> ?feature_null_mask:Nx.bool_t -> ?sample_weight:Nx.float64_t -> ?groups:Nx.int64_t -> x:Nx.float64_t -> y:Nx.float64_t -> unit -> (Modelkit.Target.regression admitted_dataset, Modelkit.Error.t) result
Sourceval classification_dataset : ?names:string array -> ?feature_null_mask:Nx.bool_t -> ?sample_weight:Nx.float64_t -> ?groups:Nx.int64_t -> x:Nx.float64_t -> y:Nx.int64_t -> unit -> (Modelkit.Target.classification admitted_dataset, Modelkit.Error.t) result

Dataset admission validates tensor ranks, metadata alignment, feature names, numeric domains, and label ranges before returning a ModelKit dataset. Feature NaNs are retained under Dataset.Allow_nan; downstream estimators must impute them or otherwise declare support.