






'''simple docstring'''




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







def       __UpperCAmelCase						(  lowerCamelCase_     ,      lowerCamelCase_     ,      lowerCamelCase_)							->     np.ndarray:
		UpperCamelCase__				:					str					=					XGBRegressor(verbosity=0     ,      random_state=42)
		xgb.fit(_SCREAMING_SNAKE_CASE     ,      _SCREAMING_SNAKE_CASE)
		# Predict target for test data
		UpperCamelCase__				:					int					=					xgb.predict(_SCREAMING_SNAKE_CASE)
		UpperCamelCase__				:					List[Any]					=					predictions.reshape(len(_SCREAMING_SNAKE_CASE)     ,      1)
		return predictions







def       __UpperCAmelCase						(  )							->     None:
		UpperCamelCase__				:					Optional[Any]					=					fetch_california_housing()
		UpperCamelCase__,	UpperCamelCase__				:					Optional[Any]					=					data_handling(_SCREAMING_SNAKE_CASE)
		UpperCamelCase__,	UpperCamelCase__,	UpperCamelCase__,	UpperCamelCase__				:					Any					=					train_test_split(
		    _SCREAMING_SNAKE_CASE     ,      _SCREAMING_SNAKE_CASE     ,      test_size=0.25     ,      random_state=1)
		UpperCamelCase__				:					Any					=					xgboost(_SCREAMING_SNAKE_CASE     ,      _SCREAMING_SNAKE_CASE     ,      _SCREAMING_SNAKE_CASE)
		# Error printing
		print(f'Mean Absolute Error : {mean_absolute_error(_SCREAMING_SNAKE_CASE     ,      _SCREAMING_SNAKE_CASE)}')
		print(f'Mean Square Error  : {mean_squared_error(_SCREAMING_SNAKE_CASE     ,      _SCREAMING_SNAKE_CASE)}')


if __name__ == "__main__":
		import doctest

		doctest.testmod(verbose=True)
		main()












'''simple docstring'''




def       __UpperCAmelCase						(  lowerCamelCase_     ,      lowerCamelCase_)							->     list[str]:
		return [sentence[i : i + ngram_size] for i in range(len(lowerCamelCase_) - ngram_size + 1)]


if __name__ == "__main__":
		from doctest import testmod

		testmod()




