



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


_lowercase						  =		logging.get_logger(__name__)

_lowercase						  =		{
    "transfo-xl-wt103": "https://huggingface.co/transfo-xl-wt103/resolve/main/config.json",
}



class     _UpperCAmelCase			(       A__     ):
     UpperCamelCase__		    =				'''transfo-xl'''
     UpperCamelCase__		    =				['''mems''']
     UpperCamelCase__		    =				{
         '''n_token''': '''vocab_size''',
         '''hidden_size''': '''d_model''',
         '''num_attention_heads''': '''n_head''',
         '''num_hidden_layers''': '''n_layer''',
     }




     def __init__(				self ,						a__=2_6_7_7_3_5 ,						a__=[2_0_0_0_0, 4_0_0_0_0, 2_0_0_0_0_0] ,						a__=1_0_2_4 ,						a__=1_0_2_4 ,						a__=1_6 ,						a__=6_4 ,						a__=4_0_9_6 ,						a__=4 ,						a__=False ,						a__=1_8 ,						a__=1_6_0_0 ,						a__=1_0_0_0 ,						a__=True ,						a__=True ,						a__=0 ,						a__=-1 ,						a__=True ,						a__=0.1 ,						a__=0.0 ,						a__=True ,						a__="normal" ,						a__=0.0_1 ,						a__=0.0_1 ,						a__=0.0_2 ,						a__=1e-5 ,						a__=0 ,						**a__ ,						):
         A__		 =					vocab_size
         A__		 =					[]
         self.cutoffs.extend(a__)
         if proj_share_all_but_first:
             A__		 =					[False] + [True] * len(self.cutoffs)
         else:
             A__		 =					[False] + [False] * len(self.cutoffs)
         A__		 =					d_model
         A__		 =					d_embed
         A__		 =					d_head
         A__		 =					d_inner
         A__		 =					div_val
         A__		 =					pre_lnorm
         A__		 =					n_layer
         A__		 =					n_head
         A__		 =					mem_len
         A__		 =					same_length
         A__		 =					attn_type
         A__		 =					clamp_len
         A__		 =					sample_softmax
         A__		 =					adaptive
         A__		 =					dropout
         A__		 =					dropatt
         A__		 =					untie_r
         A__		 =					init
         A__		 =					init_range
         A__		 =					proj_init_std
         A__		 =					init_std
         A__		 =					layer_norm_epsilon
         super().__init__(eos_token_id=a__ ,						**a__)




     @property
     def 		snake_case_		(				self):
         # Message copied from Transformer-XL documentation
         logger.info(F"The model {self.model_type} is one of the few models that has no sequence length limit.")
         return -1




     @max_position_embeddings.setter
     def 		snake_case_		(				self ,						a__):
         # Message copied from Transformer-XL documentation
         raise NotImplementedError(
             F"The model {self.model_type} is one of the few models that has no sequence length limit.")





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 		lowerCAmelCase__    (					UpperCamelCase_				:       dict	)->  tuple:
    return (data["data"], data["target"])



def 		lowerCAmelCase__    (					UpperCamelCase_				:       np.ndarray ,       UpperCamelCase_				:       np.ndarray	)->  XGBClassifier:
    A__		 =					XGBClassifier()
    classifier.fit(UpperCamelCase_ ,       UpperCamelCase_	)
    return classifier



def 		lowerCAmelCase__    (					)->  None:
    A__		 =					load_iris()
    A__ ,	A__		 =					data_handling(UpperCamelCase_	)
    A__ ,	A__ ,	A__ ,	A__		 =					train_test_split(
        UpperCamelCase_ ,       UpperCamelCase_ ,       test_size=0.25	)

    A__		 =					iris['''target_names''']

    # Create an XGBoost Classifier from the training data
    A__		 =					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()
