[source]

Persistent Model#

The Persistent Model wrapper gives the estimator two additional methods (save() and load()) that allow a Persistable learner to be saved and loaded from storage.

Interfaces: Estimator, Learner, Probabilistic

Data Type Compatibility: Depends on base learner

Parameters#

# Param Default Type Description
1 base object An instance of the base estimator to be persisted.
2 persister object The persister object used to store the model data.

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

Example#

use Rubix\ML\PersistentModel;
use Rubix\ML\Classifiers\RandomForest;
use Rubix\ML\Persisters\Filesystem;
use Rubix\ML\Persisters\Serializers\Native;

$persister = new Filesystem('random_forest.model', true, new Native());

$estimator = new PersistentModel(new RandomForest(100), $persister);

// Train the learner

$estimator->save();