



"""simple docstring"""







# Imports
import numpy as np







class       UpperCamelCase__   :




      """simple docstring"""




      def __init__(      self				:      int    ,			SCREAMING_SNAKE_CASE_				:      List[Any]=None    ,			SCREAMING_SNAKE_CASE_				:      Any=None    ,			SCREAMING_SNAKE_CASE_				:      Optional[Any]=None    ,			SCREAMING_SNAKE_CASE_				:      Optional[int]=None    ,			SCREAMING_SNAKE_CASE_				:      Optional[Any]=None       ):
        self.set_matricies(red=SCREAMING_SNAKE_CASE_    ,			green=SCREAMING_SNAKE_CASE_    ,			blue=SCREAMING_SNAKE_CASE_    ,			red_edge=SCREAMING_SNAKE_CASE_    ,			nir=SCREAMING_SNAKE_CASE_       )



      def      SCREAMING_SNAKE_CASE__ (      self				:      Union[str, Any]    ,			SCREAMING_SNAKE_CASE_				:      Tuple=None    ,			SCREAMING_SNAKE_CASE_				:      List[str]=None    ,			SCREAMING_SNAKE_CASE_				:      Dict=None    ,			SCREAMING_SNAKE_CASE_				:      Any=None    ,			SCREAMING_SNAKE_CASE_				:      List[str]=None       ):
        if red is not None:
          lowerCAmelCase_   :				Optional[int]								= red
        if green is not None:
          lowerCAmelCase_   :				Tuple								= green
        if blue is not None:
          lowerCAmelCase_   :				List[Any]								= blue
        if red_edge is not None:
          lowerCAmelCase_   :				str								= red_edge
        if nir is not None:
          lowerCAmelCase_   :				List[str]								= nir
        return True



      def      SCREAMING_SNAKE_CASE__ (      self				:      str    ,			SCREAMING_SNAKE_CASE_				:      int=""    ,			SCREAMING_SNAKE_CASE_				:      str=None    ,			SCREAMING_SNAKE_CASE_				:      Any=None    ,			SCREAMING_SNAKE_CASE_				:      Any=None    ,			SCREAMING_SNAKE_CASE_				:      List[str]=None    ,			SCREAMING_SNAKE_CASE_				:      Tuple=None       ):
        self.set_matricies(red=SCREAMING_SNAKE_CASE_    ,			green=SCREAMING_SNAKE_CASE_    ,			blue=SCREAMING_SNAKE_CASE_    ,			red_edge=SCREAMING_SNAKE_CASE_    ,			nir=SCREAMING_SNAKE_CASE_       )
        lowerCAmelCase_   :				str								= {
            'ARVI2': self.arvaa,
            'CCCI': self.ccci,
            'CVI': self.cvi,
            'GLI': self.gli,
            'NDVI': self.ndvi,
            'BNDVI': self.bndvi,
            'redEdgeNDVI': self.red_edge_ndvi,
            'GNDVI': self.gndvi,
            'GBNDVI': self.gbndvi,
            'GRNDVI': self.grndvi,
            'RBNDVI': self.rbndvi,
            'PNDVI': self.pndvi,
            'ATSAVI': self.atsavi,
            'BWDRVI': self.bwdrvi,
            'CIgreen': self.ci_green,
            'CIrededge': self.ci_rededge,
            'CI': self.ci,
            'CTVI': self.ctvi,
            'GDVI': self.gdvi,
            'EVI': self.evi,
            'GEMI': self.gemi,
            'GOSAVI': self.gosavi,
            'GSAVI': self.gsavi,
            'Hue': self.hue,
            'IVI': self.ivi,
            'IPVI': self.ipvi,
            'I': self.i,
            'RVI': self.rvi,
            'MRVI': self.mrvi,
            'MSAVI': self.m_savi,
            'NormG': self.norm_g,
            'NormNIR': self.norm_nir,
            'NormR': self.norm_r,
            'NGRDI': self.ngrdi,
            'RI': self.ri,
            'S': self.s,
            'IF': self._if,
            'DVI': self.dvi,
            'TVI': self.tvi,
            'NDRE': self.ndre,
        }

        try:
          return funcs[index]()
        except KeyError:
          print('Index not in the list!'       )
          return False



      def      SCREAMING_SNAKE_CASE__ (      self				:      List[Any]       ):
        return -0.18 + (1.17 * ((self.nir - self.red) / (self.nir + self.red)))



      def      SCREAMING_SNAKE_CASE__ (      self				:      Optional[Any]       ):
        return ((self.nir - self.redEdge) / (self.nir + self.redEdge)) / (
            (self.nir - self.red) / (self.nir + self.red)
        )



      def      SCREAMING_SNAKE_CASE__ (      self				:      List[str]       ):
        return self.nir * (self.red / (self.green**2))



      def      SCREAMING_SNAKE_CASE__ (      self				:      Dict       ):
        return (2 * self.green - self.red - self.blue) / (
            2 * self.green + self.red + self.blue
        )



      def      SCREAMING_SNAKE_CASE__ (      self				:      int       ):
        return (self.nir - self.red) / (self.nir + self.red)



      def      SCREAMING_SNAKE_CASE__ (      self				:      List[str]       ):
        return (self.nir - self.blue) / (self.nir + self.blue)



      def      SCREAMING_SNAKE_CASE__ (      self				:      List[Any]       ):
        return (self.redEdge - self.red) / (self.redEdge + self.red)



      def      SCREAMING_SNAKE_CASE__ (      self				:      Union[str, Any]       ):
        return (self.nir - self.green) / (self.nir + self.green)



      def      SCREAMING_SNAKE_CASE__ (      self				:      str       ):
        return (self.nir - (self.green + self.blue)) / (
            self.nir + (self.green + self.blue)
        )



      def      SCREAMING_SNAKE_CASE__ (      self				:      Any       ):
        return (self.nir - (self.green + self.red)) / (
            self.nir + (self.green + self.red)
        )



      def      SCREAMING_SNAKE_CASE__ (      self				:      List[Any]       ):
        return (self.nir - (self.blue + self.red)) / (self.nir + (self.blue + self.red))



      def      SCREAMING_SNAKE_CASE__ (      self				:      Optional[int]       ):
        return (self.nir - (self.green + self.red + self.blue)) / (
            self.nir + (self.green + self.red + self.blue)
        )



      def      SCREAMING_SNAKE_CASE__ (      self				:      int    ,			SCREAMING_SNAKE_CASE_				:      str=0.08    ,			SCREAMING_SNAKE_CASE_				:      List[str]=1.22    ,			SCREAMING_SNAKE_CASE_				:      Optional[Any]=0.03       ):
        return a * (
            (self.nir - a * self.red - b)
            / (a * self.nir + self.red - a * b + x * (1 + a**2))
        )



      def      SCREAMING_SNAKE_CASE__ (      self				:      Dict       ):
        return (0.1 * self.nir - self.blue) / (0.1 * self.nir + self.blue)



      def      SCREAMING_SNAKE_CASE__ (      self				:      str       ):
        return (self.nir / self.green) - 1



      def      SCREAMING_SNAKE_CASE__ (      self				:      Optional[int]       ):
        return (self.nir / self.redEdge) - 1



      def      SCREAMING_SNAKE_CASE__ (      self				:      Any       ):
        return (self.red - self.blue) / self.red



      def      SCREAMING_SNAKE_CASE__ (      self				:      List[Any]       ):
        lowerCAmelCase_   :				Tuple								= self.ndvi()
        return ((ndvi + 0.5) / (abs(ndvi + 0.5       ))) * (abs(ndvi + 0.5       ) ** (1 / 2))



      def      SCREAMING_SNAKE_CASE__ (      self				:      List[Any]       ):
        return self.nir - self.green



      def      SCREAMING_SNAKE_CASE__ (      self				:      int       ):
        return 2.5 * (
            (self.nir - self.red) / (self.nir + 6 * self.red - 7.5 * self.blue + 1)
        )



      def      SCREAMING_SNAKE_CASE__ (      self				:      Optional[Any]       ):
        lowerCAmelCase_   :				Tuple								= (2 * (self.nir**2 - self.red**2) + 1.5 * self.nir + 0.5 * self.red) / (
            self.nir + self.red + 0.5
        )
        return n * (1 - 0.25 * n) - (self.red - 0.1_25) / (1 - self.red)



      def      SCREAMING_SNAKE_CASE__ (      self				:      str    ,			SCREAMING_SNAKE_CASE_				:      Optional[int]=0.16       ):
        return (self.nir - self.green) / (self.nir + self.green + y)



      def      SCREAMING_SNAKE_CASE__ (      self				:      Optional[Any]    ,			SCREAMING_SNAKE_CASE_				:      str=0.5       ):
        return ((self.nir - self.green) / (self.nir + self.green + n)) * (1 + n)



      def      SCREAMING_SNAKE_CASE__ (      self				:      List[Any]       ):
        return np.arctan(
            ((2 * self.red - self.green - self.blue) / 30.5) * (self.green - self.blue)       )



      def      SCREAMING_SNAKE_CASE__ (      self				:      Any    ,			SCREAMING_SNAKE_CASE_				:      Any=None    ,			SCREAMING_SNAKE_CASE_				:      Optional[Any]=None       ):
        return (self.nir - b) / (a * self.red)



      def      SCREAMING_SNAKE_CASE__ (      self				:      List[str]       ):
        return (self.nir / ((self.nir + self.red) / 2)) * (self.ndvi() + 1)



      def      SCREAMING_SNAKE_CASE__ (      self				:      str       ):
        return (self.red + self.green + self.blue) / 30.5



      def      SCREAMING_SNAKE_CASE__ (      self				:      List[Any]       ):
        return self.nir / self.red



      def      SCREAMING_SNAKE_CASE__ (      self				:      Optional[Any]       ):
        return (self.rvi() - 1) / (self.rvi() + 1)



      def      SCREAMING_SNAKE_CASE__ (      self				:      Any       ):
        return (
            (2 * self.nir + 1)
            - ((2 * self.nir + 1) ** 2 - 8 * (self.nir - self.red)) ** (1 / 2)
        ) / 2



      def      SCREAMING_SNAKE_CASE__ (      self				:      Tuple       ):
        return self.green / (self.nir + self.red + self.green)



      def      SCREAMING_SNAKE_CASE__ (      self				:      List[Any]       ):
        return self.nir / (self.nir + self.red + self.green)



      def      SCREAMING_SNAKE_CASE__ (      self				:      int       ):
        return self.red / (self.nir + self.red + self.green)



      def      SCREAMING_SNAKE_CASE__ (      self				:      Tuple       ):
        return (self.green - self.red) / (self.green + self.red)



      def      SCREAMING_SNAKE_CASE__ (      self				:      Union[str, Any]       ):
        return (self.red - self.green) / (self.red + self.green)



      def      SCREAMING_SNAKE_CASE__ (      self				:      int       ):
        lowerCAmelCase_   :				Tuple								= np.max([np.max(self.red       ), np.max(self.green       ), np.max(self.blue       )]       )
        lowerCAmelCase_   :				Union[str, Any]								= np.min([np.min(self.red       ), np.min(self.green       ), np.min(self.blue       )]       )
        return (max_value - min_value) / max_value



      def      SCREAMING_SNAKE_CASE__ (      self				:      Optional[int]       ):
        return (2 * self.red - self.green - self.blue) / (self.green - self.blue)



      def      SCREAMING_SNAKE_CASE__ (      self				:      int       ):
        return self.nir / self.red



      def      SCREAMING_SNAKE_CASE__ (      self				:      Optional[int]       ):
        return (self.ndvi() + 0.5) ** (1 / 2)





      def      SCREAMING_SNAKE_CASE__ (      self				:      List[str]       ):
        return (self.nir - self.redEdge) / (self.nir + self.redEdge)










