

from collections import OrderedDict

from ...utils import logging
from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update
from .configuration_auto import CONFIG_MAPPING_NAMES


_lowerCAmelCase  :      List[Any]			 =logging.get_logger(__name__)


_lowerCAmelCase  :      Tuple			 =OrderedDict(
    [
        # Base model mapping
        ("""albert""", """FlaxAlbertModel"""),
        ("""bart""", """FlaxBartModel"""),
        ("""beit""", """FlaxBeitModel"""),
        ("""bert""", """FlaxBertModel"""),
        ("""big_bird""", """FlaxBigBirdModel"""),
        ("""blenderbot""", """FlaxBlenderbotModel"""),
        ("""blenderbot-small""", """FlaxBlenderbotSmallModel"""),
        ("""clip""", """FlaxCLIPModel"""),
        ("""distilbert""", """FlaxDistilBertModel"""),
        ("""electra""", """FlaxElectraModel"""),
        ("""gpt-sw3""", """FlaxGPT2Model"""),
        ("""gpt2""", """FlaxGPT2Model"""),
        ("""gpt_neo""", """FlaxGPTNeoModel"""),
        ("""gptj""", """FlaxGPTJModel"""),
        ("""longt5""", """FlaxLongT5Model"""),
        ("""marian""", """FlaxMarianModel"""),
        ("""mbart""", """FlaxMBartModel"""),
        ("""mt5""", """FlaxMT5Model"""),
        ("""opt""", """FlaxOPTModel"""),
        ("""pegasus""", """FlaxPegasusModel"""),
        ("""regnet""", """FlaxRegNetModel"""),
        ("""resnet""", """FlaxResNetModel"""),
        ("""roberta""", """FlaxRobertaModel"""),
        ("""roberta-prelayernorm""", """FlaxRobertaPreLayerNormModel"""),
        ("""roformer""", """FlaxRoFormerModel"""),
        ("""t5""", """FlaxT5Model"""),
        ("""vision-text-dual-encoder""", """FlaxVisionTextDualEncoderModel"""),
        ("""vit""", """FlaxViTModel"""),
        ("""wav2vec2""", """FlaxWav2Vec2Model"""),
        ("""whisper""", """FlaxWhisperModel"""),
        ("""xglm""", """FlaxXGLMModel"""),
        ("""xlm-roberta""", """FlaxXLMRobertaModel"""),
    ]
)

_lowerCAmelCase  :      Tuple			 =OrderedDict(
    [
        # Model for pre-training mapping
        ("""albert""", """FlaxAlbertForPreTraining"""),
        ("""bart""", """FlaxBartForConditionalGeneration"""),
        ("""bert""", """FlaxBertForPreTraining"""),
        ("""big_bird""", """FlaxBigBirdForPreTraining"""),
        ("""electra""", """FlaxElectraForPreTraining"""),
        ("""longt5""", """FlaxLongT5ForConditionalGeneration"""),
        ("""mbart""", """FlaxMBartForConditionalGeneration"""),
        ("""mt5""", """FlaxMT5ForConditionalGeneration"""),
        ("""roberta""", """FlaxRobertaForMaskedLM"""),
        ("""roberta-prelayernorm""", """FlaxRobertaPreLayerNormForMaskedLM"""),
        ("""roformer""", """FlaxRoFormerForMaskedLM"""),
        ("""t5""", """FlaxT5ForConditionalGeneration"""),
        ("""wav2vec2""", """FlaxWav2Vec2ForPreTraining"""),
        ("""whisper""", """FlaxWhisperForConditionalGeneration"""),
        ("""xlm-roberta""", """FlaxXLMRobertaForMaskedLM"""),
    ]
)

_lowerCAmelCase  :      str			 =OrderedDict(
    [
        # Model for Masked LM mapping
        ("""albert""", """FlaxAlbertForMaskedLM"""),
        ("""bart""", """FlaxBartForConditionalGeneration"""),
        ("""bert""", """FlaxBertForMaskedLM"""),
        ("""big_bird""", """FlaxBigBirdForMaskedLM"""),
        ("""distilbert""", """FlaxDistilBertForMaskedLM"""),
        ("""electra""", """FlaxElectraForMaskedLM"""),
        ("""mbart""", """FlaxMBartForConditionalGeneration"""),
        ("""roberta""", """FlaxRobertaForMaskedLM"""),
        ("""roberta-prelayernorm""", """FlaxRobertaPreLayerNormForMaskedLM"""),
        ("""roformer""", """FlaxRoFormerForMaskedLM"""),
        ("""xlm-roberta""", """FlaxXLMRobertaForMaskedLM"""),
    ]
)

