



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




def 			snake_case		(		lowerCAmelCase_  ,						lowerCAmelCase_	)						->				XGBClassifier:
  _snake_case   	=      XGBClassifier()
  classifier.fit(lowerCAmelCase_  ,						lowerCAmelCase_	)
  return classifier




def 			snake_case		(		)						->				None:
  _snake_case   	=      load_iris()
  _snake_case	,     _snake_case   	=      data_handling(lowerCAmelCase_	)
  _snake_case	,     _snake_case	,     _snake_case	,     _snake_case   	=      train_test_split(
      lowerCAmelCase_  ,						lowerCAmelCase_  ,						test_size=0.25	)

  _snake_case   	=      iris['''target_names''']

  # Create an XGBoost Classifier from the training data
  _snake_case   	=      xgboost(lowerCAmelCase_  ,						lowerCAmelCase_	)

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


if __name__ == "__main__":
     import doctest

     doctest.testmod(verbose=True)
     main()






import platform
from argparse import ArgumentParser

import huggingface_hub

from .. import __version__ as version
from ..utils import is_accelerate_available, is_torch_available, is_transformers_available, is_xformers_available
from . import BaseDiffusersCLICommand
def 		snake_case__	(		lowercase					):
   return EnvironmentCommand()







class 					_lowercase    (     UpperCAmelCase__			):






    '''simple docstring'''




    @staticmethod
    def      _a    (    lowerCamelCase__ ):
       lowerCAmelCase_:							Tuple       =	parser.add_parser("env" )
       download_parser.set_defaults(func=lowerCamelCase__ )




    def      _a    (    self ):
       lowerCAmelCase_:							int       =	huggingface_hub.__version__

       lowerCAmelCase_:							List[str]       =	"not installed"
       lowerCAmelCase_:							Dict       =	"NA"
       if is_torch_available():
          import torch

          lowerCAmelCase_:							List[str]       =	torch.__version__
          lowerCAmelCase_:							int       =	torch.cuda.is_available()

       lowerCAmelCase_:							Tuple       =	"not installed"
       if is_transformers_available():
          import transformers

          lowerCAmelCase_:							Tuple       =	transformers.__version__

       lowerCAmelCase_:							Optional[int]       =	"not installed"
       if is_accelerate_available():
          import accelerate

          lowerCAmelCase_:							List[Any]       =	accelerate.__version__

       lowerCAmelCase_:							Dict       =	"not installed"
       if is_xformers_available():
          import xformers

          lowerCAmelCase_:							Dict       =	xformers.__version__

       lowerCAmelCase_:							Union[str, Any]       =	{
           "`diffusers` version": version,
           "Platform": platform.platform(),
           "Python version": platform.python_version(),
           "PyTorch version (GPU?)": F'''{pt_version} ({pt_cuda_available})''',
           "Huggingface_hub version": hub_version,
           "Transformers version": transformers_version,
           "Accelerate version": accelerate_version,
           "xFormers version": xformers_version,
           "Using GPU in script?": "<fill in>",
           "Using distributed or parallel set-up in script?": "<fill in>",
       }

       print("\nCopy-and-paste the text below in your GitHub issue and FILL OUT the two last points.\n" )
       print(self.format_dict(lowerCamelCase__ ) )

       return info




    @staticmethod
    def      _a    (    lowerCamelCase__ ):
       return "\n".join([F'''- {prop}: {val}''' for prop, val in d.items()] ) + "\n"