Preprocessing: private API

Types

PortfolioOptimisers.AbstractPreprocessingEstimatorType
abstract type AbstractPreprocessingEstimator <: AbstractEstimator

Abstract supertype for all preprocessing estimator types.

Preprocessing estimators transform price or returns data (prices-to-returns conversion, missing-data filtering, a gap fill) under a fit/apply contract. Fitting one on training data with fit_preprocessing produces a result carrying any fitted state — a fill's seed, thresholds, and the selected asset universe — which apply_preprocessing then replays on unseen data so train and test windows are transformed consistently. Stateless preprocessing estimators carry no state, and applying them is equivalent to running them.

They are ordinary estimators: they know nothing about pipelines. A Pipeline drives them through the same fit/apply verbs any other caller would use.

All concrete preprocessing estimators should subtype one of the two data-level subtypes:

Related

source
PortfolioOptimisers.AbstractPreprocessingResultType
abstract type AbstractPreprocessingResult <: AbstractResult

Abstract supertype for all preprocessing result types.

Preprocessing results are produced by fit_preprocessing on training data. They carry the fitted state needed to apply the same transformation to unseen data — a fill's seed, thresholds, and the selected asset universe. Stateless preprocessing estimators produce results that carry only their configuration.

All concrete preprocessing results should subtype one of the two data-level subtypes, AbstractPricesPreprocessingResult or AbstractReturnsPreprocessingResult, so a caller can replay each fitted transformation at the data level it applies to.

Related

source

Functions

PortfolioOptimisers.is_missing_valueFunction
is_missing_value(x) -> Bool

Return true when x counts as a missing observation in price-level data.

Price-level data stores absent observations either as missing or as NaN, the two conventions unify_gaps spells as one at the ingestion door; this reads both because it stands at that door, on a carrier built by hand.

Algorithm

  1. Return true when x is missing.
  2. Return true when x is a Number and isnan(x) holds. The type test guards the call, because isnan is not defined for every value a price table can carry.
  3. Return false otherwise.

Arguments

  • x: The value to test.

Returns

  • flag::Bool: true when x is missing or a NaN number.

Related

source