




"""simple docstring"""







# Imports
import numpy as np






class       SCREAMING_SNAKE_CASE__					:


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


						def   __lowercase (							self				:			Any						,						lowerCAmelCase				:			str=None						,						lowerCAmelCase				:			Optional[int]=None						,						lowerCAmelCase				:			str=None						,						lowerCAmelCase				:			Optional[Any]=None						,						lowerCAmelCase				:			Union[str, Any]=None					):
										if red is not None:
														lowerCAmelCase  =				red
										if green is not None:
														lowerCAmelCase  =				green
										if blue is not None:
														lowerCAmelCase  =				blue
										if red_edge is not None:
														lowerCAmelCase  =				red_edge
										if nir is not None:
														lowerCAmelCase  =				nir
										return True


						def   __lowercase (							self				:			int						,						lowerCAmelCase				:			int=""						,						lowerCAmelCase				:			Dict=None						,						lowerCAmelCase				:			int=None						,						lowerCAmelCase				:			Tuple=None						,						lowerCAmelCase				:			List[Any]=None						,						lowerCAmelCase				:			Any=None					):
										self.set_matricies(red=lowerCAmelCase						,						green=lowerCAmelCase						,						blue=lowerCAmelCase						,						red_edge=lowerCAmelCase						,						nir=lowerCAmelCase					)
										lowerCAmelCase  =				{
										    """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   __lowercase (							self				:			Optional[int]					):
										return -0.18 + (1.17 * ((self.nir - self.red) / (self.nir + self.red)))


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


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


						def   __lowercase (							self				:			Any					):
										return (2 * self.green - self.red - self.blue) / (
										    2 * self.green + self.red + self.blue
										)


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


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


						def   __lowercase (							self				:			Dict					):
										return (self.redEdge - self.red) / (self.redEdge + self.red)


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


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


						def   __lowercase (							self				:			Dict					):
										return (self.nir - (self.green + self.red)) / (
										    self.nir + (self.green + self.red)
										)


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


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


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


						def   __lowercase (							self				:			List[Any]					):
										return (0.1 * self.nir - self.blue) / (0.1 * self.nir + self.blue)


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


						def   __lowercase (							self				:			List[str]					):
										return (self.nir / self.redEdge) - 1


						def   __lowercase (							self				:			List[Any]					):
										return (self.red - self.blue) / self.red


						def   __lowercase (							self				:			Union[str, Any]					):
										lowerCAmelCase  =				self.ndvi()
										return ((ndvi + 0.5) / (abs(ndvi + 0.5					))) * (abs(ndvi + 0.5					) ** (1 / 2))


						def   __lowercase (							self				:			List[str]					):
										return self.nir - self.green


						def   __lowercase (							self				:			Optional[Any]					):
										return 2.5 * (
										    (self.nir - self.red) / (self.nir + 6 * self.red - 7.5 * self.blue + 1)
										)


						def   __lowercase (							self				:			Dict					):
										lowerCAmelCase  =				(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.125) / (1 - self.red)


						def   __lowercase (							self				:			Union[str, Any]						,						lowerCAmelCase				:			Tuple=0.16					):
										return (self.nir - self.green) / (self.nir + self.green + y)


						def   __lowercase (							self				:			int						,						lowerCAmelCase				:			Tuple=0.5					):
										return ((self.nir - self.green) / (self.nir + self.green + n)) * (1 + n)


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


						def   __lowercase (							self				:			Optional[int]						,						lowerCAmelCase				:			Dict=None						,						lowerCAmelCase				:			List[str]=None					):
										return (self.nir - b) / (a * self.red)


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


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


						def   __lowercase (							self				:			Union[str, Any]					):
										return self.nir / self.red


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


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


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


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


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


						def   __lowercase (							self				:			str					):
										return (self.green - self.red) / (self.green + self.red)


						def   __lowercase (							self				:			str					):
										return (self.red - self.green) / (self.red + self.green)


						def   __lowercase (							self				:			List[str]					):
										lowerCAmelCase  =				np.max([np.max(self.red					), np.max(self.green					), np.max(self.blue					)]					)
										lowerCAmelCase  =				np.min([np.min(self.red					), np.min(self.green					), np.min(self.blue					)]					)
										return (max_value - min_value) / max_value


						def   __lowercase (							self				:			List[Any]					):
										return (2 * self.red - self.green - self.blue) / (self.green - self.blue)


						def   __lowercase (							self				:			List[str]					):
										return self.nir / self.red


						def   __lowercase (							self				:			Any					):
										return (self.ndvi() + 0.5) ** (1 / 2)




						def   __lowercase (							self				:			Dict					):
										return (self.nir - self.redEdge) / (self.nir + self.redEdge)











"""simple docstring"""







from typing import List, Optional

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


a      =							logging.get_logger(__name__)

a      =							{
    'huggingface/autoformer-tourism-monthly': 'https://huggingface.co/huggingface/autoformer-tourism-monthly/resolve/main/config.json',
}






class       SCREAMING_SNAKE_CASE__					(					_a					):
						_a    						=						'autoformer'
						_a    						=						{
						    'hidden_size': 'd_model',
						    'num_attention_heads': 'encoder_attention_heads',
						    'num_hidden_layers': 'encoder_layers',
						}


						def __init__(							self				:			Dict						,						lowerCAmelCase				:			Optional[int] = None						,						lowerCAmelCase				:			Optional[int] = None						,						lowerCAmelCase				:			str = "student_t"						,						lowerCAmelCase				:			str = "nll"						,						lowerCAmelCase				:			int = 1						,						lowerCAmelCase				:			List[int] = [1, 2, 3, 4, 5, 6, 7]						,						lowerCAmelCase				:			bool = True						,						lowerCAmelCase				:			int = 0						,						lowerCAmelCase				:			int = 0						,						lowerCAmelCase				:			int = 0						,						lowerCAmelCase				:			int = 0						,						lowerCAmelCase				:			Optional[List[int]] = None						,						lowerCAmelCase				:			Optional[List[int]] = None						,						lowerCAmelCase				:			int = 64						,						lowerCAmelCase				:			int = 2						,						lowerCAmelCase				:			int = 2						,						lowerCAmelCase				:			int = 2						,						lowerCAmelCase				:			int = 2						,						lowerCAmelCase				:			int = 32						,						lowerCAmelCase				:			int = 32						,						lowerCAmelCase				:			str = "gelu"						,						lowerCAmelCase				:			float = 0.1						,						lowerCAmelCase				:			float = 0.1						,						lowerCAmelCase				:			float = 0.1						,						lowerCAmelCase				:			float = 0.1						,						lowerCAmelCase				:			float = 0.1						,						lowerCAmelCase				:			int = 100						,						lowerCAmelCase				:			float = 0.02						,						lowerCAmelCase				:			bool = True						,						lowerCAmelCase				:			Tuple=True						,						lowerCAmelCase				:			int = 10						,						lowerCAmelCase				:			int = 25						,						lowerCAmelCase				:			int = 3						,						**lowerCAmelCase				:			Tuple						,						):
										# time series specific configuration
										lowerCAmelCase  =				prediction_length
										lowerCAmelCase  =				context_length if context_length is not None else prediction_length
										lowerCAmelCase  =				distribution_output
										lowerCAmelCase  =				loss
										lowerCAmelCase  =				input_size
										lowerCAmelCase  =				num_time_features
										lowerCAmelCase  =				lags_sequence
										lowerCAmelCase  =				scaling
										lowerCAmelCase  =				num_dynamic_real_features
										lowerCAmelCase  =				num_static_real_features
										lowerCAmelCase  =				num_static_categorical_features
										if cardinality is not None and num_static_categorical_features > 0:
														if len(lowerCAmelCase					) != num_static_categorical_features:
																		raise ValueError(
																		    """The cardinality should be a list of the same length as `num_static_categorical_features`"""					)
														lowerCAmelCase  =				cardinality
										else:
														lowerCAmelCase  =				[0]
										if embedding_dimension is not None and num_static_categorical_features > 0:
														if len(lowerCAmelCase					) != num_static_categorical_features:
																		raise ValueError(
																		    """The embedding dimension should be a list of the same length as `num_static_categorical_features`"""					)
														lowerCAmelCase  =				embedding_dimension
										else:
														lowerCAmelCase  =				[min(50						,						(cat + 1) // 2					) for cat in self.cardinality]
										lowerCAmelCase  =				num_parallel_samples

										# Transformer architecture configuration
										lowerCAmelCase  =				input_size * len(self.lags_sequence					) + self._number_of_features
										lowerCAmelCase  =				d_model
										lowerCAmelCase  =				encoder_attention_heads
										lowerCAmelCase  =				decoder_attention_heads
										lowerCAmelCase  =				encoder_ffn_dim
										lowerCAmelCase  =				decoder_ffn_dim
										lowerCAmelCase  =				encoder_layers
										lowerCAmelCase  =				decoder_layers

										lowerCAmelCase  =				dropout
										lowerCAmelCase  =				attention_dropout
										lowerCAmelCase  =				activation_dropout
										lowerCAmelCase  =				encoder_layerdrop
										lowerCAmelCase  =				decoder_layerdrop

										lowerCAmelCase  =				activation_function
										lowerCAmelCase  =				init_std

										lowerCAmelCase  =				use_cache

										# Autoformer
										lowerCAmelCase  =				label_length
										lowerCAmelCase  =				moving_average
										lowerCAmelCase  =				autocorrelation_factor

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




						@property
						def   __lowercase (							self				:			Tuple					):
										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
										)





