Skip to content

Added Random Forest Regressor as an additional prediction model. #12767

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

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed May 24, 2025
commit f2793d33abb7ebd476f22ce8db5ea839e67f25ba
4 changes: 3 additions & 1 deletion machine_learning/forecasting/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
for the next 3 months sales or something,
u can just adjust it for ur own purpose
"""

from warnings import simplefilter

import numpy as np
Expand Down Expand Up @@ -77,6 +78,7 @@ def support_vector_regressor(x_train: list, x_test: list, train_user: list) -> f
y_pred = regressor.predict(x_test)
return float(y_pred[0])


def random_forest_regressor(x_train: list, x_test: list, train_user: list) -> float:
"""
Fourth method: Random Forest Regressor
Expand All @@ -90,7 +92,7 @@ def random_forest_regressor(x_train: list, x_test: list, train_user: list) -> fl
input : training data (date, total_event) in list of float
where x = list of set (date and total event)
output : list of total user prediction in float

>>> random_forest_regressor([[5,2],[1,5],[6,2]], [[3,2]], [2,1,4])
2.3333333333333335
"""
Expand Down
Loading