The URL for this algorithm https://xgboost.readthedocs.io/en/stable/ California house price dataset is used to demonstrate the algorithm. Expected error values: Mean Absolute Error: 0.30957163379906033 Mean Square Error: 0.22611560196662744
()
| 38 | |
| 39 | |
| 40 | def main() -> None: |
| 41 | """ |
| 42 | The URL for this algorithm |
| 43 | https://xgboost.readthedocs.io/en/stable/ |
| 44 | California house price dataset is used to demonstrate the algorithm. |
| 45 | |
| 46 | Expected error values: |
| 47 | Mean Absolute Error: 0.30957163379906033 |
| 48 | Mean Square Error: 0.22611560196662744 |
| 49 | """ |
| 50 | # Load California house price dataset |
| 51 | california = fetch_california_housing() |
| 52 | data, target = data_handling(california) |
| 53 | x_train, x_test, y_train, y_test = train_test_split( |
| 54 | data, target, test_size=0.25, random_state=1 |
| 55 | ) |
| 56 | predictions = xgboost(x_train, y_train, x_test) |
| 57 | # Error printing |
| 58 | print(f"Mean Absolute Error: {mean_absolute_error(y_test, predictions)}") |
| 59 | print(f"Mean Square Error: {mean_squared_error(y_test, predictions)}") |
| 60 | |
| 61 | |
| 62 | if __name__ == "__main__": |
no test coverage detected