


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



def 							UpperCamelCase_( lowerCamelCase_				,					lowerCamelCase_				,					lowerCamelCase_					)       ->		np.ndarray:
    _lowercase			:				int 						=						XGBRegressor(verbosity=0				,					random_state=42					)
    xgb.fit(lowerCamelCase_				,					lowerCamelCase_					)
    # Predict target for test data
    _lowercase			:				int 						=						xgb.predict(lowerCamelCase_					)
    _lowercase			:				Optional[Any] 						=						predictions.reshape(len(lowerCamelCase_					)				,					1					)
    return predictions



def 							UpperCamelCase_( )       ->		None:
    _lowercase			:				Tuple 						=						fetch_california_housing()
    _lowercase						,							_lowercase			:				Any 						=						data_handling(lowerCamelCase_					)
    _lowercase						,							_lowercase						,							_lowercase						,							_lowercase			:				Optional[Any] 						=						train_test_split(
        lowerCamelCase_				,					lowerCamelCase_				,					test_size=0.25				,					random_state=1					)
    _lowercase			:				Optional[int] 						=						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 typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
)


SCREAMING_SNAKE_CASE			: str				   =					{
    "configuration_gpt_bigcode": ["GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP", "GPTBigCodeConfig"],
}

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 SCREAMING_SNAKE_CASE			: int				   =					[
     "GPT_BIGCODE_PRETRAINED_MODEL_ARCHIVE_LIST",
     "GPTBigCodeForSequenceClassification",
     "GPTBigCodeForTokenClassification",
     "GPTBigCodeForCausalLM",
     "GPTBigCodeModel",
     "GPTBigCodePreTrainedModel",
 ]

if TYPE_CHECKING:
 from .configuration_gpt_bigcode import GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP, GPTBigCodeConfig

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_gpt_bigcode import (
      GPT_BIGCODE_PRETRAINED_MODEL_ARCHIVE_LIST,
      GPTBigCodeForCausalLM,
      GPTBigCodeForSequenceClassification,
      GPTBigCodeForTokenClassification,
      GPTBigCodeModel,
      GPTBigCodePreTrainedModel,
  )


else:
 import sys

 SCREAMING_SNAKE_CASE			: List[Any]				   =					_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)


