





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


def 							__snake_case							(    lowerCAmelCase_ ,							lowerCAmelCase_ ,							lowerCAmelCase_	)				->						np.ndarray:
    SCREAMING_SNAKE_CASE__											=			XGBRegressor(verbosity=0 ,							random_state=4_2	)
    xgb.fit(lowerCAmelCase_ ,							lowerCAmelCase_	)
    # Predict target for test data
    SCREAMING_SNAKE_CASE__											=			xgb.predict(lowerCAmelCase_	)
    SCREAMING_SNAKE_CASE__											=			predictions.reshape(len(lowerCAmelCase_	) ,							1	)
    return predictions


def 							__snake_case							(    )				->						None:
    SCREAMING_SNAKE_CASE__											=			fetch_california_housing()
    SCREAMING_SNAKE_CASE__				,		SCREAMING_SNAKE_CASE__											=			data_handling(lowerCAmelCase_	)
    SCREAMING_SNAKE_CASE__				,		SCREAMING_SNAKE_CASE__				,		SCREAMING_SNAKE_CASE__				,		SCREAMING_SNAKE_CASE__											=			train_test_split(
        lowerCAmelCase_ ,							lowerCAmelCase_ ,							test_size=0.25 ,							random_state=1	)
    SCREAMING_SNAKE_CASE__											=			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()







from torch import nn


def 							__snake_case							(    lowerCAmelCase_	)				->						Tuple:
    if act_fn in ["swish", "silu"]:
        return nn.SiLU()
    elif act_fn == "mish":
        return nn.Mish()
    elif act_fn == "gelu":
        return nn.GELU()
    else:
        raise ValueError(f'''Unsupported activation function: {act_fn}'''	)
