Skip to content

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

Open
priyanshu-8789 wants to merge 14 commits into
TheAlgorithms:masterfrom
priyanshu-8789:master
Open

Added Random Forest Regressor as an additional prediction model.#12767
priyanshu-8789 wants to merge 14 commits into
TheAlgorithms:masterfrom
priyanshu-8789:master

Conversation

@priyanshu-8789
Copy link
Copy Markdown

@priyanshu-8789 priyanshu-8789 commented May 24, 2025

Describe your change:

Implemented RandomForestRegressor alongside SVR and SARIMAX

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Add or change doctests? -- Note: Please avoid changing both code and tests in a single pull request.
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the description above includes the issue number(s) with a closing keyword: "Fixes #ISSUE-NUMBER".

@algorithms-keeper algorithms-keeper Bot added the tests are failing Do not merge until tests pass label May 24, 2025
@priyanshu-8789
Copy link
Copy Markdown
Author

Implemented RandomForestRegressor alongside SVR and SARIMAX
It will help to improve robustness and accuracy in data safety checking
Updated the voting mechanism to include Random Forest predictions

@algorithms-keeper algorithms-keeper Bot added the awaiting reviews This PR is ready to be reviewed label May 24, 2025
@priyanshu-8789
Copy link
Copy Markdown
Author

Added Random Forest Regressor to main voting

@algorithms-keeper algorithms-keeper Bot removed the tests are failing Do not merge until tests pass label May 24, 2025
@priyanshu-8789
Copy link
Copy Markdown
Author

priyanshu-8789 commented May 24, 2025

Hi @poyea,
I've added the Random Forest Regressor as an additional prediction model. All checks have passed.
Could you please review and approve this pull request when convenient?
Thank you!

@priyanshu-8789
Copy link
Copy Markdown
Author

Hi @TheAlgorithms,
I've added the Random Forest Regressor as an additional prediction model. All checks have passed.
Could you please review and approve this pull request when convenient?
Thank you!

priyanshu-8789 and others added 3 commits May 25, 2025 19:47
Used matplotlib to plot actual vs predicted user count, forecast confidence intervals, outlier thresholds from IQR.
Added logging instead of print because in production, print() is not scalable.
@algorithms-keeper algorithms-keeper Bot added the tests are failing Do not merge until tests pass label May 25, 2025
@algorithms-keeper algorithms-keeper Bot removed the tests are failing Do not merge until tests pass label May 25, 2025
@priyanshu-8789
Copy link
Copy Markdown
Author

Hi @TheAlgorithms,
I've added the Random Forest Regressor as an additional prediction model and added matplotlib library for seeing predictions vs actuals which will help non-technical users validate data easily. All checks have passed.
Could you please review and approve this pull request when convenient?
Thank you!

@poyea poyea requested review from Copilot and poyea May 18, 2026 22:04
@poyea poyea self-assigned this May 18, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the existing forecasting “voting” script by adding a Random Forest–based regressor as an additional prediction option, and introduces a small visualization helper for comparing predictions. It also updates the repository’s directory index.

Changes:

  • Add random_forest_regressor() (sklearn) and include it in the res_vote ensemble.
  • Add plot_forecast() (matplotlib) and call it from the __main__ block to visualize results.
  • Update DIRECTORY.md to add a Geometry index entry.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
machine_learning/forecasting/run.py Adds RandomForestRegressor forecasting method and a matplotlib plotting helper; integrates both into the main execution path.
DIRECTORY.md Adds a Geometry section index entry (“Segment Intersection”).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread machine_learning/forecasting/run.py
Comment thread machine_learning/forecasting/run.py
Comment thread DIRECTORY.md
return safe > not_safe


def plot_forecast(actual, predictions):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type hints required

@algorithms-keeper algorithms-keeper Bot added awaiting changes A maintainer has requested changes to this PR and removed awaiting reviews This PR is ready to be reviewed labels May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting changes A maintainer has requested changes to this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants