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     UpperCamelCase						(	__lowercase						:			dict     ):
		'''simple docstring'''




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




def     UpperCamelCase						(	__lowercase						:			np.ndarray						,__lowercase						:			np.ndarray						,__lowercase						:			np.ndarray     ):
		'''simple docstring'''




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




def     UpperCamelCase						(	):
		'''simple docstring'''




		A_		:    Optional[Any]         =				fetch_california_housing()
		A_		:    List[str]         =				data_handling(__lowercase     )
		A_		:    Union[str, Any]         =				train_test_split(
		    __lowercase						,__lowercase						,test_size=0.25						,random_state=1     )
		A_		:    Tuple         =				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()







import sys

from .dependency_versions_table import deps
from .utils.versions import require_version, require_version_core


# define which module versions we always want to check at run time
# (usually the ones defined in `install_requires` in setup.py)
#
# order specific notes:
# - tqdm must be checked before tokenizers

_UpperCAmelCase            =		"""python tqdm regex requests packaging filelock numpy tokenizers""".split()
if sys.version_info < (3, 7):
	pkgs_to_check_at_runtime.append("""dataclasses""")
if sys.version_info < (3, 8):
	pkgs_to_check_at_runtime.append("""importlib_metadata""")

for pkg in pkgs_to_check_at_runtime:
	if pkg in deps:
		if pkg == "tokenizers":
			# must be loaded here, or else tqdm check may fail
			from .utils import is_tokenizers_available

			if not is_tokenizers_available():
				continue  # not required, check version only if installed

		require_version_core(deps[pkg])
	else:
		raise ValueError(F"""can't find {pkg} in {deps.keys()}, check dependency_versions_table.py""")




def     UpperCamelCase						(	__lowercase						:			str						,__lowercase						:			Dict=None     ):
		'''simple docstring'''




		require_version(deps[pkg]						,__lowercase     )






