mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
Remove doctest in xgboost_regressor.py
main function (#10422)
* updating DIRECTORY.md * updating DIRECTORY.md * updating DIRECTORY.md * updating DIRECTORY.md * Update xgboost_regressor.py --------- Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
parent
37cae3f561
commit
71b372f5e2
|
@ -39,13 +39,13 @@ def xgboost(
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
"""
|
"""
|
||||||
>>> main()
|
|
||||||
Mean Absolute Error : 0.30957163379906033
|
|
||||||
Mean Square Error : 0.22611560196662744
|
|
||||||
|
|
||||||
The URL for this algorithm
|
The URL for this algorithm
|
||||||
https://xgboost.readthedocs.io/en/stable/
|
https://xgboost.readthedocs.io/en/stable/
|
||||||
California house price dataset is used to demonstrate the algorithm.
|
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
|
# Load California house price dataset
|
||||||
california = fetch_california_housing()
|
california = fetch_california_housing()
|
||||||
|
@ -55,8 +55,8 @@ def main() -> None:
|
||||||
)
|
)
|
||||||
predictions = xgboost(x_train, y_train, x_test)
|
predictions = xgboost(x_train, y_train, x_test)
|
||||||
# Error printing
|
# Error printing
|
||||||
print(f"Mean Absolute Error : {mean_absolute_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)}")
|
print(f"Mean Square Error: {mean_squared_error(y_test, predictions)}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in New Issue
Block a user