


"""simple docstring"""





def        a_  (   _lowerCAmelCase						:				int  ):





       '''simple docstring'''

       lowercase__    :	Any     					=			abs(snake_case__  )
       lowercase__    :	Optional[Any]     					=			0
       while n > 0:
              res += n % 10
              n //= 10
       return res





def        a_  (   _lowerCAmelCase						:				int  ):





       '''simple docstring'''

       lowercase__    :	List[str]     					=			abs(snake_case__  )
       return n if n < 10 else n % 10 + sum_of_digits(n // 10  )





def        a_  (   _lowerCAmelCase						:				int  ):





       '''simple docstring'''

       return sum(int(snake_case__  ) for c in str(abs(snake_case__  )  )  )





def        a_  (   ):





       '''simple docstring'''

       from collections.abc import Callable
       from timeit import timeit

       def benchmark_a_function(_lowerCAmelCase						:				Callable     ,				_lowerCAmelCase						:				int  ) -> None:
              lowercase__    :	str     					=			f"""{func.__name__}({value})"""
              lowercase__    :	Any     					=			timeit(f"""__main__.{call}"""     ,				setup='import __main__'  )
              print(f"""{call:56} = {func(snake_case__  )} -- {timing:.4f} seconds"""  )

       for value in (26_2144, 1125_8999_0684_2624, 126_7650_6002_2822_9401_4967_0320_5376):
              for func in (sum_of_digits, sum_of_digits_recursion, sum_of_digits_compact):
                     benchmark_a_function(snake_case__     ,				snake_case__  )
              print()


if __name__ == "__main__":
       import doctest

       doctest.testmod()
       benchmark()


"""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_  (   _lowerCAmelCase						:				dict  ):





       '''simple docstring'''

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





def        a_  (   _lowerCAmelCase						:				np.ndarray     ,				_lowerCAmelCase						:				np.ndarray     ,				_lowerCAmelCase						:				np.ndarray  ):





       '''simple docstring'''

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





def        a_  (   ):





       '''simple docstring'''

       lowercase__    :	Optional[Any]     					=			fetch_california_housing()
       lowercase__					,   lowercase__    :	str     					=			data_handling(_lowerCAmelCase  )
       lowercase__					,   lowercase__					,   lowercase__					,   lowercase__    :	str     					=			train_test_split(
           _lowerCAmelCase     ,				_lowerCAmelCase     ,				test_size=0.2_5     ,				random_state=1  )
       lowercase__    :	Any     					=			xgboost(_lowerCAmelCase     ,				_lowerCAmelCase     ,				_lowerCAmelCase  )
       # Error printing
       print(f"""Mean Absolute Error : {mean_absolute_error(_lowerCAmelCase     ,				_lowerCAmelCase  )}"""  )
       print(f"""Mean Square Error  : {mean_squared_error(_lowerCAmelCase     ,				_lowerCAmelCase  )}"""  )


if __name__ == "__main__":
       import doctest

       doctest.testmod(verbose=True)
       main()