"""simple docstring"""







from typing import List, Optional, Union

from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowercase__		:				Union[str, Any]          =	logging.get_logger(__name__)

lowercase__		:				List[str]          =	{
    """huggingface/informer-tourism-monthly""": (
        """https://huggingface.co/huggingface/informer-tourism-monthly/resolve/main/config.json"""
    ),
    # See all Informer models at https://huggingface.co/models?filter=informer
}







class       UpperCamelCase__   (	lowercase_  ):




      """simple docstring"""




      _SCREAMING_SNAKE_CASE  				=     """informer"""
      _SCREAMING_SNAKE_CASE  				=     {
          """hidden_size""": """d_model""",
          """num_attention_heads""": """encoder_attention_heads""",
          """num_hidden_layers""": """encoder_layers""",
      }



      def __init__(      self				:      Any    ,			SCREAMING_SNAKE_CASE_				:      Optional[int] = None    ,			SCREAMING_SNAKE_CASE_				:      Optional[int] = None    ,			SCREAMING_SNAKE_CASE_				:      str = "student_t"    ,			SCREAMING_SNAKE_CASE_				:      str = "nll"    ,			SCREAMING_SNAKE_CASE_				:      int = 1    ,			SCREAMING_SNAKE_CASE_				:      List[int] = None    ,			SCREAMING_SNAKE_CASE_				:      Optional[Union[str, bool]] = "mean"    ,			SCREAMING_SNAKE_CASE_				:      int = 0    ,			SCREAMING_SNAKE_CASE_				:      int = 0    ,			SCREAMING_SNAKE_CASE_				:      int = 0    ,			SCREAMING_SNAKE_CASE_				:      int = 0    ,			SCREAMING_SNAKE_CASE_				:      Optional[List[int]] = None    ,			SCREAMING_SNAKE_CASE_				:      Optional[List[int]] = None    ,			SCREAMING_SNAKE_CASE_				:      int = 6_4    ,			SCREAMING_SNAKE_CASE_				:      int = 3_2    ,			SCREAMING_SNAKE_CASE_				:      int = 3_2    ,			SCREAMING_SNAKE_CASE_				:      int = 2    ,			SCREAMING_SNAKE_CASE_				:      int = 2    ,			SCREAMING_SNAKE_CASE_				:      int = 2    ,			SCREAMING_SNAKE_CASE_				:      int = 2    ,			SCREAMING_SNAKE_CASE_				:      bool = True    ,			SCREAMING_SNAKE_CASE_				:      str = "gelu"    ,			SCREAMING_SNAKE_CASE_				:      float = 0.05    ,			SCREAMING_SNAKE_CASE_				:      float = 0.1    ,			SCREAMING_SNAKE_CASE_				:      float = 0.1    ,			SCREAMING_SNAKE_CASE_				:      float = 0.1    ,			SCREAMING_SNAKE_CASE_				:      float = 0.1    ,			SCREAMING_SNAKE_CASE_				:      int = 1_0_0    ,			SCREAMING_SNAKE_CASE_				:      float = 0.02    ,			SCREAMING_SNAKE_CASE_				:      str=True    ,			SCREAMING_SNAKE_CASE_				:      str = "prob"    ,			SCREAMING_SNAKE_CASE_				:      int = 5    ,			SCREAMING_SNAKE_CASE_				:      bool = True    ,			**SCREAMING_SNAKE_CASE_				:      int    ,			):
        # time series specific configuration
        lowerCAmelCase_   :				Dict								= prediction_length
        lowerCAmelCase_   :				List[str]								= context_length or prediction_length
        lowerCAmelCase_   :				List[Any]								= distribution_output
        lowerCAmelCase_   :				int								= loss
        lowerCAmelCase_   :				Optional[int]								= input_size
        lowerCAmelCase_   :				Tuple								= num_time_features
        lowerCAmelCase_   :				List[str]								= lags_sequence if lags_sequence is not None else [1, 2, 3, 4, 5, 6, 7]
        lowerCAmelCase_   :				int								= scaling
        lowerCAmelCase_   :				List[Any]								= num_dynamic_real_features
        lowerCAmelCase_   :				Union[str, Any]								= num_static_real_features
        lowerCAmelCase_   :				Optional[int]								= num_static_categorical_features

        # set cardinality
        if cardinality and num_static_categorical_features > 0:
          if len(SCREAMING_SNAKE_CASE_       ) != num_static_categorical_features:
            raise ValueError(
                'The cardinality should be a list of the same length as `num_static_categorical_features`'       )
          lowerCAmelCase_   :				str								= cardinality
        else:
          lowerCAmelCase_   :				Any								= [0]

        # set embedding_dimension
        if embedding_dimension and num_static_categorical_features > 0:
          if len(SCREAMING_SNAKE_CASE_       ) != num_static_categorical_features:
            raise ValueError(
                'The embedding dimension should be a list of the same length as `num_static_categorical_features`'       )
          lowerCAmelCase_   :				Optional[int]								= embedding_dimension
        else:
          lowerCAmelCase_   :				Union[str, Any]								= [min(5_0    ,			(cat + 1) // 2       ) for cat in self.cardinality]

        lowerCAmelCase_   :				Optional[int]								= num_parallel_samples

        # Transformer architecture configuration
        lowerCAmelCase_   :				Any								= input_size * len(self.lags_sequence       ) + self._number_of_features
        lowerCAmelCase_   :				Any								= d_model
        lowerCAmelCase_   :				Union[str, Any]								= encoder_attention_heads
        lowerCAmelCase_   :				Optional[Any]								= decoder_attention_heads
        lowerCAmelCase_   :				Any								= encoder_ffn_dim
        lowerCAmelCase_   :				List[str]								= decoder_ffn_dim
        lowerCAmelCase_   :				Optional[Any]								= encoder_layers
        lowerCAmelCase_   :				Tuple								= decoder_layers

        lowerCAmelCase_   :				Optional[int]								= dropout
        lowerCAmelCase_   :				Dict								= attention_dropout
        lowerCAmelCase_   :				int								= activation_dropout
        lowerCAmelCase_   :				Dict								= encoder_layerdrop
        lowerCAmelCase_   :				str								= decoder_layerdrop

        lowerCAmelCase_   :				Union[str, Any]								= activation_function
        lowerCAmelCase_   :				Union[str, Any]								= init_std

        lowerCAmelCase_   :				Union[str, Any]								= use_cache

        # Informer
        lowerCAmelCase_   :				Optional[int]								= attention_type
        lowerCAmelCase_   :				Any								= sampling_factor
        lowerCAmelCase_   :				int								= distil

        super().__init__(is_encoder_decoder=SCREAMING_SNAKE_CASE_    ,			**SCREAMING_SNAKE_CASE_       )





      @property
      def      SCREAMING_SNAKE_CASE__ (      self				:      Any       ):
        return (
            sum(self.embedding_dimension       )
            + self.num_dynamic_real_features
            + self.num_time_features
            + self.num_static_real_features
            + self.input_size * 2  # the log1p(abs(loc)) and log(scale) features
        )