_lowerCAmelCase  :      List[Any]			 =OrderedDict(
    [
        # Model for Seq2Seq Causal LM mapping
        ("""bart""", """FlaxBartForConditionalGeneration"""),
        ("""blenderbot""", """FlaxBlenderbotForConditionalGeneration"""),
        ("""blenderbot-small""", """FlaxBlenderbotSmallForConditionalGeneration"""),
        ("""encoder-decoder""", """FlaxEncoderDecoderModel"""),
        ("""longt5""", """FlaxLongT5ForConditionalGeneration"""),
        ("""marian""", """FlaxMarianMTModel"""),
        ("""mbart""", """FlaxMBartForConditionalGeneration"""),
        ("""mt5""", """FlaxMT5ForConditionalGeneration"""),
        ("""pegasus""", """FlaxPegasusForConditionalGeneration"""),
        ("""t5""", """FlaxT5ForConditionalGeneration"""),
    ]
)

_lowerCAmelCase  :      Optional[int]			 =OrderedDict(
    [
        # Model for Image-classsification
        ("""beit""", """FlaxBeitForImageClassification"""),
        ("""regnet""", """FlaxRegNetForImageClassification"""),
        ("""resnet""", """FlaxResNetForImageClassification"""),
        ("""vit""", """FlaxViTForImageClassification"""),
    ]
)

_lowerCAmelCase  :      str			 =OrderedDict(
    [
        ("""vision-encoder-decoder""", """FlaxVisionEncoderDecoderModel"""),
    ]
)

_lowerCAmelCase  :      int			 =OrderedDict(
    [
        # Model for Causal LM mapping
        ("""bart""", """FlaxBartForCausalLM"""),
        ("""bert""", """FlaxBertForCausalLM"""),
        ("""big_bird""", """FlaxBigBirdForCausalLM"""),
        ("""electra""", """FlaxElectraForCausalLM"""),
        ("""gpt-sw3""", """FlaxGPT2LMHeadModel"""),
        ("""gpt2""", """FlaxGPT2LMHeadModel"""),
        ("""gpt_neo""", """FlaxGPTNeoForCausalLM"""),
        ("""gptj""", """FlaxGPTJForCausalLM"""),
        ("""opt""", """FlaxOPTForCausalLM"""),
        ("""roberta""", """FlaxRobertaForCausalLM"""),
        ("""roberta-prelayernorm""", """FlaxRobertaPreLayerNormForCausalLM"""),
        ("""xglm""", """FlaxXGLMForCausalLM"""),
        ("""xlm-roberta""", """FlaxXLMRobertaForCausalLM"""),
    ]
)

_lowerCAmelCase  :      Optional[Any]			 =OrderedDict(
    [
        # Model for Sequence Classification mapping
        ("""albert""", """FlaxAlbertForSequenceClassification"""),
        ("""bart""", """FlaxBartForSequenceClassification"""),
        ("""bert""", """FlaxBertForSequenceClassification"""),
        ("""big_bird""", """FlaxBigBirdForSequenceClassification"""),
        ("""distilbert""", """FlaxDistilBertForSequenceClassification"""),
        ("""electra""", """FlaxElectraForSequenceClassification"""),
        ("""mbart""", """FlaxMBartForSequenceClassification"""),
        ("""roberta""", """FlaxRobertaForSequenceClassification"""),
        ("""roberta-prelayernorm""", """FlaxRobertaPreLayerNormForSequenceClassification"""),
        ("""roformer""", """FlaxRoFormerForSequenceClassification"""),
        ("""xlm-roberta""", """FlaxXLMRobertaForSequenceClassification"""),
    ]
)

