You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/basic-introduction.md
+11-10
Original file line number
Diff line number
Diff line change
@@ -67,7 +67,7 @@ We can verify that the learner has been trained by calling the `trained()` metho
67
67
var_dump($estimator->trained());
68
68
```
69
69
70
-
```sh
70
+
```
71
71
bool(true)
72
72
```
73
73
@@ -96,16 +96,17 @@ $dataset = new Unlabeled($samples);
96
96
97
97
$predictions = $estimator->predict($dataset);
98
98
99
-
var_dump($predictions);
99
+
print_r($predictions);
100
100
```
101
101
102
-
```sh
103
-
array(4) {
104
-
[0] =>'married'
105
-
[1] =>'divorced'
106
-
[2] =>'divorced'
107
-
[4] =>'married'
108
-
}
102
+
```php
103
+
Array
104
+
(
105
+
[0] => married
106
+
[1] => divorced
107
+
[2] => divorced
108
+
[3] => married
109
+
)
109
110
```
110
111
111
112
The output of the estimator are the predicted class labels of the unknown samples. We could either trust these predictions as-is or we could proceed to further evaluate the model. In the next section, we'll learn how to test its accuracy using a process called cross validation.
@@ -152,4 +153,4 @@ The return value is the accuracy score which can be interpreted as the degree to
152
153
More info can be found in the [Cross Validation](cross-validation.md) section of the docs.
153
154
154
155
## Next Steps
155
-
Congratulations! You've completed the basic introduction to machine learning in PHP with Rubix ML. For a more in-depth tutorial using the K Nearest Neighbors classifier and a real dataset, check out the [Divorce Predictor](https://github.com/RubixML/Divorce) tutorial and example project. Have fun!
156
+
Congratulations! You've completed the basic introduction to machine learning in PHP with Rubix ML. For a more in-depth tutorial using the K Nearest Neighbors classifier and a real dataset, check out the [Divorce Predictor](https://github.com/RubixML/Divorce) tutorial and example project. Have fun!
In distinction to manual tuning, Hyper-parameter optimization is an AutoML technique that employs search and meta-learning strategies to explore various algorithm configurations. In Rubix ML, hyper-parameter optimizers are implemented as meta-estimators that wrap a base learner whose hyper-parameters we wish to optimize.
28
32
@@ -58,7 +62,7 @@ We can also dump the selected hyper-parameters by calling the `params()` method
Copy file name to clipboardExpand all lines: docs/model-persistence.md
+5-7
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
Model persistence is the ability to save and subsequently load a learner's state in another process. Trained estimators can be used for real-time inference by loading the model onto a server or they can be saved to make predictions in batches offline at a later time. Estimators that implement the [Persistable](persistable.md) interface are able to have their internal state captured between processes. In addition, the library provides the [Persistent Model](persistent-model.md) meta-estimator that acts as a wrapper for persistable estimators.
3
3
4
4
## Serialization
5
-
Serialization occurs in between saving and loading a model and can be thought of as packaging the model's parameters. The data can be in a lightweight format such as with PHP's [Native](serializers/native.md) serializer or in a more robust format such as with the library's own [RBX](serializers/rbx.md) serializer. In the this example, we'll demonstrate how to encode a Persistable learner using the compressed RBX format, save the encoding with a [Persister](persisters/api.md), and then how to deserialize the encoding.
5
+
Serialization occurs in between saving and loading a model and can be thought of as packaging the model's parameters. The data can be in a lightweight format such as with PHP's [Native](serializers/native.md) serializer or in a robust format such as [RBX](serializers/rbx.md). In the this example, we'll demonstrate how to encode a Persistable learner using the compressed RBX format, save the encoding with a [Persister](persisters/api.md), and then how to deserialize the encoding.
6
6
7
7
```php
8
8
use Rubix\ML\Classifiers\RandomForest;
@@ -15,13 +15,11 @@ $serializer = new RBX();
15
15
16
16
$encoding = $serializer->serialize($estimator);
17
17
18
-
19
-
20
18
$estimator = $serializer->deserialize($encoding);
21
19
```
22
20
23
21
!!! note
24
-
Due to a limitation in PHP, anonymous classes and functions (*closures*) are not able to be deserialized. Avoid adding anonymous classes or functions to an object that you intend to persist.
22
+
Due to a limitation in PHP, anonymous classes and functions (*closures*) are not able to be deserialized. Therefore, avoid anonymous classes or functions if you intend to persist the model.
25
23
26
24
## Persistent Model Meta-estimator
27
25
The persistence subsystem can be interfaces at a low level with Serializer and Persister objects or it can be interacted with at a higher level using the [Persistent Model](persistent-model.md) meta-estimator. It is a decorator that provides `save()` and `load()` methods giving the estimator the ability to save and load itself.
@@ -38,7 +36,7 @@ $estimator->save();
38
36
```
39
37
40
38
## Persisting Transformers
41
-
In addition to Learners, the persistence subsystem can be used to individually save and load any Stateful transformer that implements the [Persistable](persistable.md) interface. In the example below we'll fit a transformer to a dataset and then save it to the [Filesystem](persisters/filesystem.md).
39
+
In addition to Learners, the persistence subsystem can be used to individually save and load any Stateful transformer that implements the [Persistable](persistable.md) interface. In the example below we'll fit a transformer to a dataset and then save it to the [Filesystem](persisters/filesystem.md).
42
40
43
41
```php
44
42
use Rubix\ML\Transformers\OneHotEncoder;
@@ -47,10 +45,10 @@ use Rubix\ML\Persisters\Filesystem;
An estimator that implements the Persistable interface can be saved and loaded by a [Persister](persisters/api.md) object or using the [Persistent Model](persistent-model.md) meta-estimator. The interface provides no additional methods otherwise.
2
+
An estimator that implements the Persistable interface can be serialized by a [Serializer](serializers/api.md) or save and loaded using the [Persistent Model](persistent-model.md) meta-estimator.
0 commit comments