class_docstr: Conditional execution of a transformer given a condition from a fittable object.
  
  Compositor to construct conditionally executed transformers, e.g.,
  
  * compute first differences if a stationarity test is positive
  * deseasonalize if a seasonality test is positive
  
  This compositor allows to specify a condition, and an if/else transformer.
  The default "else" transformer is "no transformation".
  
  The specific algorithm implemented is as follows:
  
  In `fit`, for inputs `X`, `y`:
  1. fits `if_estimator` to `X`, `y`
  2. checks the condition for `if_estimator` fitted parameter `param`:
     whether `param` satisfies `condition` with `condition_value`
  3. If yes, fits `then_est` to `X`, `y`, and behaves as `then_est` from then on
     If no, fits `else_est` to `X`, `y`, and behaves as `else_est` from then on
  
  In other methods, behaves as `then_est` or `else_est`, as above.
  
  Note: `then_trafo` and `else_trafo` must hae the same input/output signature,
  e.g., Series-to-Series, or Series-to-Primitives.
  
  Parameters
  ----------
  if_estimator : sktime estimator, must have `fit`
      sktime estimator to fit and apply to series.
      this is a "blueprint" estimator, state does not change when `fit` is called
  param : str, optional, default = first boolean parameter of fitted if_estimator
  condition : str, optional, default = "bool"
      condition that defines whether self behaves like `then_est` or `else_est`
      this estimator behaves like `then_est` iff:
      "bool" = if `param` is True
      ">", ">=", "==", "<", "<=", "!=" = if `param condition condition_value`
  condition_value : required for some conditions, see above; otherwise optional
  then_trafo : sktime transformer, optional, default=`if_estimator`
      transformer that this behaves as if condition is satisfied
      this is a "blueprint" transformer, state does not change when `fit` is called
  else_trafo : sktime transformer, optional default=`Id` (identity/no transform)
      transformer that this behaves as if condition is not satisfied
      this is a "blueprint" transformer, state does not change when `fit` is called
  
  Attributes
  ----------
  transformer_ : transformer,
      this clone is fitted when `fit` is called
      if condition is satisfied, a clone of `then_est`
      if condition is not satisfied, a clone of `else_est`
  condition_ : bool,
      True if condition was true, False if it was false
  if_estimator_ : estimator
      this clone of `if_estimator` is fitted when `fit` is called
  
  Examples
  --------
  >>> from sktime.param_est.seasonality import SeasonalityACF
  >>> from sktime.transformations.compose import TransformIf
  >>> from sktime.transformations.series.detrend import Deseasonalizer
  >>> from sktime.datasets import load_airline
  >>>
  >>> y = load_airline()  # doctest: +SKIP
  >>>
  >>> seasonal = SeasonalityACF(candidate_sp=12)  # doctest: +SKIP
  >>> deseason = Deseasonalizer(sp=12)  # doctest: +SKIP
  >>> cond_deseason = TransformIf(seasonal, "sp", "!=", 1, deseason)  # doctest: +SKIP
  >>> y_hat = cond_deseason.fit_transform(y)  # doctest: +SKIP
code: def __init__(
      self,
      if_estimator,
      param=None,
      condition="bool",
      condition_value=None,
      then_trafo=None,
      else_trafo=None,
  ):
      self.if_estimator = if_estimator
      self.param = param
      self.condition = condition
      self.condition_value = condition_value
      self.then_trafo = then_trafo
      self.else_trafo = else_trafo
  
      if then_trafo is None:
          self.then_trafo_ = if_estimator
      else:
          self.then_trafo_ = then_trafo
  
      if else_trafo is None:
          self.else_trafo_ = Id()
      else:
          self.else_trafo_ = else_trafo
  
      super().__init__()
  
      self.clone_tags(if_estimator, tag_names=["univariate-only"])
      if_scitypes = mtype_to_scitype(
          if_estimator.get_tag("X_inner_mtype")
      )
      valid_scitypes = [
          x
          for x in ALL_TIME_SERIES_MTYPES
          if mtype_to_scitype(x) in if_scitypes
      ]
      self.set_tags(**{"X_inner_mtype": valid_scitypes})
  
      tags_to_clone = [
          "scitype:transform-input",
          "scitype:transform-output",
          "y_inner_mtype",
          "capability:inverse_transform",
          "transform-returns-same-time-index",
      ]
      self.clone_tags(self.then_trafo_, tag_names=tags_to_clone)
  
file_path: sktime/sktime/transformations/compose/_transformif.py
imports: from sktime.datatypes import ALL_TIME_SERIES_MTYPES, mtype_to_scitype
  from sktime.transformations._delegate import _DelegatedTransformer
  from sktime.transformations.base import BaseTransformer
  from sktime.transformations.compose._common import CORE_MTYPES
  from sktime.transformations.compose._id import Id
label_desc: Use image node_id 1 to create a new TransformIf object from inherited base classes: _DelegatedTransformer with example: obj = TransformIf(if_estimator, param, condition, condition_value, then_trafo, else_trafo)