_lowerCAmelCase  :      Optional[int]			 =OrderedDict(
    [
        # Model for Question Answering mapping
        ("""albert""", """FlaxAlbertForQuestionAnswering"""),
        ("""bart""", """FlaxBartForQuestionAnswering"""),
        ("""bert""", """FlaxBertForQuestionAnswering"""),
        ("""big_bird""", """FlaxBigBirdForQuestionAnswering"""),
        ("""distilbert""", """FlaxDistilBertForQuestionAnswering"""),
        ("""electra""", """FlaxElectraForQuestionAnswering"""),
        ("""mbart""", """FlaxMBartForQuestionAnswering"""),
        ("""roberta""", """FlaxRobertaForQuestionAnswering"""),
        ("""roberta-prelayernorm""", """FlaxRobertaPreLayerNormForQuestionAnswering"""),
        ("""roformer""", """FlaxRoFormerForQuestionAnswering"""),
        ("""xlm-roberta""", """FlaxXLMRobertaForQuestionAnswering"""),
    ]
)

_lowerCAmelCase  :      List[Any]			 =OrderedDict(
    [
        # Model for Token Classification mapping
        ("""albert""", """FlaxAlbertForTokenClassification"""),
        ("""bert""", """FlaxBertForTokenClassification"""),
        ("""big_bird""", """FlaxBigBirdForTokenClassification"""),
        ("""distilbert""", """FlaxDistilBertForTokenClassification"""),
        ("""electra""", """FlaxElectraForTokenClassification"""),
        ("""roberta""", """FlaxRobertaForTokenClassification"""),
        ("""roberta-prelayernorm""", """FlaxRobertaPreLayerNormForTokenClassification"""),
        ("""roformer""", """FlaxRoFormerForTokenClassification"""),
        ("""xlm-roberta""", """FlaxXLMRobertaForTokenClassification"""),
    ]
)

_lowerCAmelCase  :      Dict			 =OrderedDict(
    [
        # Model for Multiple Choice mapping
        ("""albert""", """FlaxAlbertForMultipleChoice"""),
        ("""bert""", """FlaxBertForMultipleChoice"""),
        ("""big_bird""", """FlaxBigBirdForMultipleChoice"""),
        ("""distilbert""", """FlaxDistilBertForMultipleChoice"""),
        ("""electra""", """FlaxElectraForMultipleChoice"""),
        ("""roberta""", """FlaxRobertaForMultipleChoice"""),
        ("""roberta-prelayernorm""", """FlaxRobertaPreLayerNormForMultipleChoice"""),
        ("""roformer""", """FlaxRoFormerForMultipleChoice"""),
        ("""xlm-roberta""", """FlaxXLMRobertaForMultipleChoice"""),
    ]
)

_lowerCAmelCase  :      Any			 =OrderedDict(
    [
        ("""bert""", """FlaxBertForNextSentencePrediction"""),
    ]
)

_lowerCAmelCase  :      Union[str, Any]			 =OrderedDict(
    [
        ("""speech-encoder-decoder""", """FlaxSpeechEncoderDecoderModel"""),
        ("""whisper""", """FlaxWhisperForConditionalGeneration"""),
    ]
)

_lowerCAmelCase  :      List[str]			 =OrderedDict(
    [
        ("""whisper""", """FlaxWhisperForAudioClassification"""),
    ]
)

_lowerCAmelCase  :      Tuple			 =_LazyAutoMapping(CONFIG_MAPPING_NAMES, FLAX_MODEL_MAPPING_NAMES)
_lowerCAmelCase  :      str			 =_LazyAutoMapping(CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_PRETRAINING_MAPPING_NAMES)
_lowerCAmelCase  :      str			 =_LazyAutoMapping(CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_MASKED_LM_MAPPING_NAMES)
_lowerCAmelCase  :      Tuple			 =_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING_NAMES
)
_lowerCAmelCase  :      Any			 =_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING_NAMES
)
_lowerCAmelCase  :      int			 =_LazyAutoMapping(CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_VISION_2_SEQ_MAPPING_NAMES)
_lowerCAmelCase  :      int			 =_LazyAutoMapping(CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_CAUSAL_LM_MAPPING_NAMES)
_lowerCAmelCase  :      Tuple			 =_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING_NAMES
)
_lowerCAmelCase  :      Optional[int]			 =_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_QUESTION_ANSWERING_MAPPING_NAMES
)
_lowerCAmelCase  :      Tuple			 =_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING_NAMES
)
_lowerCAmelCase  :      Optional[int]			 =_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_MULTIPLE_CHOICE_MAPPING_NAMES
)
_lowerCAmelCase  :      List[str]			 =_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING_NAMES
)
_lowerCAmelCase  :      List[Any]			 =_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING_NAMES
)
_lowerCAmelCase  :      str			 =_LazyAutoMapping(
    CONFIG_MAPPING_NAMES, FLAX_MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING_NAMES
)

