docstr: Mixed-data sampling transformer.
  
  A transformer that converts higher frequency time series to lower frequency using mixed-data sampling; see
  [1]_ for further details. This allows higher frequency covariates to be used whilst forecasting a lower
  frequency target series. For example, using monthly inputs to forecast a quarterly target.
  
  Notes
  -----
  The high input frequency should always relate in the same rate to the low target frequency. For
  example, there's always three months in quarter. However, the number of days in a month varies per month.
  In the latter case a MIDAS transformation does not work and the transformer will raise an error.
  
  For anchored low frequency, the transformed series must contain at least 2 samples in order to be
  able to retrieve the original time index.
  
  Parameters
  ----------
  low_freq
      The pd.DateOffset string alias corresponding to the target low
      frequency [2]_. Passed on to the `rule` parameter of pandas.DataFrame.resample().
  strip
      Whether to remove the NaNs from the start and the end of the transformed series.
  drop_static_covariates
      If set to `True`, the statics covariates of the input series won't be transferred to the output.
      This migth be useful for multivariate series with component-specific static covariates.
  name
      A specific name for the scaler
  n_jobs
      The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
      passed as input to a method, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
      (sequential). Setting the parameter to `-1` means using all the available processors.
      Note: for a small amount of data, the parallelisation overhead could end up increasing the total
      required amount of time.
  verbose
      Optionally, whether to print operations progress
  
  Examples
  --------
  >>> from darts.datasets import AirPassengersDataset
  >>> from darts.dataprocessing.transformers import MIDAS
  >>> monthly_series = AirPassengersDataset().load()
  >>> print(monthly_series.time_index[:4])
  DatetimeIndex(['1949-01-01', '1949-02-01', '1949-03-01', '1949-04-01'], dtype='datetime64[ns]',
  name='Month', freq='MS')
  >>> print(monthly_series.values()[:4])
  [[112.], [118.], [132.], [129.]]
  >>> midas = MIDAS(low_freq="QS")
  >>> quarterly_series = midas.fit_transform(monthly_series)
  >>> print(quarterly_series.time_index[:3])
  DatetimeIndex(['1949-01-01', '1949-04-01', '1949-07-01'], dtype='datetime64[ns]', name='Month', freq='QS-JAN')
  >>> print(quarterly_series.values()[:3])
  [[112. 118. 132.], [129. 121. 135.], [148. 148. 136.]]
  >>> inversed_quaterly = midas.inverse_transform(quarterly_series)
  >>> print(inversed_quaterly.time_index[:4])
  DatetimeIndex(['1949-01-01', '1949-02-01', '1949-03-01', '1949-04-01'], dtype='datetime64[ns]',
  name='time', freq='MS')
  >>> print(inversed_quaterly.values()[:4])
  [[112.], [118.], [132.], [129.]]
  
  References
  ----------
  .. [1] https://en.wikipedia.org/wiki/Mixed-data_sampling
  .. [2] https://pandas.pydata.org/docs/user_guide/timeseries.html#dateoffset-objects
