docstr: MinT Reconcilator.
  
  This implements the MinT reconciliation approach presented in [1]_ and
  summarised in [2]_.
  
  Parameters
  ----------
  method
      This parameter can take four different values, determining how the covariance
      matrix ``W`` of the forecast errors is estimated (corresponding to ``Wh`` in [2]_):
  
      * ``ols`` uses ``W = I``. This option looks only at the hierarchy but ignores the
        values of the series provided to ``fit()``.
      * ``wls_struct`` uses ``W = diag(S1)``, where ``S1`` is a vector of size `n` with values
        between 0 and `m`, representing the number of base components composing each
        of the `n` components. This options looks only at the hierarchy but ignores
        the values of the series provided to ``fit()``.
      * ``wls_var`` uses ``W = diag(W1)``, where ``W1`` is the temporal average of the
        variance of the forecasting residuals. This method assumes that the series
        provided to ``fit()`` contain the forecast residuals (deterministic series).
      * ``mint_cov`` computes ``W`` as the empirical covariance matrix of the residuals
        for each component, with residuals samples taken over time. This method assumes
        that the series provided to ``fit()`` contain the forecast residuals
        (deterministic series), and it requires the residuals to be linearly independent.
      * ``wls_val`` uses ``W = diag(V1)``, where ``V1`` is the temporal average of the
        component values. This method assumes that the series provided to ``fit()`` contains
        an example of the actual values (e.g., either the training series or the forecasts).
        This method is not presented in [2]_.
  
  References
  ----------
  .. [1] `Optimal forecast reconciliation for hierarchical and grouped time series through
          trace minimization <https://robjhyndman.com/papers/MinT.pdf>`_
  .. [2] https://otexts.com/fpp3/reconciliation.html#the-mint-optimal-reconciliation-approach
docstr_tok: ["MinT","Reconcilator",".","This","implements","the","MinT","reconciliation","approach","presented","in","[","1","]","_","and","summarised","in","[","2","]","_.","Parameters","--","--","--","--","--","method","This","parameter","can","take","four","different","values",",","determining","how","the","covariance","matrix","``","W","``","of","the","forecast","errors","is","estimated","(","corresponding","to","``","Wh","``","in","[","2","]","_",")",":","*","``","ols","``","uses","``","W","=","I","``",".","This","option","looks","only","at","the","hierarchy","but","ignores","the","values","of","the","series","provided","to","``","fit","(",")","``",".","*","``","wls_struct","``","uses","``","W","=","diag","(","S1",")","``",",","where","``","S1","``","is","a","vector","of","size","`","n","`","with","values","between","0","and","`","m","`",",","representing","the","number","of","base","components","composing","each","of","the","`","n","`","components",".","This","options","looks","only","at","the","hierarchy","but","ignores","the","values","of","the","series","provided","to","``","fit","(",")","``",".","*","``","wls_var","``","uses","``","W","=","diag","(","W1",")","``",",","where","``","W1","``","is","the","temporal","average","of","the","variance","of","the","forecasting","residuals",".","This","method","assumes","that","the","series","provided","to","``","fit","(",")","``","contain","the","forecast","residuals","(","deterministic","series",")",".","*","``","mint_cov","``","computes","``","W","``","as","the","empirical","covariance","matrix","of","the","residuals","for","each","component",",","with","residuals","samples","taken","over","time",".","This","method","assumes","that","the","series","provided","to","``","fit","(",")","``","contain","the","forecast","residuals","(","deterministic","series",")",",","and","it","requires","the","residuals","to","be","linearly","independent",".","*","``","wls_val","``","uses","``","W","=","diag","(","V1",")","``",",","where","``","V1","``","is","the","temporal","average","of","the","component","values",".","This","method","assumes","that","the","series","provided","to","``","fit","(",")","``","contains","an","example","of","the","actual","values","(","e.g.",",","either","the","training","series","or","the","forecasts",")",".","This","method","is","not","presented","in","[","2","]","_.","References","--","--","--","--","--","..","[","1","]","`","Optimal","forecast","reconciliation","for","hierarchical","and","grouped","time","series","through","trace","minimization","<","https",":","\/\/robjhyndman.com\/papers\/MinT.pdf",">","`","_","..","[","2","]","https",":","\/\/otexts.com\/fpp3\/reconciliation.html","#","the-mint-optimal-reconciliation-approach"]
code: def __init__(self, method="ols"):
      """
      MinT Reconcilator.
  
      This implements the MinT reconciliation approach presented in [1]_ and
      summarised in [2]_.
  
      Parameters
      ----------
      method
          This parameter can take four different values, determining how the covariance
          matrix ``W`` of the forecast errors is estimated (corresponding to ``Wh`` in [2]_):
  
          * ``ols`` uses ``W = I``. This option looks only at the hierarchy but ignores the
            values of the series provided to ``fit()``.
          * ``wls_struct`` uses ``W = diag(S1)``, where ``S1`` is a vector of size `n` with values
            between 0 and `m`, representing the number of base components composing each
            of the `n` components. This options looks only at the hierarchy but ignores
            the values of the series provided to ``fit()``.
          * ``wls_var`` uses ``W = diag(W1)``, where ``W1`` is the temporal average of the
            variance of the forecasting residuals. This method assumes that the series
            provided to ``fit()`` contain the forecast residuals (deterministic series).
          * ``mint_cov`` computes ``W`` as the empirical covariance matrix of the residuals
            for each component, with residuals samples taken over time. This method assumes
            that the series provided to ``fit()`` contain the forecast residuals
            (deterministic series), and it requires the residuals to be linearly independent.
          * ``wls_val`` uses ``W = diag(V1)``, where ``V1`` is the temporal average of the
            component values. This method assumes that the series provided to ``fit()`` contains
            an example of the actual values (e.g., either the training series or the forecasts).
            This method is not presented in [2]_.
  
      References
      ----------
      .. [1] `Optimal forecast reconciliation for hierarchical and grouped time series through
              trace minimization <https://robjhyndman.com/papers/MinT.pdf>`_
      .. [2] https://otexts.com/fpp3/reconciliation.html#the-mint-optimal-reconciliation-approach
      """
      known_methods = [
          "ols",
          "wls",
          "wls_var",
          "wls_struct",
          "wls_val",
          "mint_cov",
      ]
      raise_if_not(
          method in known_methods,
          f"The method must be one of {known_methods}",
      )
      # Define fixed params (i.e. attributes defined before calling `super().__init__`):
      self.method = method
      super().__init__()
  
imports: from typing import Any, Mapping, Optional
  import numpy
  from darts.dataprocessing.transformers import BaseDataTransformer, FittableDataTransformer
  from darts.timeseries import TimeSeries
  from darts.utils.utils import raise_if_not
label_desc: Use image node_id 1 to create a new MinTReconciliator object from inherited base classes: FittableDataTransformer with example: obj = MinTReconciliator(method)