1<span style="float:right;"><a href="https://github.com/RubixML/ML/blob/master/src/PersistentModel.php">[source]</a></span>
2
3# Persistent Model
4The Persistent Model meta-estimator wraps a [Persistable](persistable.md) learner with additional functionality for saving and loading the model. It uses [Persister](persisters/api.md) objects to interface with various storage backends such as the [Filesystem](persisters/filesystem.md) or [Redis](persisters/redis-db.md).
5
6**Interfaces:** [Wrapper](wrapper.md), [Estimator](estimator.md), [Learner](learner.md), [Probabilistic](probabilistic.md), [Scoring](scoring.md)
7
8**Data Type Compatibility:** Depends on base learner
9
10## Parameters
11| # | Name | Default | Type | Description |
12|---|---|---|---|---|
13| 1 | base | | Persistable | The persistable base learner. |
14| 2 | persister | | Persister | The persister used to interface with the storage medium. |
15
16## Examples
17```php
18use Rubix\ML\PersistentModel;
19use Rubix\ML\Clusterers\KMeans;
20use Rubix\ML\Persisters\Filesystem;
21
22$estimator = new PersistentModel(new KMeans(10), new Filesystem('example.model'));
23```
24
25## Additional Methods
26Load the model:
27```php
28public static load(Persister $persister) : self
29```
30
31```php
32use Rubix\ML\PersistentModel;
33use Rubix\ML\Persisters\Filesystem;
34
35$estimator = PersistentModel::load(new Filesystem('example.model'));
36```
37
38Save the model:
39```php
40public save() : void
41```
42
43```php
44$estimator->save();
45```
46