Contents

fitted(to:validateOn:eventHandler:)

Fits a model to a sequence of examples with validation.

Declaration

func fitted(to input: some Sequence<AnnotatedFeature<MLShapedArray<Scalar>, MLShapedArray<Scalar>>>, validateOn validation: some Sequence<AnnotatedFeature<MLShapedArray<Scalar>, MLShapedArray<Scalar>>>, eventHandler: EventHandler? = nil) async throws -> LinearTimeSeriesForecaster<Scalar>.Model

Parameters

  • input:

    A sequence of annotated features. Each feature’s shape should be [featureSize] and each annotation’s shape should be [annotationSize].

  • validation:

    A sequence of annotated validation features. The feature and annotation shapes should be the same as the input parameter.

  • eventHandler:

    An event handler.

Return Value

The fitted model.

Discussion

This method uses a sliding window to chunk the input features and validation features into features of inputWindowSize elements and annotations of forecastWindowSize elements. If you want to use a different windowing strategy, use fitted(toWindows:validateOn:eventHandler:).

See Also

Updating and fitting