class __UpperCamelCase     (				_BaseAutoModelClass		):






					'''simple docstring'''



					__magic_name__        =   FLAX_MODEL_MAPPING
_lowerCAmelCase  :      Union[str, Any]			 =auto_class_update(FlaxAutoModel)

class __UpperCamelCase     (				_BaseAutoModelClass		):






					'''simple docstring'''



					__magic_name__        =   FLAX_MODEL_FOR_PRETRAINING_MAPPING
_lowerCAmelCase  :      List[str]			 =auto_class_update(FlaxAutoModelForPreTraining, head_doc="""pretraining""")

class __UpperCamelCase     (				_BaseAutoModelClass		):






					'''simple docstring'''



					__magic_name__        =   FLAX_MODEL_FOR_CAUSAL_LM_MAPPING
_lowerCAmelCase  :      Dict			 =auto_class_update(FlaxAutoModelForCausalLM, head_doc="""causal language modeling""")

class __UpperCamelCase     (				_BaseAutoModelClass		):






					'''simple docstring'''



					__magic_name__        =   FLAX_MODEL_FOR_MASKED_LM_MAPPING
_lowerCAmelCase  :      List[str]			 =auto_class_update(FlaxAutoModelForMaskedLM, head_doc="""masked language modeling""")

class __UpperCamelCase     (				_BaseAutoModelClass		):






					'''simple docstring'''



					__magic_name__        =   FLAX_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING
_lowerCAmelCase  :      Any			 =auto_class_update(
    FlaxAutoModelForSeqaSeqLM, head_doc="""sequence-to-sequence language modeling""", checkpoint_for_example="""t5-base"""
)

class __UpperCamelCase     (				_BaseAutoModelClass		):






					'''simple docstring'''



					__magic_name__        =   FLAX_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING
_lowerCAmelCase  :      str			 =auto_class_update(
    FlaxAutoModelForSequenceClassification, head_doc="""sequence classification"""
)

class __UpperCamelCase     (				_BaseAutoModelClass		):






					'''simple docstring'''



					__magic_name__        =   FLAX_MODEL_FOR_QUESTION_ANSWERING_MAPPING
_lowerCAmelCase  :      Optional[Any]			 =auto_class_update(FlaxAutoModelForQuestionAnswering, head_doc="""question answering""")

class __UpperCamelCase     (				_BaseAutoModelClass		):






					'''simple docstring'''



					__magic_name__        =   FLAX_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING
_lowerCAmelCase  :      Union[str, Any]			 =auto_class_update(
    FlaxAutoModelForTokenClassification, head_doc="""token classification"""
)

class __UpperCamelCase     (				_BaseAutoModelClass		):






					'''simple docstring'''



					__magic_name__        =   FLAX_MODEL_FOR_MULTIPLE_CHOICE_MAPPING
_lowerCAmelCase  :      Union[str, Any]			 =auto_class_update(FlaxAutoModelForMultipleChoice, head_doc="""multiple choice""")

class __UpperCamelCase     (				_BaseAutoModelClass		):






					'''simple docstring'''



					__magic_name__        =   FLAX_MODEL_FOR_NEXT_SENTENCE_PREDICTION_MAPPING
_lowerCAmelCase  :      Dict			 =auto_class_update(
    FlaxAutoModelForNextSentencePrediction, head_doc="""next sentence prediction"""
)

class __UpperCamelCase     (				_BaseAutoModelClass		):






					'''simple docstring'''



					__magic_name__        =   FLAX_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING
