class_docstr: Remove a :term:`trend <Trend>` from a series.
  
  This transformer uses any forecaster and returns the in-sample residuals
  of the forecaster's predicted values.
  
  The Detrender works as follows:
  in "fit", the forecaster is fit to the input data, i.e., `forecaster.fit(y=X)`.
  in "transform", returns forecast residuals of forecasts at the data index.
  That is, `transform(X)` returns `X - forecaster.predict(fh=X.index)` (additive)
  or `X / forecaster.predict(fh=X.index)` (multiplicative detrending).
  Depending on time indices, this can generate in-sample or out-of-sample residuals.
  
  For example, to remove the linear trend of a time series:
      forecaster = PolynomialTrendForecaster(degree=1)
      transformer = Detrender(forecaster=forecaster)
      yt = transformer.fit_transform(y_train)
  
  The detrender can also be used in a pipeline for residual boosting,
  by first detrending and then fitting another forecaster on residuals.
  
  Parameters
  ----------
  forecaster : sktime forecaster, follows BaseForecaster, default = None.
      The forecasting model to remove the trend with
          (e.g. PolynomialTrendForecaster).
      If forecaster is None, PolynomialTrendForecaster(degree=1) is used.
      Must be a forecaster to which `fh` can be passed in `predict`.
  model : {"additive", "multiplicative"}, default="additive"
      If `model="additive"` the `forecaster.transform` subtracts the trend,
      i.e., `transform(X)` returns `X - forecaster.predict(fh=X.index)`
      If `model="multiplicative"` the `forecaster.transform` divides by the trend,
      i.e., `transform(X)` returns `X / forecaster.predict(fh=X.index)`
  
  Attributes
  ----------
  forecaster_ : Fitted forecaster
      Forecaster that defines the trend in the series.
  
  See Also
  --------
  Deseasonalizer
  STLTransformer
  
  Examples
  --------
  >>> from sktime.transformations.series.detrend import Detrender
  >>> from sktime.forecasting.trend import PolynomialTrendForecaster
  >>> from sktime.datasets import load_airline
  >>> y = load_airline()
  >>> transformer = Detrender(forecaster=PolynomialTrendForecaster(degree=1))
  >>> y_hat = transformer.fit_transform(y)
class_docstr_tok: ["Remove","a",":","term",":","`","trend","<","Trend",">","`","from","a","series",".","This","transformer","uses","any","forecaster","and","returns","the","in-sample","residuals","of","the","forecaster","'s","predicted","values",".","The","Detrender","works","as","follows",":","in","``","fit","''",",","the","forecaster","is","fit","to","the","input","data",",","i.e.",",","`","forecaster.fit","(","y=X",")","`",".","in","``","transform","''",",","returns","forecast","residuals","of","forecasts","at","the","data","index",".","That","is",",","`","transform","(","X",")","`","returns","`","X","-","forecaster.predict","(","fh=X.index",")","`","(","additive",")","or","`","X","\/","forecaster.predict","(","fh=X.index",")","`","(","multiplicative","detrending",")",".","Depending","on","time","indices",",","this","can","generate","in-sample","or","out-of-sample","residuals",".","For","example",",","to","remove","the","linear","trend","of","a","time","series",":","forecaster","=","PolynomialTrendForecaster","(","degree=1",")","transformer","=","Detrender","(","forecaster=forecaster",")","yt","=","transformer.fit_transform","(","y_train",")","The","detrender","can","also","be","used","in","a","pipeline","for","residual","boosting",",","by","first","detrending","and","then","fitting","another","forecaster","on","residuals",".","Parameters","--","--","--","--","--","forecaster",":","sktime","forecaster",",","follows","BaseForecaster",",","default","=","None",".","The","forecasting","model","to","remove","the","trend","with","(","e.g",".","PolynomialTrendForecaster",")",".","If","forecaster","is","None",",","PolynomialTrendForecaster","(","degree=1",")","is","used",".","Must","be","a","forecaster","to","which","`","fh","`","can","be","passed","in","`","predict","`",".","model",":","{","``","additive","''",",","``","multiplicative","''","}",",","default=","''","additive","''","If","`","model=","''","additive","''","`","the","`","forecaster.transform","`","subtracts","the","trend",",","i.e.",",","`","transform","(","X",")","`","returns","`","X","-","forecaster.predict","(","fh=X.index",")","`","If","`","model=","''","multiplicative","''","`","the","`","forecaster.transform","`","divides","by","the","trend",",","i.e.",",","`","transform","(","X",")","`","returns","`","X","\/","forecaster.predict","(","fh=X.index",")","`","Attributes","--","--","--","--","--","forecaster_",":","Fitted","forecaster","Forecaster","that","defines","the","trend","in","the","series",".","See","Also","--","--","--","--","Deseasonalizer","STLTransformer","Examples","--","--","--","--",">",">",">","from","sktime.transformations.series.detrend","import","Detrender",">",">",">","from","sktime.forecasting.trend","import","PolynomialTrendForecaster",">",">",">","from","sktime.datasets","import","load_airline",">",">",">","y","=","load_airline","(",")",">",">",">","transformer","=","Detrender","(","forecaster=PolynomialTrendForecaster","(","degree=1",")",")",">",">",">","y_hat","=","transformer.fit_transform","(","y",")"]
docstr: Update the parameters of the detrending estimator with new data.
  
  private _update containing the core logic, called from update
  
  Parameters
  ----------
  X : pd.Series or pd.DataFrame
      Data to fit transform to
  y : pd.DataFrame, default=None
      Additional data, e.g., labels for transformation
  update_params : bool, default=True
      whether the model is updated. Yes if true, if false, simply skips call.
      argument exists for compatibility with forecasting module.
  
  Returns
  -------
  self : an instance of self
docstr_tok: ["Update","the","parameters","of","the","detrending","estimator","with","new","data",".","private","_update","containing","the","core","logic",",","called","from","update","Parameters","--","--","--","--","--","X",":","pd.Series","or","pd.DataFrame","Data","to","fit","transform","to","y",":","pd.DataFrame",",","default=None","Additional","data",",","e.g.",",","labels","for","transformation","update_params",":","bool",",","default=True","whether","the","model","is","updated",".","Yes","if","true",",","if","false",",","simply","skips","call",".","argument","exists","for","compatibility","with","forecasting","module",".","Returns","--","--","--","-","self",":","an","instance","of","self"]
code: def _update(self, X, y=None, update_params=True):
      """Update the parameters of the detrending estimator with new data.
  
      private _update containing the core logic, called from update
  
      Parameters
      ----------
      X : pd.Series or pd.DataFrame
          Data to fit transform to
      y : pd.DataFrame, default=None
          Additional data, e.g., labels for transformation
      update_params : bool, default=True
          whether the model is updated. Yes if true, if false, simply skips call.
          argument exists for compatibility with forecasting module.
  
      Returns
      -------
      self : an instance of self
      """
      if not self.forecaster_.get_tag("requires-fh-in-fit", True):
          self.forecaster_.update(y=X, X=y, update_params=update_params)
      else:
          self._X = update_data(self._X, X)
          self._y = update_data(self._y, y)
      return self
  
file_path: sktime/sktime/transformations/series/detrend/_detrend.py
imports: import pandas
  from sktime.datatypes import update_data
  from sktime.forecasting.base._fh import ForecastingHorizon
  from sktime.forecasting.trend import PolynomialTrendForecaster
  from sktime.transformations.base import BaseTransformer
label_desc: Use image node_id 7 for calling the Detrender obj's underlying member method code with example usage: obj._update(X, y, update_params) and returns: self