Skip to content

Remove doctest in xgboost_regressor.py main function #10422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
12 changes: 6 additions & 6 deletions machine_learning/xgboost_regressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ def xgboost(

def main() -> None:
"""
>>> main()
Mean Absolute Error : 0.30957163379906033
Mean Square Error : 0.22611560196662744
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
"""
# Load California house price dataset
california = fetch_california_housing()
Expand All @@ -55,8 +55,8 @@ def main() -> None:
)
predictions = xgboost(x_train, y_train, x_test)
# Error printing
print(f"Mean Absolute Error : {mean_absolute_error(y_test, predictions)}")
print(f"Mean Square Error : {mean_squared_error(y_test, predictions)}")
print(f"Mean Absolute Error: {mean_absolute_error(y_test, predictions)}")
print(f"Mean Square Error: {mean_squared_error(y_test, predictions)}")


if __name__ == "__main__":
Expand Down