Skip to content

[source]

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.

Interfaces: Estimator, Learner, Probabilistic, Scoring

Data Type Compatibility: Depends on base learner

Parameters#

# Name Default Type Description
1 base Persistable The persistable base learner.
2 persister Persister The persister used to interface with the storage system.
3 serializer RBX Serializer The object serializer.

Examples#

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

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

Additional Methods#

Load the model from storage:

public static load(Persister $persister, ?Serializer $serializer = null) : self

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

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

Save the model to storage:

public save() : void

$estimator->save();