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 estimator Learner An instance of a persistable estimator.
2 persister Persister The persister object used interface with the storage medium.

Additional Methods#

Save the persistent model to storage:

public save() : void

Load the persistent model from storage given a persister:

public static load(Persister $persister) : self


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

$estimator = new PersistentModel(new KMeans(10), new Filesystem('example.model'));
use Rubix\ML\PersistentModel;
use Rubix\ML\Persisters\Filesystem;

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

// Do something ...