_lowerCAmelCase  :      Tuple			 =auto_class_update(
    FlaxAutoModelForImageClassification, head_doc="""image classification"""
)

class __UpperCamelCase     (				_BaseAutoModelClass		):






					'''simple docstring'''



					__magic_name__        =   FLAX_MODEL_FOR_VISION_2_SEQ_MAPPING
_lowerCAmelCase  :      List[Any]			 =auto_class_update(FlaxAutoModelForVisionaSeq, head_doc="""vision-to-text modeling""")

class __UpperCamelCase     (				_BaseAutoModelClass		):






					'''simple docstring'''



					__magic_name__        =   FLAX_MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING
_lowerCAmelCase  :      Any			 =auto_class_update(
    FlaxAutoModelForSpeechSeqaSeq, head_doc="""sequence-to-sequence speech-to-text modeling"""
)


import logging

import numpy as np
import pytest
from scipy.linalg import eigh

logging.basicConfig(level=logging.INFO, format="""%(message)s""")



def 			_A	(      SCREAMING_SNAKE_CASE      ):
	return input_array.reshape((input_array.size, 1)      )



def 			_A	(      SCREAMING_SNAKE_CASE	,SCREAMING_SNAKE_CASE	,SCREAMING_SNAKE_CASE      ):
	UpperCAmelCase__:	int									= np.nan
	for i in range(SCREAMING_SNAKE_CASE      ):
		UpperCAmelCase__:	Tuple									= features[:, labels == i]
		UpperCAmelCase__:	int									= data.mean(1      )
		# Centralize the data of class i
		UpperCAmelCase__:	Optional[Any]									= data - column_reshape(SCREAMING_SNAKE_CASE      )
		if i > 0:
			# If covariance_sum is not None
			covariance_sum += np.dot(SCREAMING_SNAKE_CASE	,centered_data.T      )
		else:
			# If covariance_sum is np.nan (i.e. first loop)
			UpperCAmelCase__:	Dict									= np.dot(SCREAMING_SNAKE_CASE	,centered_data.T      )

	return covariance_sum / features.shape[1]



def 			_A	(      SCREAMING_SNAKE_CASE	,SCREAMING_SNAKE_CASE	,SCREAMING_SNAKE_CASE      ):
	UpperCAmelCase__:	int									= features.mean(1      )
	UpperCAmelCase__:	Optional[Any]									= np.nan
	for i in range(SCREAMING_SNAKE_CASE      ):
		UpperCAmelCase__:	List[Any]									= features[:, labels == i]
		UpperCAmelCase__:	Optional[Any]									= data.shape[1]
		UpperCAmelCase__:	List[Any]									= data.mean(1      )
		if i > 0:
			# If covariance_sum is not None
			covariance_sum += device_data * np.dot(
			    column_reshape(SCREAMING_SNAKE_CASE      ) - column_reshape(SCREAMING_SNAKE_CASE      )	,(column_reshape(SCREAMING_SNAKE_CASE      ) - column_reshape(SCREAMING_SNAKE_CASE      )).T	,)
		else:
			# If covariance_sum is np.nan (i.e. first loop)
			UpperCAmelCase__:	Tuple									= device_data * np.dot(
			    column_reshape(SCREAMING_SNAKE_CASE      ) - column_reshape(SCREAMING_SNAKE_CASE      )	,(column_reshape(SCREAMING_SNAKE_CASE      ) - column_reshape(SCREAMING_SNAKE_CASE      )).T	,)

	return covariance_sum / features.shape[1]



def 			_A	(      SCREAMING_SNAKE_CASE	,SCREAMING_SNAKE_CASE      ):

	# Check if the features have been loaded
	if features.any():
		UpperCAmelCase__:	Tuple									= features.mean(1      )
		# Center the dataset
		UpperCAmelCase__:	List[Any]									= features - np.reshape(SCREAMING_SNAKE_CASE	,(data_mean.size, 1)      )
		UpperCAmelCase__:	Optional[int]									= np.dot(SCREAMING_SNAKE_CASE	,centered_data.T      ) / features.shape[1]
		UpperCAmelCase__							,						UpperCAmelCase__:	Dict									= np.linalg.eigh(SCREAMING_SNAKE_CASE      )
		# Take all the columns in the reverse order (-1), and then takes only the first
		UpperCAmelCase__:	Optional[Any]									= eigenvectors[:, ::-1][:, 0:dimensions]
		# Project the database on the new space
		UpperCAmelCase__:	Tuple									= np.dot(filtered_eigenvectors.T	,SCREAMING_SNAKE_CASE      )
		logging.info("Principal Component Analysis computed"      )

		return projected_data
	else:
		logging.basicConfig(level=logging.ERROR	,format="%(message)s"	,force=SCREAMING_SNAKE_CASE      )
		logging.error("Dataset empty"      )
		raise AssertionError



