





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





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





def    __UpperCamelCase      (    ) ->None:
					lowerCamelCase__       =       fetch_california_housing()
					lowerCamelCase__    ,		lowerCamelCase__       =       data_handling(a)
					lowerCamelCase__    ,		lowerCamelCase__    ,		lowerCamelCase__    ,		lowerCamelCase__       =       train_test_split(
					    a,     a,     test_size=0.2_5,     random_state=1)
					lowerCamelCase__       =       xgboost(a,     a,     a)
					# Error printing
					print(f"Mean Absolute Error : {mean_absolute_error(a,     a)}")
					print(f"Mean Square Error  : {mean_squared_error(a,     a)}")


if __name__ == "__main__":
						import doctest

						doctest.testmod(verbose=True)
						main()








def    __UpperCamelCase      (    a) ->float:
					return 10 - x * x





def    __UpperCamelCase      (    a,     a) ->float:
					# Bolzano theory in order to find if there is a root between a and b
					if equation(a) * equation(a) >= 0:
										raise ValueError("Wrong space!")

					lowerCamelCase__       =       a
					while (b - a) >= 0.0_1:
										# Find middle point
										lowerCamelCase__       =       (a + b) / 2
										# Check if middle point is root
										if equation(a) == 0.0:
															break
										# Decide the side to repeat the steps
										if equation(a) * equation(a) < 0:
															lowerCamelCase__       =       c
										else:
															lowerCamelCase__       =       c
					return c


if __name__ == "__main__":
						import doctest

						doctest.testmod()

						print(bisection(-2, 5))
						print(bisection(0, 6))

