





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


_A					:				Any				=			logging.get_logger(__name__)

_A					:				Union[str, Any]				=			{
    """microsoft/focalnet-tiny""": """https://huggingface.co/microsoft/focalnet-tiny/resolve/main/config.json""",
}



class 					__snake_case	(  __SCREAMING_SNAKE_CASE			,     __SCREAMING_SNAKE_CASE    ):


    '''simple docstring'''







    lowerCamelCase__    :		str				=	"""focalnet"""



    def __init__(       self   ,				A_=2_24   ,				A_=4   ,				A_=3   ,				A_=96   ,				A_=False   ,				A_=[1_92, 3_84, 7_68, 7_68]   ,				A_=[2, 2, 6, 2]   ,				A_=[2, 2, 2, 2]   ,				A_=[3, 3, 3, 3]   ,				A_="gelu"   ,				A_=4.0   ,				A_=0.0   ,				A_=0.1   ,				A_=False   ,				A_=1E-4   ,				A_=False   ,				A_=False   ,				A_=False   ,				A_=0.02   ,				A_=1E-5   ,				A_=32   ,				A_=None   ,				A_=None   ,				**A_   ,				):





        '''simple docstring'''

        super().__init__(**A_     )

        SCREAMING_SNAKE_CASE__											=			image_size
        SCREAMING_SNAKE_CASE__											=			patch_size
        SCREAMING_SNAKE_CASE__											=			num_channels
        SCREAMING_SNAKE_CASE__											=			embed_dim
        SCREAMING_SNAKE_CASE__											=			use_conv_embed
        SCREAMING_SNAKE_CASE__											=			hidden_sizes
        SCREAMING_SNAKE_CASE__											=			depths
        SCREAMING_SNAKE_CASE__											=			focal_levels
        SCREAMING_SNAKE_CASE__											=			focal_windows
        SCREAMING_SNAKE_CASE__											=			hidden_act
        SCREAMING_SNAKE_CASE__											=			mlp_ratio
        SCREAMING_SNAKE_CASE__											=			hidden_dropout_prob
        SCREAMING_SNAKE_CASE__											=			drop_path_rate
        SCREAMING_SNAKE_CASE__											=			use_layerscale
        SCREAMING_SNAKE_CASE__											=			layerscale_value
        SCREAMING_SNAKE_CASE__											=			use_post_layernorm
        SCREAMING_SNAKE_CASE__											=			use_post_layernorm_in_modulation
        SCREAMING_SNAKE_CASE__											=			normalize_modulator
        SCREAMING_SNAKE_CASE__											=			initializer_range
        SCREAMING_SNAKE_CASE__											=			layer_norm_eps
        SCREAMING_SNAKE_CASE__											=			encoder_stride
        SCREAMING_SNAKE_CASE__											=			['''stem'''] + [f'''stage{idx}''' for idx in range(1   ,				len(self.depths     ) + 1     )]
        SCREAMING_SNAKE_CASE__				,		SCREAMING_SNAKE_CASE__											=			get_aligned_output_features_output_indices(
            out_features=A_   ,				out_indices=A_   ,				stage_names=self.stage_names     )







import numpy as np
from sklearn.datasets import fetch_california_housing
from sklearn.metrics import mean_absolute_error, mean_squared_error
from sklearn.model_selection import train_test_split
from xgboost import XGBRegressor


def       SCREAMING_SNAKE_CASE__  (       _lowercase     : dict			)   ->							tuple:




		'''simple docstring'''
		return (data["data"], data["target"])


def       SCREAMING_SNAKE_CASE__  (       _lowercase     : np.ndarray   ,    _lowercase     : np.ndarray   ,    _lowercase     : np.ndarray			)   ->							np.ndarray:




		'''simple docstring'''
		lowercase__					:      List[str]      =		XGBRegressor(verbosity=0   ,    random_state=42			)
		xgb.fit(_lowercase   ,    _lowercase			)
		# Predict target for test data
		lowercase__					:      Union[str, Any]      =		xgb.predict(_lowercase			)
		lowercase__					:      Tuple      =		predictions.reshape(len(_lowercase			)   ,    1			)
		return predictions


def       SCREAMING_SNAKE_CASE__  (       )   ->							None:




		'''simple docstring'''
		lowercase__					:      List[str]      =		fetch_california_housing()
		lowercase__   ,				lowercase__					:      Optional[int]      =		data_handling(_lowercase			)
		lowercase__   ,				lowercase__   ,				lowercase__   ,				lowercase__					:      Optional[Any]      =		train_test_split(
		    _lowercase   ,    _lowercase   ,    test_size=0.25   ,    random_state=1			)
		lowercase__					:      Any      =		xgboost(_lowercase   ,    _lowercase   ,    _lowercase			)
		# Error printing
		print(f"""Mean Absolute Error : {mean_absolute_error(_lowercase   ,    _lowercase			)}"""			)
		print(f"""Mean Square Error  : {mean_squared_error(_lowercase   ,    _lowercase			)}"""			)


if __name__ == "__main__":
			import doctest

			doctest.testmod(verbose=True)
			main()


