





from decimal import Decimal, getcontext
from math import ceil, factorial


def 					A__	(       SCREAMING_SNAKE_CASE_		)   ->     str:

		if not isinstance(UpperCAmelCase__							,       UpperCAmelCase__		):
				raise TypeError('''Undefined for non-integers'''		)
		elif precision < 1:
				raise ValueError('''Undefined for non-natural numbers'''		)

		lowerCamelCase   : Optional[Any]								=precision
		lowerCamelCase   : List[Any]								=ceil(precision / 1_4		)
		lowerCamelCase   : Optional[int]								=4_2_6_8_8_0 * Decimal(1_0_0_0_5		).sqrt()
		lowerCamelCase   : List[str]								=1
		lowerCamelCase   : List[Any]								=1_3_5_9_1_4_0_9
		lowerCamelCase   : Union[str, Any]								=Decimal(UpperCAmelCase__		)
		for k in range(1							,       UpperCAmelCase__		):
				lowerCamelCase   : str								=factorial(6 * k		) // (factorial(3 * k		) * factorial(UpperCAmelCase__		) ** 3)
				linear_term += 5_4_5_1_4_0_1_3_4
				exponential_term *= -2_6_2_5_3_7_4_1_2_6_4_0_7_6_8_0_0_0
				partial_sum += Decimal(multinomial_term * linear_term		) / exponential_term
		return str(constant_term / partial_sum		)[:-1]


if __name__ == "__main__":
				snake_case_							=			5_0
				print(F"""The first {n} digits of pi is: {pi(n)}""")








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


def 					A__	(       SCREAMING_SNAKE_CASE_							,       SCREAMING_SNAKE_CASE_							,       SCREAMING_SNAKE_CASE_		)   ->     np.ndarray:
		lowerCamelCase   : Dict								=XGBRegressor(verbosity=0							,       random_state=4_2		)
		xgb.fit(SCREAMING_SNAKE_CASE_							,       SCREAMING_SNAKE_CASE_		)
		# Predict target for test data
		lowerCamelCase   : List[str]								=xgb.predict(SCREAMING_SNAKE_CASE_		)
		lowerCamelCase   : List[Any]								=predictions.reshape(len(SCREAMING_SNAKE_CASE_		)							,       1		)
		return predictions


def 					A__	(       )   ->     None:
		lowerCamelCase   : Union[str, Any]								=fetch_california_housing()
		lowerCamelCase		,   lowerCamelCase   : Optional[Any]								=data_handling(SCREAMING_SNAKE_CASE_		)
		lowerCamelCase		,   lowerCamelCase		,   lowerCamelCase		,   lowerCamelCase   : str								=train_test_split(
		    SCREAMING_SNAKE_CASE_							,       SCREAMING_SNAKE_CASE_							,       test_size=0.2_5							,       random_state=1		)
		lowerCamelCase   : str								=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()

