Skip to content

🧠 Forecast Regression Library for PHP A lightweight and extendable PHP library to fill missing numeric values using statistical regression methods β€” Linear, Power, and Logarithmic.

License

Notifications You must be signed in to change notification settings

MykolaVuy/ForecastRegressions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ˆ Forecast Regressions

PHP Version MIT License GitHub Repo

A simple and extensible library for forecasting missing data points using different regression models: Linear, Power, Logarithmic, and Exponential. Designed for PHP 8.1+.


✨ Features

  • πŸ“Š Supports Linear, Power, Logarithmic, and Exponential regression.
  • πŸ” Optional interpolation-only mode to avoid extrapolation.
  • 🧩 Pluggable architecture via RegressionInterface.
  • ⚑️ Fast, simple, and stateless static prediction:
    ForecastService::predict($data, $method)
  • βœ… Thoroughly unit-tested.

πŸ“‚ Source Code

The complete source code is available on GitHub.


πŸ›  Installation

    composer require mykolavuy/forecast-regressions

πŸš€ Usage

use MykolaVuy\Forecast\ForecastService;

$data = [
    1 => 10,
    2 => null,
    3 => 30,
    4 => null,
    5 => 50,
    6 => null,
];

$service = new ForecastService();

// Linear regression forecast
$result = $service->forecast($data, method: 'linear');

// Power regression with interpolation only
$interpolated = $service->forecast($data, method: 'power', interpolateOnly: true);

// πŸ”Ή Static call (no instance needed)
$static = ForecastService::predict($data, method: 'exponential');

πŸ”§ Regression Methods

Method Formula Description
linear y = a * x + b Straight-line fitting
power y = a * x^b Exponential-style growth/decay
logarithmic y = a + b * log(x) Logarithmic trend modeling
exponential y = a * e^(b * x) Classic exponential regression

βœ… Requirements

  • PHP 8.1 or higher
  • Composer

πŸ§ͺ Running Tests

    ./vendor/bin/phpunit

Test files are located in the tests/ directory.


πŸ“„ License

This project is licensed under the MIT License.


🌐 Projects by the Author

InTester is a secure and transparent online knowledge assessment platform. It offers time-limited tests, anti-cheating measures, instant results with PDF certificates, and public test records β€” making it ideal for job seekers and recruiters alike.

DCT Sign is a blockchain-backed electronic signature platform that prioritizes privacy and data integrity. Users can securely sign documents without storing the original files, ensuring confidentiality and compliance with advanced e-signature standards.


Thank you for using ForecastRegressions! Contributions and feedback are welcome.

About

🧠 Forecast Regression Library for PHP A lightweight and extendable PHP library to fill missing numeric values using statistical regression methods β€” Linear, Power, and Logarithmic.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages