probly.method.method.predictor_transformation

probly.method.method.predictor_transformation(permitted_predictor_types: Collection[type[Predictor]] | None, *, preserve_predictor_type: bool = False, auto_infer_predictor_type: bool = True) Callable[[PredictorTransformationMethod[Pin, In, POut]], PredictorTransformationMethod[Pin, In, POut]][source]
probly.method.method.predictor_transformation(permitted_predictor_types: Collection[type[Predictor]] | None, *, auto_infer_predictor_type: bool = True, post_transform: Callable[[POut, type[Predictor] | None], POut]) Callable[[PredictorTransformationMethod[Pin, In, POut]], PredictorTransformationMethod[Pin, In, POut]]

Decorator factory for predictor transformation methods.

Parameters:
  • permitted_predictor_types – Optional collection of predictor types that the method can be applied to. If None, the method can be applied to any predictor type.

  • preserve_predictor_type – Whether to preserve the original predictor type of the transformed predictor. Only has an effect if post_transform is not provided.

  • auto_infer_predictor_type – Whether to automatically infer the predictor type if not explicitly specified. Default is True.

  • post_transform – An optional function that takes the transformed predictor and its original type, and returns a transformed predictor. This can be used to apply additional transformations or registrations to the predictor after the main transformation method is applied.

Returns:

A decorator that transforms a predictor transformation method into a method that can be applied to predictors of the specified types. Untyped predictors can be typed by specifying the predictor type via the predictor_type keyword argument when calling the transformation method.