Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Agents
rubix/ml
claude-code
cursor
php
cart
analytics
classification
Algorithm
inference
data mining
dataset
artificial intelligence
recommendation
Neural network
classifier
etl
nlp
machine learning
prediction
svm
ml
ranking
ensemble
natural language processing
clustering
regression
ai
image recognition
k-means
Rubix
Linear regression
kmeans
data science
Deep learning
feature extraction
knn
nearest neighbors
TF-IDF
estimator
ward
naive bayes
predictive modeling
anomaly detection
manifold learning
dimensionality reduction
cross validation
k-nearest neighbors
adaboost
dbscan
feature selection
feature importance
gaussian mixture
gmm
gradient boost
grid search
imputation
isolation forest
loda
local outlier factor
logistic regression
mean shift
multilayer perceptron
php ml
random forest
regressor
rubixml
rubix ml
support vector machine
t-sne
tsne
outlier detection
php machine learning
text mining
tf idf
gbm
softmax
lof
ridge
supervised learning
unsupervised learning
mlp
php ai

A high-level machine learning and deep learning library with 40+ learning algorithms including ETL and cross-validation for the PHP language.

Install
php artisan boost:add-skill rubix/ml

Save this content to: AGENTS.md

# Rubix ML

A high-level machine learning and deep learning library with 40+ learning algorithms including ETL and cross-validation for the PHP language.

## Documentation

The project documentation is located in the `/docs` folder in the project root.

## Requirements

