PHPackages                             antoniogweb/php2xai-mnist - 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. antoniogweb/php2xai-mnist

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

antoniogweb/php2xai-mnist
=========================

MNIST classification exercise built on PHP2xAI.

v0.3.0(3mo ago)06GPL-3.0-onlyPHPPHP &gt;=8.1

Since Jan 7Pushed 2mo agoCompare

[ Source](https://github.com/antoniogweb/PHP2xAI-mnist)[ Packagist](https://packagist.org/packages/antoniogweb/php2xai-mnist)[ RSS](/packages/antoniogweb-php2xai-mnist/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (6)Used By (0)

PHP2xAI MNIST
=============

[](#php2xai-mnist)

MNIST classification exercise built on PHP2xAI. The project demonstrates dataset preprocessing in PHP, configuration of the computational graph, and training orchestration, while model training and inference are executed by the C++ runtime.

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

[](#installation)

```
composer create-project antoniogweb/php2xai-mnist
```

Training
--------

[](#training)

Run the script from `src/`:

```
cd src
php train.php
```

What it does:

- Reads data from `src/DataLabelInt/Training/train.txt` and `src/DataLabelInt/Training/test.txt`.
- Trains the model and saves weights to `src/weights.json`.

PHP or C++ runtime:

- In `src/train.php` you will find `setRuntime("CPP")`: it uses the C++ runtime.
- To use the PHP runtime, replace it with `setRuntime("PHP")` or remove the call.

Batch size:

- The second argument of `StreamFileDataset` controls the batch size.
- In `src/train.php`, edit `new StreamFileDataset($path."/train.txt", 1024)` (and the validation dataset if needed).

Validation
----------

[](#validation)

Run the script from `src/`:

```
cd src
php validate.php
```

What it does:

- Loads the model from `src/model.json` and weights from `src/weights.json`.
- Computes accuracy and inference time on the test set.

PHP or C++ runtime:

- In `src/validate.php` you will find `setRuntime("CPP")`: it uses the C++ runtime.
- To use the PHP runtime, replace it with `setRuntime("PHP")` or remove the call.

Notes
-----

[](#notes)

- If you don't have `train.txt` and `test.txt` yet, generate them with `src/create_data_one_file.php` (requires images in `src/images/`).

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance89

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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 ~9 days

Total

4

Last Release

92d ago

### Community

Maintainers

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

---

Top Contributors

[![antoniogweb](https://avatars.githubusercontent.com/u/42380880?v=4)](https://github.com/antoniogweb "antoniogweb (20 commits)")

### Embed Badge

![Health badge](/badges/antoniogweb-php2xai-mnist/health.svg)

```
[![Health](https://phpackages.com/badges/antoniogweb-php2xai-mnist/health.svg)](https://phpackages.com/packages/antoniogweb-php2xai-mnist)
```

PHPackages © 2026

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