Modelkit.PipelineSourceImmutable sequential composition of fitted preprocessing and an estimator.
Transformer stages are fitted only from the matrix supplied to fit. Their fitted values are then reused by transform, predict, decision_function, and predict_proba. Stage names are non-empty and unique across the whole pipeline, and failures carry the responsible Error.Stage context.
Current transformers are unsupervised and do not receive targets or sample weights. Sample weights route to the terminal estimator. Each stage receives a child RNG derived from its logical name and position. Fit and inference are sequential and allocate one dense matrix per transformer stage.
val transformer :
name:string ->
(module TRANSFORMER
with type fitted = 'fitted
and type rng = Rng.t
and type t = 'specification
and type target = unit) ->
'specification ->
(transformer, Error.t) resultPackages an unsupervised transformer specification as a named stage.
val estimator :
name:string ->
(module ESTIMATOR
with type fitted = 'fitted
and type prediction = 'prediction
and type rng = Rng.t
and type t = 'specification
and type target = 'target) ->
?decision_function:
('fitted ->
feature_schema:Feature_schema.t ->
x:Matrix.t ->
(Vector.t, Error.t) result) ->
?predict_proba:
('fitted ->
feature_schema:Feature_schema.t ->
x:Matrix.t ->
(Matrix.t, Error.t) result) ->
?classes:('fitted -> int array) ->
'specification ->
(('target, 'prediction) estimator, Error.t) resultPackages a terminal estimator and its explicitly supported capabilities. When supplied, classes declares the class label corresponding to each predict_proba column.
val empty : builderval add_transformer : builder -> transformer -> (builder, Error.t) resultval transformer_names : ('target, 'prediction) t -> string arrayval estimator_name : ('target, 'prediction) t -> stringval capabilities : ('target, 'prediction) t -> capabilitiesval fit :
('target, 'prediction) t ->
?sample_weight:Sample_weight.t ->
rng:Rng.t ->
feature_schema:Feature_schema.t ->
x:Matrix.t ->
y:'target ->
unit ->
(('target, 'prediction) fitted, Error.t) resultval predict :
('target, 'prediction) fitted ->
feature_schema:Feature_schema.t ->
x:Matrix.t ->
('prediction, Error.t) resultReturns the probability-column class order declared by the terminal estimator.
val input_schema : ('target, 'prediction) fitted -> Feature_schema.tval output_schema : ('target, 'prediction) fitted -> Feature_schema.t