


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       __lowercase						(    _UpperCamelCase  )     ->Union[str, Any]:







      """simple docstring"""

      return (data["data"], data["target"])




def       __lowercase						(    _UpperCamelCase,     _UpperCamelCase,     _UpperCamelCase  )     ->List[str]:







      """simple docstring"""

      lowercase      : Union[str, Any]        =		XGBRegressor(verbosity=0,     random_state=42  )
      xgb.fit(_UpperCamelCase,     _UpperCamelCase  )
      # Predict target for test data
      lowercase      : Tuple        =		xgb.predict(_UpperCamelCase  )
      lowercase      : Union[str, Any]        =		predictions.reshape(len(_UpperCamelCase  ),     1  )
      return predictions




def       __lowercase						(    )     ->Dict:







      """simple docstring"""

      lowercase      : Optional[Any]        =		fetch_california_housing()
      lowercase ,      lowercase      : int        =		data_handling(_UpperCamelCase  )
      lowercase ,      lowercase ,      lowercase ,      lowercase      : Dict        =		train_test_split(
          _UpperCamelCase,     _UpperCamelCase,     test_size=0.2_5,     random_state=1  )
      lowercase      : int        =		xgboost(_UpperCamelCase,     _UpperCamelCase,     _UpperCamelCase  )
      # Error printing
      print(f"""Mean Absolute Error : {mean_absolute_error(_UpperCamelCase,     _UpperCamelCase  )}"""  )
      print(f"""Mean Square Error  : {mean_squared_error(_UpperCamelCase,     _UpperCamelCase  )}"""  )


if __name__ == "__main__":
  import doctest

  doctest.testmod(verbose=True)
  main()







'''simple docstring'''


import pytest

from datasets.splits import SplitDict, SplitInfo
from datasets.utils.py_utils import asdict
@pytest.mark.parametrize(
    '''split_dict'''					,		[
        SplitDict(),
        SplitDict({'''train''': SplitInfo(name='''train'''					,		num_bytes=1337					,		num_examples=42					,		dataset_name='''my_dataset''' )} ),
        SplitDict({'''train''': SplitInfo(name='''train'''					,		num_bytes=1337					,		num_examples=42 )} ),
        SplitDict({'''train''': SplitInfo()} ),
    ]					,		)
def 						snake_case_       (UpperCamelCase			:    SplitDict ):





							'''simple docstring'''


							_a      	=							split_dict._to_yaml_list()
							assert len(UpperCamelCase ) == len(UpperCamelCase )
							_a      	=							SplitDict._from_yaml_list(UpperCamelCase )
							for split_name, split_info in split_dict.items():
														# dataset_name field is deprecated, and is therefore not part of the YAML dump
														_a      	=							None
														# the split name of split_dict takes over the name of the split info object
														_a      	=							split_name
							assert split_dict == reloaded

@pytest.mark.parametrize(
    '''split_info'''					,		[SplitInfo(), SplitInfo(dataset_name=UpperCamelCase ), SplitInfo(dataset_name='''my_dataset''' )] )
def 						snake_case_       (UpperCamelCase			:    List[str] ):





							'''simple docstring'''


							_a      	=							asdict(SplitDict({'''train''': split_info} ) )
							assert "dataset_name" in split_dict_asdict["train"]
							assert split_dict_asdict["train"]["dataset_name"] == split_info.dataset_name

