




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



def 					a__				(       snake_case__ ,				snake_case__ ,				snake_case__       )		->      np.ndarray:
			lowerCamelCase       =      XGBRegressor(verbosity=0 ,				random_state=42       )
			xgb.fit(snake_case__ ,				snake_case__       )
			# Predict target for test data
			lowerCamelCase       =      xgb.predict(snake_case__       )
			lowerCamelCase       =      predictions.reshape(len(snake_case__       ) ,				1       )
			return predictions



def 					a__				(       )		->      None:
			lowerCamelCase       =      fetch_california_housing()
			lowerCamelCase       =      data_handling(snake_case__       )
			lowerCamelCase       =      train_test_split(
			    snake_case__ ,				snake_case__ ,				test_size=0.25 ,				random_state=1       )
			lowerCamelCase       =      xgboost(snake_case__ ,				snake_case__ ,				snake_case__       )
			# Error printing
			print(F'Mean Absolute Error : {mean_absolute_error(snake_case__ ,				snake_case__       )}'       )
			print(F'Mean Square Error  : {mean_squared_error(snake_case__ ,				snake_case__       )}'       )


if __name__ == "__main__":
					import doctest

					doctest.testmod(verbose=True)
					main()









"""simple docstring"""




from __future__ import annotations



def 					a__				(       snake_case__ ,				snake_case__ = None ,				snake_case__ = None       )		->      None:
			if start is None:
						lowerCamelCase       =      0

			if end is None:
						lowerCamelCase       =      len(snake_case__       ) - 1

			if start >= end:
						return

			lowerCamelCase       =      (start + end) // 2

			slowsort(snake_case__ ,				snake_case__ ,				snake_case__       )
			slowsort(snake_case__ ,				mid + 1 ,				snake_case__       )

			if sequence[end] < sequence[mid]:
						lowerCamelCase   ,     lowerCamelCase       =      sequence[mid], sequence[end]

			slowsort(snake_case__ ,				snake_case__ ,				end - 1       )


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

					testmod()



