


'''simple docstring'''

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


a_						:       Optional[int]      			=				logging.get_logger(__name__)

a_						:       str      			=				{
    """shi-labs/dinat-mini-in1k-224""": """https://huggingface.co/shi-labs/dinat-mini-in1k-224/resolve/main/config.json""",
    # See all Dinat models at https://huggingface.co/models?filter=dinat
}





class   snake_case					(					lowercase    ,		lowercase    ):





  """simple docstring"""




  _lowerCamelCase						=						"dinat"

  _lowerCamelCase						=						{
      "num_attention_heads": "num_heads",
      "num_hidden_layers": "num_layers",
  }






  def __init__(					self    ,						UpperCamelCase=4    ,						UpperCamelCase=3    ,						UpperCamelCase=64    ,						UpperCamelCase=[3, 4, 6, 5]    ,						UpperCamelCase=[2, 4, 8, 16]    ,						UpperCamelCase=7    ,						UpperCamelCase=[[1, 8, 1], [1, 4, 1, 4], [1, 2, 1, 2, 1, 2], [1, 1, 1, 1, 1]]    ,						UpperCamelCase=3.0    ,						UpperCamelCase=True    ,						UpperCamelCase=0.0    ,						UpperCamelCase=0.0    ,						UpperCamelCase=0.1    ,						UpperCamelCase="gelu"    ,						UpperCamelCase=0.02    ,						UpperCamelCase=1e-5    ,						UpperCamelCase=0.0    ,						UpperCamelCase=None    ,						UpperCamelCase=None    ,						**UpperCamelCase    ,						):







   """simple docstring"""
   super().__init__(**UpperCamelCase  )

   lowerCamelCase_  				=						patch_size
   lowerCamelCase_  				=						num_channels
   lowerCamelCase_  				=						embed_dim
   lowerCamelCase_  				=						depths
   lowerCamelCase_  				=						len(UpperCamelCase  )
   lowerCamelCase_  				=						num_heads
   lowerCamelCase_  				=						kernel_size
   lowerCamelCase_  				=						dilations
   lowerCamelCase_  				=						mlp_ratio
   lowerCamelCase_  				=						qkv_bias
   lowerCamelCase_  				=						hidden_dropout_prob
   lowerCamelCase_  				=						attention_probs_dropout_prob
   lowerCamelCase_  				=						drop_path_rate
   lowerCamelCase_  				=						hidden_act
   lowerCamelCase_  				=						layer_norm_eps
   lowerCamelCase_  				=						initializer_range
   # we set the hidden_size attribute in order to make Dinat work with VisionEncoderDecoderModel
   # this indicates the channel dimension after the last stage of the model
   lowerCamelCase_  				=						int(embed_dim * 2 ** (len(UpperCamelCase  ) - 1)  )
   lowerCamelCase_  				=						layer_scale_init_value
   lowerCamelCase_  				=						["stem"] + [f'''stage{idx}''' for idx in range(1    ,						len(UpperCamelCase  ) + 1  )]
   lowerCamelCase_				,lowerCamelCase_  				=						get_aligned_output_features_output_indices(
       out_features=UpperCamelCase    ,						out_indices=UpperCamelCase    ,						stage_names=self.stage_names  )







'''simple docstring'''

import numpy as np
from matplotlib import pyplot as plt
from sklearn.datasets import load_iris
from sklearn.metrics import ConfusionMatrixDisplay
from sklearn.model_selection import train_test_split
from xgboost import XGBClassifier





def __snake_case      (   UpperCAmelCase_		:		dict	):
 return (data["data"], data["target"])





def __snake_case      (   UpperCAmelCase_		:		np.ndarray      ,       UpperCAmelCase_		:		np.ndarray	):
 lowerCamelCase_  				=						XGBClassifier()
 classifier.fit(UpperCAmelCase_      ,       UpperCAmelCase_	)
 return classifier





def __snake_case      (   ):
 lowerCamelCase_  				=						load_iris()
 lowerCamelCase_				,lowerCamelCase_  				=						data_handling(UpperCAmelCase_	)
 lowerCamelCase_				,lowerCamelCase_				,lowerCamelCase_				,lowerCamelCase_  				=						train_test_split(
     UpperCAmelCase_      ,       UpperCAmelCase_      ,       test_size=0.25	)

 lowerCamelCase_  				=						iris["target_names"]

 # Create an XGBoost Classifier from the training data
 lowerCamelCase_  				=						xgboost(UpperCAmelCase_      ,       UpperCAmelCase_	)

 # Display the confusion matrix of the classifier with both training and test sets
 ConfusionMatrixDisplay.from_estimator(
     UpperCAmelCase_      ,       UpperCAmelCase_      ,       UpperCAmelCase_      ,       display_labels=UpperCAmelCase_      ,       cmap="Blues"      ,       normalize="true"      ,       )
 plt.title("Normalized Confusion Matrix - IRIS Dataset"	)
 plt.show()


if __name__ == "__main__":
     import doctest

     doctest.testmod(verbose=True)
     main()