- [PHP](https://php.net/manual/en/install.php) 8.3 or above.
- [Tensor 4.1+ extension](https://github.com/RubixML/Tensor) for fast Matrix/Vector computing.
- [Swoole extension](https://openswoole.com/) for multiprocessing support.
- [GD extension](https://php.net/manual/en/book.image.php) for image support.
- [Mbstring extension](https://www.php.net/manual/en/book.mbstring.php) for fast multibyte string manipulation.
- [SVM extension](https://php.net/manual/en/book.svm.php) for Support Vector Machine engine (libsvm).
- [PDO extension](https://www.php.net/manual/en/book.pdo.php) for relational database support.
- [GraphViz](https://graphviz.org/) for graph visualization.

## Composer Commands

| Command | Action |
| --- | --- |
| `composer test` | Run full PHPUnit testing suite |
| `composer analyze` | PHPStan static analysis |
| `composer check` | PHP-CS-Fixer dry-run (style check) |
| `composer fix` | PHP code style auto-fixer |
| `composer benchmark` | Run full PHPBench benchmarking suite |
| `composer coverage` | Analyze test coverage |
| `composer build` | Full pipeline: install → analyze → test → check |

## Folder and Namespace Structure

Namespace `Rubix\ML` autoloaded from `src/`.

```text
src/          →  Rubix\ML\*          (PSR-4)
tests/        →  Rubix\ML\Tests\*    (PHPUnit, mirrors src/)
benchmarks/   →  Rubix\ML\Benchmarks\* (PHPBench, mirrors src/)
docs/         →  MkDocs documentation
```

### Core Interfaces

`Estimator`, `Learner`, `Online`, `Parallel`, `Probabilistic`, `Persistable`, `Verbose`, `RanksFeatures`, `Scoring`

### High-level data types

Rubix ML uses a high-level type system. Strings and integers are considered `categorical` and floats are considered `continuous`.

### Estimator Types

- **Classifiers** (15): AdaBoost, RandomForest, SVC, LogisticRegression, MLP, KNN, NaiveBayes, etc.
- **Regressors** (10): GradientBoost, Ridge, SVR, RegressionTree, Adaline, KNNRegressor, etc.
- **Clusterers** (6): KMeans, KMedoids, DBSCAN, GaussianMixture, MeanShift, FuzzyCMeans
- **Anomaly Detectors** (7): IsolationForest, LOF, OneClassSVM, GaussianMLE, Loda, RobustZScore

## Coding Conventions

- PSR-2 with extended rules (enforced by PHP-CS-Fixer, see `.php-cs-fixer.dist.php`)
- DocBlock on every class, property, method, constant, and function
- No anonymous classes or functions (breaks serialization/persistence)
- Prefer protected over private members of classes to encourage extension
- Objects are *generally* immutable — state mutation only through a well-defined public API
- Domain-driven naming — names reflect the ML domain
- No inline comments — use expressive syntax and abstractions instead
- Single quotes for strings, short array syntax (`[]`)
- Prefer pre-increment (`++$i`) over post-increment where possible
- No superfluous `else`/`return` constructs
- Bugfixes should include a test that reproduces the bug before the fix
- Optimizations should include a before and after benchmark
- Include documentation updates for changes that effect the public API
- Class members annotated `internal` are not part of the public API
- Verify changes by running tests, static analysis, and code style fixer

## Example Workflows

### Adding a New Estimator

1. Create class in `src/Classifiers/`, `src/Regressors/`, `src/AnomalyDetectors/`, or `src/Clusterers/`
2. Implement the appropriate interface(s) — `Estimator` + `Learner` (or `Online`) at minimum
3. Create PHPUnit test in `tests/` with `#[CoversClass]` attribute
4. For learners: end-to-end test — generate synthetic data, train, validate against minimum score; seed the RNG for determinism
5. Create benchmark in `benchmarks/`
6. Run `composer analyze && composer test && composer fix`
7. Add documentation page under `docs/`

### Adding a New Transformer

1. Create class in `src/Transformers/` implementing the `Transformer` interface
2. Create PHPUnit test in `tests/Transformers/`
3. Add documentation page under `docs/transformers/`

### Adding a New Neural Net Component

- Layers → `src/NeuralNet/Layers/`
- Activation functions → `src/NeuralNet/ActivationFunctions/`
- Cost functions → `src/NeuralNet/CostFunctions/`
- Optimizers → `src/NeuralNet/Optimizers/`
- Initializers → `src/NeuralNet/Initializers/`

### Building Documentation

```sh
pip install mike mkdocs mkdocs-material mkdocs-git-revision-date-localized-plugin
mike deploy 'VERSION'
mike serve
```

## CI

GitHub Actions (`.github/workflows/ci.yml`) runs on push/PR: phpstan → phpunit → php-cs-fixer check.

Rubix ML

A high-level machine learning and deep learning library with 40+ learning algorithms including ETL and cross-validation for the PHP language.

Documentation

The project documentation is located in the /docs folder in the project root.

Requirements

Composer Commands

Command Action
composer test Run full PHPUnit testing suite
composer analyze PHPStan static analysis
composer check PHP-CS-Fixer dry-run (style check)
composer fix PHP code style auto-fixer
composer benchmark Run full PHPBench benchmarking suite
composer coverage Analyze test coverage
composer build Full pipeline: install → analyze → test → check

Folder and Namespace Structure

Namespace Rubix\ML autoloaded from src/.

src/          →  Rubix\ML\*          (PSR-4)
tests/        →  Rubix\ML\Tests\*    (PHPUnit, mirrors src/)
benchmarks/   →  Rubix\ML\Benchmarks\* (PHPBench, mirrors src/)
docs/         →  MkDocs documentation

Core Interfaces

Estimator, Learner, Online, Parallel, Probabilistic, Persistable, Verbose, RanksFeatures, Scoring

High-level data types

Rubix ML uses a high-level type system. Strings and integers are considered categorical and floats are considered continuous.

Estimator Types

  • Classifiers (15): AdaBoost, RandomForest, SVC, LogisticRegression, MLP, KNN, NaiveBayes, etc.
  • Regressors (10): GradientBoost, Ridge, SVR, RegressionTree, Adaline, KNNRegressor, etc.
  • Clusterers (6): KMeans, KMedoids, DBSCAN, GaussianMixture, MeanShift, FuzzyCMeans
  • Anomaly Detectors (7): IsolationForest, LOF, OneClassSVM, GaussianMLE, Loda, RobustZScore

Coding Conventions

  • PSR-2 with extended rules (enforced by PHP-CS-Fixer, see .php-cs-fixer.dist.php)
  • DocBlock on every class, property, method, constant, and function
  • No anonymous classes or functions (breaks serialization/persistence)
  • Prefer protected over private members of classes to encourage extension
  • Objects are generally immutable — state mutation only through a well-defined public API
  • Domain-driven naming — names reflect the ML domain
  • No inline comments — use expressive syntax and abstractions instead
  • Single quotes for strings, short array syntax ([])
  • Prefer pre-increment (++$i) over post-increment where possible
  • No superfluous else/return constructs
  • Bugfixes should include a test that reproduces the bug before the fix
  • Optimizations should include a before and after benchmark
  • Include documentation updates for changes that effect the public API
  • Class members annotated internal are not part of the public API
  • Verify changes by running tests, static analysis, and code style fixer

Example Workflows

Adding a New Estimator

  1. Create class in src/Classifiers/, src/Regressors/, src/AnomalyDetectors/, or src/Clusterers/
  2. Implement the appropriate interface(s) — Estimator + Learner (or Online) at minimum
  3. Create PHPUnit test in tests/ with #[CoversClass] attribute
  4. For learners: end-to-end test — generate synthetic data, train, validate against minimum score; seed the RNG for determinism
  5. Create benchmark in benchmarks/
  6. Run composer analyze && composer test && composer fix
  7. Add documentation page under docs/

Adding a New Transformer

  1. Create class in src/Transformers/ implementing the Transformer interface
  2. Create PHPUnit test in tests/Transformers/
  3. Add documentation page under docs/transformers/

Adding a New Neural Net Component

  • Layers → src/NeuralNet/Layers/
  • Activation functions → src/NeuralNet/ActivationFunctions/
  • Cost functions → src/NeuralNet/CostFunctions/
  • Optimizers → src/NeuralNet/Optimizers/
  • Initializers → src/NeuralNet/Initializers/

Building Documentation

pip install mike mkdocs mkdocs-material mkdocs-git-revision-date-localized-plugin
mike deploy 'VERSION'
mike serve

CI

GitHub Actions (.github/workflows/ci.yml) runs on push/PR: phpstan → phpunit → php-cs-fixer check.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console