




'''simple docstring'''


import pytest


_snake_case : List[Any]  				=						'__dummy_dataset1__'

_snake_case : Optional[int]  				=						'\nimport json\nimport os\n\nimport datasets\n\n\nREPO_URL = "https://huggingface.co/datasets/albertvillanova/tests-raw-jsonl/resolve/main/"\nURLS = {"train": REPO_URL + "wikiann-bn-train.jsonl", "validation": REPO_URL + "wikiann-bn-validation.jsonl"}\n\n\nclass __DummyDataset1__(datasets.GeneratorBasedBuilder):\n\n    def _info(self):\n        features = datasets.Features(\n            {\n                "tokens": datasets.Sequence(datasets.Value("string")),\n                "ner_tags": datasets.Sequence(\n                    datasets.features.ClassLabel(\n                        names=[\n                            "O",\n                            "B-PER",\n                            "I-PER",\n                            "B-ORG",\n                            "I-ORG",\n                            "B-LOC",\n                            "I-LOC",\n                        ]\n                    )\n                ),\n                "langs": datasets.Sequence(datasets.Value("string")),\n                "spans": datasets.Sequence(datasets.Value("string")),\n            }\n        )\n        return datasets.DatasetInfo(features=features)\n\n    def _split_generators(self, dl_manager):\n        dl_path = dl_manager.download(URLS)\n        return [\n            datasets.SplitGenerator(datasets.Split.TRAIN, gen_kwargs={"filepath": dl_path["train"]}),\n            datasets.SplitGenerator(datasets.Split.VALIDATION, gen_kwargs={"filepath": dl_path["validation"]}),\n        ]\n\n    def _generate_examples(self, filepath):\n        with open(filepath, "r", encoding="utf-8") as f:\n            for i, line in enumerate(f):\n                yield i, json.loads(line)\n'
@pytest.fixture
def 						snake_case_       ():





							'''simple docstring'''


							return DATASET_LOADING_SCRIPT_NAME
@pytest.fixture
def 						snake_case_       ():





							'''simple docstring'''


							return DATASET_LOADING_SCRIPT_CODE

@pytest.fixture
def 						snake_case_       (UpperCamelCase			:    int					,		UpperCamelCase			:    str					,		UpperCamelCase			:    int ):





							'''simple docstring'''


							_a      	=							dataset_loading_script_name
							_a      	=							tmp_path / '''datasets''' / script_name
							script_dir.mkdir(parents=UpperCamelCase )
							_a      	=							script_dir / f'{script_name}.py'
							with open(UpperCamelCase					,		'''w''' ) as f:
														f.write(UpperCamelCase )
							return str(UpperCamelCase )







'''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 						snake_case_       (UpperCamelCase			:    dict ):





							'''simple docstring'''


							return (data["data"], data["target"])
def 						snake_case_       (UpperCamelCase			:    np.ndarray					,		UpperCamelCase			:    np.ndarray					,		UpperCamelCase			:    np.ndarray ):





							'''simple docstring'''


							_a      	=							XGBRegressor(verbosity=0					,		random_state=42 )
							xgb.fit(UpperCamelCase					,		UpperCamelCase )
							# Predict target for test data
							_a      	=							xgb.predict(UpperCamelCase )
							_a      	=							predictions.reshape(len(UpperCamelCase )					,		1 )
							return predictions
def 						snake_case_       ():





							'''simple docstring'''


							_a      	=							fetch_california_housing()
							_a	,				_a      	=							data_handling(UpperCamelCase )
							_a	,				_a	,				_a	,				_a      	=							train_test_split(
							    UpperCamelCase					,		UpperCamelCase					,		test_size=0.25					,		random_state=1 )
							_a      	=							xgboost(UpperCamelCase					,		UpperCamelCase					,		UpperCamelCase )
							# Error printing
							print(f'Mean Absolute Error : {mean_absolute_error(UpperCamelCase					,		UpperCamelCase )}' )
							print(f'Mean Square Error  : {mean_squared_error(UpperCamelCase					,		UpperCamelCase )}' )


if __name__ == "__main__":
				import doctest

				doctest.testmod(verbose=True)
				main()

