Persistent Model#

The Persistent Model meta-estimator wraps a Persistable learner with additional functionality for saving and loading the model. It uses Persister objects to interface with various storage backends such as the Filesystem or Redis.

Interfaces: Wrapper, Estimator, Learner, Probabilistic, Ranking

Data Type Compatibility: Depends on base learner


# Param Default Type Description
1 base Persistable The persistable base learner.
2 persister Persister The persister used to interface with the storage medium.

Additional Methods#

Load the model from storage:

public static load(Persister $persister) : self

Save the model to storage:

public save() : void

Set the storage driver used to save the model:

public setPersister(Persister $persister) : void


use Rubix\ML\PersistentModel;
use Rubix\ML\Clusterers\KMeans;
use Rubix\ML\Persisters\Filesystem;

$estimator = new PersistentModel(new KMeans(10), new Filesystem('example.model'));

// Do something ...

use Rubix\ML\PersistentModel;
use Rubix\ML\Persisters\Filesystem;

$estimator = PersistentModel::load(new Filesystem('example.model'));