docstr_tok: ["Mixed-data","sampling","transformer",".","A","transformer","that","converts","higher","frequency","time","series","to","lower","frequency","using","mixed-data","sampling",";","see","[","1","]","_","for","further","details",".","This","allows","higher","frequency","covariates","to","be","used","whilst","forecasting","a","lower","frequency","target","series",".","For","example",",","using","monthly","inputs","to","forecast","a","quarterly","target",".","Notes","--","--","-","The","high","input","frequency","should","always","relate","in","the","same","rate","to","the","low","target","frequency",".","For","example",",","there","'s","always","three","months","in","quarter",".","However",",","the","number","of","days","in","a","month","varies","per","month",".","In","the","latter","case","a","MIDAS","transformation","does","not","work","and","the","transformer","will","raise","an","error",".","For","anchored","low","frequency",",","the","transformed","series","must","contain","at","least","2","samples","in","order","to","be","able","to","retrieve","the","original","time","index",".","Parameters","--","--","--","--","--","low_freq","The","pd.DateOffset","string","alias","corresponding","to","the","target","low","frequency","[","2","]","_",".","Passed","on","to","the","`","rule","`","parameter","of","pandas.DataFrame.resample","(",")",".","strip","Whether","to","remove","the","NaNs","from","the","start","and","the","end","of","the","transformed","series",".","drop_static_covariates","If","set","to","`","True","`",",","the","statics","covariates","of","the","input","series","wo","n't","be","transferred","to","the","output",".","This","migth","be","useful","for","multivariate","series","with","component-specific","static","covariates",".","name","A","specific","name","for","the","scaler","n_jobs","The","number","of","jobs","to","run","in","parallel",".","Parallel","jobs","are","created","only","when","a","``","Sequence","[","TimeSeries","]","``","is","passed","as","input","to","a","method",",","parallelising","operations","regarding","different","``","TimeSeries","``",".","Defaults","to","`","1","`","(","sequential",")",".","Setting","the","parameter","to","`","-1","`","means","using","all","the","available","processors",".","Note",":","for","a","small","amount","of","data",",","the","parallelisation","overhead","could","end","up","increasing","the","total","required","amount","of","time",".","verbose","Optionally",",","whether","to","print","operations","progress","Examples","--","--","--","--",">",">",">","from","darts.datasets","import","AirPassengersDataset",">",">",">","from","darts.dataprocessing.transformers","import","MIDAS",">",">",">","monthly_series","=","AirPassengersDataset","(",")",".load","(",")",">",">",">","print","(","monthly_series.time_index","[",":4","]",")","DatetimeIndex","(","[","'1949-01-01","'",",","'1949-02-01","'",",","'1949-03-01","'",",","'1949-04-01","'","]",",","dtype='datetime64","[","ns","]","'",",","name='Month","'",",","freq='MS","'",")",">",">",">","print","(","monthly_series.values","(",")","[",":4","]",")","[","[","112",".","]",",","[","118",".","]",",","[","132",".","]",",","[","129",".","]","]",">",">",">","midas","=","MIDAS","(","low_freq=","''","QS","''",")",">",">",">","quarterly_series","=","midas.fit_transform","(","monthly_series",")",">",">",">","print","(","quarterly_series.time_index","[",":3","]",")","DatetimeIndex","(","[","'1949-01-01","'",",","'1949-04-01","'",",","'1949-07-01","'","]",",","dtype='datetime64","[","ns","]","'",",","name='Month","'",",","freq='QS-JAN","'",")",">",">",">","print","(","quarterly_series.values","(",")","[",":3","]",")","[","[","112",".","118",".","132",".","]",",","[","129",".","121",".","135",".","]",",","[","148",".","148",".","136",".","]","]",">",">",">","inversed_quaterly","=","midas.inverse_transform","(","quarterly_series",")",">",">",">","print","(","inversed_quaterly.time_index","[",":4","]",")","DatetimeIndex","(","[","'1949-01-01","'",",","'1949-02-01","'",",","'1949-03-01","'",",","'1949-04-01","'","]",",","dtype='datetime64","[","ns","]","'",",","name='time","'",",","freq='MS","'",")",">",">",">","print","(","inversed_quaterly.values","(",")","[",":4","]",")","[","[","112",".","]",",","[","118",".","]",",","[","132",".","]",",","[","129",".","]","]","References","--","--","--","--","--","..","[","1","]","https",":","\/\/en.wikipedia.org\/wiki\/Mixed-data_sampling","..","[","2","]","https",":","\/\/pandas.pydata.org\/docs\/user_guide\/timeseries.html","#","dateoffset-objects"]
code: def __init__(
      self,
      low_freq: str,
      strip: bool = True,
      drop_static_covariates: bool = False,
      name: str = "MIDAS",
      n_jobs: int = 1,
      verbose: bool = False,
  ):
      """Mixed-data sampling transformer.
  
      A transformer that converts higher frequency time series to lower frequency using mixed-data sampling; see
      [1]_ for further details. This allows higher frequency covariates to be used whilst forecasting a lower
      frequency target series. For example, using monthly inputs to forecast a quarterly target.
  
      Notes
      -----
      The high input frequency should always relate in the same rate to the low target frequency. For
      example, there's always three months in quarter. However, the number of days in a month varies per month.
      In the latter case a MIDAS transformation does not work and the transformer will raise an error.
  
      For anchored low frequency, the transformed series must contain at least 2 samples in order to be
      able to retrieve the original time index.
  
      Parameters
      ----------
      low_freq
          The pd.DateOffset string alias corresponding to the target low
          frequency [2]_. Passed on to the `rule` parameter of pandas.DataFrame.resample().
      strip
          Whether to remove the NaNs from the start and the end of the transformed series.
      drop_static_covariates
          If set to `True`, the statics covariates of the input series won't be transferred to the output.
          This migth be useful for multivariate series with component-specific static covariates.
      name
          A specific name for the scaler
      n_jobs
          The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
          passed as input to a method, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
          (sequential). Setting the parameter to `-1` means using all the available processors.
          Note: for a small amount of data, the parallelisation overhead could end up increasing the total
          required amount of time.
      verbose
          Optionally, whether to print operations progress
  
      Examples
      --------
      >>> from darts.datasets import AirPassengersDataset
      >>> from darts.dataprocessing.transformers import MIDAS
      >>> monthly_series = AirPassengersDataset().load()
      >>> print(monthly_series.time_index[:4])
      DatetimeIndex(['1949-01-01', '1949-02-01', '1949-03-01', '1949-04-01'], dtype='datetime64[ns]',
      name='Month', freq='MS')
      >>> print(monthly_series.values()[:4])
      [[112.], [118.], [132.], [129.]]
      >>> midas = MIDAS(low_freq="QS")
      >>> quarterly_series = midas.fit_transform(monthly_series)
      >>> print(quarterly_series.time_index[:3])
      DatetimeIndex(['1949-01-01', '1949-04-01', '1949-07-01'], dtype='datetime64[ns]', name='Month', freq='QS-JAN')
      >>> print(quarterly_series.values()[:3])
      [[112. 118. 132.], [129. 121. 135.], [148. 148. 136.]]
      >>> inversed_quaterly = midas.inverse_transform(quarterly_series)
      >>> print(inversed_quaterly.time_index[:4])
      DatetimeIndex(['1949-01-01', '1949-02-01', '1949-03-01', '1949-04-01'], dtype='datetime64[ns]',
      name='time', freq='MS')
      >>> print(inversed_quaterly.values()[:4])
      [[112.], [118.], [132.], [129.]]
  
      References
      ----------
      .. [1] https://en.wikipedia.org/wiki/Mixed-data_sampling
      .. [2] https://pandas.pydata.org/docs/user_guide/timeseries.html#dateoffset-objects
      """
      self._low_freq = low_freq
      self._strip = strip
      self._drop_static_covariates = drop_static_covariates
      self._sep = "_midas_"
      # Original high frequency should be fitted on TimeSeries independently
      super().__init__(
          name=name, n_jobs=n_jobs, verbose=verbose, global_fit=False
      )
  
file_path: darts/darts/dataprocessing/transformers/midas.py
imports: from typing import Any, Dict, List, Mapping, Optional, Sequence, Union
  import numpy
  import pandas
  from darts import TimeSeries
  from darts.dataprocessing.transformers import FittableDataTransformer, InvertibleDataTransformer
  from darts.logging import get_logger, raise_log
  from darts.timeseries import _finite_rows_boundaries
  from darts.utils.timeseries_generation import generate_index
label_desc: Use image node_id 1 to create a new MIDAS object from inherited base classes: FittableDataTransformer, InvertibleDataTransformer with example: obj = MIDAS(low_freq, strip, drop_static_covariates, name, n_jobs, verbose)