PHPackages                             denissimon/prediction-builder - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. denissimon/prediction-builder

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

denissimon/prediction-builder
=============================

A library for machine learning that builds predictions using a linear regression.

v1.1.2(1y ago)1146.7k13MITPHPPHP &gt;=5.4.0

Since Aug 12Pushed 1y ago8 watchersCompare

[ Source](https://github.com/denissimon/prediction-builder)[ Packagist](https://packagist.org/packages/denissimon/prediction-builder)[ RSS](/packages/denissimon-prediction-builder/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)DependenciesVersions (7)Used By (0)

PredictionBuilder
=================

[](#predictionbuilder)

[![Latest Stable Version](https://camo.githubusercontent.com/93215817c8f8d303188f55545cdc23bd2c0be2d0ab0f8a0fea6665475ad59157/68747470733a2f2f706f7365722e707567782e6f72672f64656e697373696d6f6e2f70726564696374696f6e2d6275696c6465722f762f737461626c652e737667)](https://packagist.org/packages/denissimon/prediction-builder)[![Total Downloads](https://camo.githubusercontent.com/0021deb036c43c1dc810ddfdacf9a58af8b1ffa2563e8e55ff9154d7103d7359/68747470733a2f2f706f7365722e707567782e6f72672f64656e697373696d6f6e2f70726564696374696f6e2d6275696c6465722f646f776e6c6f616473)](https://packagist.org/packages/denissimon/prediction-builder)[![License](https://camo.githubusercontent.com/0554a41084e226a9f393b9f60fce27113b5854552f82a1aebbf2ae1e228be643/68747470733a2f2f706f7365722e707567782e6f72672f64656e697373696d6f6e2f70726564696374696f6e2d6275696c6465722f6c6963656e73652e737667)](https://github.com/denissimon/prediction-builder/blob/master/LICENSE)

PredictionBuilder is a library for machine learning that builds predictions using a linear regression.

Requirements
------------

[](#requirements)

This project requires [PHP 5.4 or higher](http://php.net) because makes use of trait and short array syntax.

Installation
------------

[](#installation)

You can install the library by [Composer](https://getcomposer.org). Add this to your project's composer.json:

```
"require": {
    "denissimon/prediction-builder": "*"
}
```

Then run `php composer.phar install` (or `composer install`).

Example
-------

[](#example)

```
use PredictionBuilder\PredictionBuilder;

require_once __DIR__ . '/vendor/autoload.php';

$data = [[1,20],[2,70],[2,45],[3,81],[5,73],[6,80],[7,110]];
$x = 4.5;

// What is the expected y value for a given x value?
try {
    $prediction = new PredictionBuilder($x, $data);
    $result = $prediction->build(); // y = 76.65
} catch (\Exception $e) {
    echo $e->getMessage(), "\n";
}
```

The returned object has the following properties:

`$result->ln_model` linear model that fits the data: "29.56362+10.46364x"

`$result->cor` correlation coefficient: 0.8348

`$result->x` given x value: 4.5

`$result->y` predicted y value: 76.65

License
-------

[](#license)

Licensed under the [MIT License](https://github.com/denissimon/prediction-builder/blob/master/LICENSE)

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~676 days

Recently: every ~717 days

Total

6

Last Release

551d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fc753f1e1b1a20f30d8672291900c452da6a9d666ef9c2ec464fb1b330b368d2?d=identicon)[denissimon](/maintainers/denissimon)

---

Top Contributors

[![denissimon](https://avatars.githubusercontent.com/u/9512458?v=4)](https://github.com/denissimon "denissimon (16 commits)")

---

Tags

composerlinear-regressionmachine-learningmlphppredictionregressionmachine learningpredictionmlregressionLinear regression

### Embed Badge

![Health badge](/badges/denissimon-prediction-builder/health.svg)

```
[![Health](https://phpackages.com/badges/denissimon-prediction-builder/health.svg)](https://phpackages.com/packages/denissimon-prediction-builder)
```

###  Alternatives

[rubix/ml

A high-level machine learning and deep learning library for the PHP language.

2.2k1.4M28](/packages/rubix-ml)[nlp-tools/nlp-tools

NlpTools is a set of php 5.3+ classes for beginner to semi advanced natural language processing work.

774645.2k5](/packages/nlp-tools-nlp-tools)[codewithkyrian/transformers

State-of-the-art Machine Learning for PHP. Run Transformers in PHP

749231.8k5](/packages/codewithkyrian-transformers)[php-ai/php-ml

PHP-ML - Machine Learning library for PHP

1061.7M12](/packages/php-ai-php-ml)[davmixcool/php-sentiment-analyzer

PHP Sentiment Analyzer is a lexicon and rule-based sentiment analysis tool that is used to understand sentiments in a sentence using VADER (Valence Aware Dictionary and sentiment Reasoner).

138151.7k1](/packages/davmixcool-php-sentiment-analyzer)[niiknow/bayes

a machine learning lib

6950.0k](/packages/niiknow-bayes)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