def 			_A	(      SCREAMING_SNAKE_CASE	,SCREAMING_SNAKE_CASE	,SCREAMING_SNAKE_CASE	,SCREAMING_SNAKE_CASE      ):
	assert classes > dimensions

	# Check if features have been already loaded
	if features.any:
		UpperCAmelCase__							,						UpperCAmelCase__:	List[str]									= eigh(
		    covariance_between_classes(SCREAMING_SNAKE_CASE	,SCREAMING_SNAKE_CASE	,SCREAMING_SNAKE_CASE      )	,covariance_within_classes(SCREAMING_SNAKE_CASE	,SCREAMING_SNAKE_CASE	,SCREAMING_SNAKE_CASE      )	,)
		UpperCAmelCase__:	int									= eigenvectors[:, ::-1][:, :dimensions]
		UpperCAmelCase__							,						UpperCAmelCase__							,						UpperCAmelCase__:	Optional[Any]									= np.linalg.svd(SCREAMING_SNAKE_CASE      )
		UpperCAmelCase__:	Optional[Any]									= svd_matrix[:, 0:dimensions]
		UpperCAmelCase__:	Optional[int]									= np.dot(filtered_svd_matrix.T	,SCREAMING_SNAKE_CASE      )
		logging.info("Linear Discriminant Analysis computed"      )

		return projected_data
	else:
		logging.basicConfig(level=logging.ERROR	,format="%(message)s"	,force=SCREAMING_SNAKE_CASE      )
		logging.error("Dataset empty"      )
		raise AssertionError



def 			_A	(      ):
	# Create dummy dataset with 2 classes and 3 features
	UpperCAmelCase__:	List[str]									= np.array([[1, 2, 3, 4, 5], [2, 3, 4, 5, 6], [3, 4, 5, 6, 7]]      )
	UpperCAmelCase__:	Optional[int]									= np.array([0, 0, 0, 1, 1]      )
	UpperCAmelCase__:	List[Any]									= 2
	UpperCAmelCase__:	Union[str, Any]									= 2

	# Assert that the function raises an AssertionError if dimensions > classes
	with pytest.raises(SCREAMING_SNAKE_CASE      ) as error_info:
		UpperCAmelCase__:	List[Any]									= linear_discriminant_analysis(
		    SCREAMING_SNAKE_CASE	,SCREAMING_SNAKE_CASE	,SCREAMING_SNAKE_CASE	,SCREAMING_SNAKE_CASE      )
		if isinstance(SCREAMING_SNAKE_CASE	,np.ndarray      ):
			raise AssertionError(
			    "Did not raise AssertionError for dimensions > classes"      )
		assert error_info.type is AssertionError



def 			_A	(      ):
	UpperCAmelCase__:	Optional[Any]									= np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]      )
	UpperCAmelCase__:	Optional[int]									= 2
	UpperCAmelCase__:	Union[str, Any]									= np.array([[6.92_82_03_23, 8.66_02_54_04, 10.39_23_04_85], [3.0, 3.0, 3.0]]      )

	with pytest.raises(SCREAMING_SNAKE_CASE      ) as error_info:
		UpperCAmelCase__:	Any									= principal_component_analysis(SCREAMING_SNAKE_CASE	,SCREAMING_SNAKE_CASE      )
		if not np.allclose(SCREAMING_SNAKE_CASE	,SCREAMING_SNAKE_CASE      ):
			raise AssertionError
		assert error_info.type is AssertionError


if __name__ == "__main__":
					import doctest

					doctest.testmod()