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/One_hot_encoder/index.html

Module Modelkit.One_hot_encoder

Encoding of finite float64 categories as dense or CSR indicator columns.

Categories are learned independently per feature and sorted ascending. Output columns follow input-feature order, then category order. Reject reports a category absent during fitting; Ignore emits an all-zero group for that feature. max_output_features bounds the fitted output width, and sample weights are rejected.

type unknown_category =
  1. | Reject
  2. | Ignore
type params = {
  1. unknown_category : unknown_category;
  2. max_output_features : int;
}
type t
type fitted
val create : ?unknown_category:unknown_category -> ?max_output_features:int -> unit -> (t, Error.t) result
val categories : fitted -> Vector.t array
val transform_csr : fitted -> feature_schema:Feature_schema.t -> x:Matrix.t -> (Csr_matrix.t, Error.t) result

Applies the fitted encoder directly into canonical checked CSR storage without allocating the equivalent dense indicator matrix.

include TRANSFORMER with type t := t and type params := params and type target = unit and type fitted := fitted and type rng = Rng.t
include SPECIFICATION with type t := t with type params := params
val clone : t -> t
val params : t -> params
type target = unit
type rng = Rng.t
val fit : t -> ?sample_weight:Sample_weight.t -> rng:rng -> feature_schema:Feature_schema.t -> x:Matrix.t -> y:target option -> unit -> (fitted, Error.t) result
val transform : fitted -> feature_schema:Feature_schema.t -> x:Matrix.t -> (Matrix.t, Error.t) result
val fitted_params : fitted -> params
val input_schema : fitted -> Feature_schema.t
val output_schema : fitted -> Feature_schema.t