-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feat/thresholded_relu
- Loading branch information
Showing
60 changed files
with
7,860 additions
and
538 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
docs/framework/operators/machine-learning/tree-classifier/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Tree Classifier | ||
|
||
`TreeClassifierTrait` provides a trait definition for decision tree classifier. This trait offers functionalities to build a decision tree and predict target values based on input features. | ||
|
||
```rust | ||
use orion::operators::ml::TreeClassifierTrait; | ||
``` | ||
|
||
### Data types | ||
|
||
Orion supports currently only fixed point data types for `TreeClassifierTrait`. | ||
|
||
| Data type | dtype | | ||
| -------------------- | ------------------------------------------------------------- | | ||
| Fixed point (signed) | `TreeClassifierTrait<FP8x23 \| FP16x16 \| FP64x64 \| FP32x32>` | | ||
|
||
*** | ||
|
||
| function | description | | ||
| --- | --- | | ||
| [`tree.predict`](tree.predict.md) | Given a set of features, predicts the target value using the constructed decision tree. | | ||
| [`tree.predict_proba`](tree.predict\_proba.md) | Predicts class probabilities based on feature data. | | ||
|
35 changes: 35 additions & 0 deletions
35
docs/framework/operators/machine-learning/tree-classifier/tree.predict.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# TreeClassifierTrait::predict | ||
|
||
```rust | ||
fn predict(ref self: TreeClassifier<T>, features: Span<T>) -> T; | ||
``` | ||
|
||
Predicts the target value for a set of features using the provided decision tree. | ||
|
||
## Args | ||
|
||
* `self`: A reference to the decision tree used for making the prediction. | ||
* `features`: A span representing the features for which the prediction is to be made. | ||
|
||
## Returns | ||
|
||
The predicted target value. | ||
|
||
## Type Constraints | ||
|
||
Constrain input and output types to fixed point. | ||
|
||
## Examples | ||
|
||
```rust | ||
use orion::operators::ml::{FP16x16TreeClassifier, TreeClassifierTrait, TreeClassifier}; | ||
use orion::numbers::{FP16x16, FixedTrait}; | ||
|
||
fn tree_classifier_example(tree: TreeClassifier<FP16x16>) { | ||
|
||
tree.predict( | ||
array![FixedTrait::new_unscaled(1, false), FixedTrait::new_unscaled(2, false),].span() | ||
); | ||
|
||
} | ||
``` |
38 changes: 38 additions & 0 deletions
38
docs/framework/operators/machine-learning/tree-classifier/tree.predict_proba.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# TreeClassifierTrait::predict_proba | ||
|
||
```rust | ||
fn predict_proba(ref self: TreeClassifier<T>, features: Span<T>) -> Span<T>; | ||
``` | ||
|
||
Given a set of features, this method traverses the decision tree | ||
represented by `self` and returns the class distribution (probabilities) | ||
found in the leaf node that matches the provided features. The traversal | ||
stops once a leaf node is reached in the decision tree. | ||
|
||
## Args | ||
|
||
* `self`: A reference to the decision tree used for making the prediction. | ||
* `features`: A span representing the features for which the prediction is to be made. | ||
|
||
## Returns | ||
|
||
Returns a `Span<T>` representing the class distribution at the leaf node. | ||
|
||
## Type Constraints | ||
|
||
Constrain input and output types to fixed points. | ||
|
||
## Examples | ||
|
||
```rust | ||
use orion::operators::ml::{FP16x16TreeClassifier, TreeClassifierTrait, TreeClassifier}; | ||
use orion::numbers::{FP16x16, FixedTrait}; | ||
|
||
fn tree_classifier_example(tree: TreeClassifier<FP16x16>) { | ||
|
||
tree.predict_proba( | ||
array![FixedTrait::new_unscaled(1, false), FixedTrait::new_unscaled(2, false),].span() | ||
); | ||
|
||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 0 additions & 50 deletions
50
docs/framework/operators/machine-learning/tree-regressor/tree.fit.md
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
docs/framework/operators/machine-learning/xgboost-regressor/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Tree Regressor | ||
|
||
`XGBoostRegressorTrait` provides a trait definition for xgboost regression. This trait offers functionalities to predict target values based on input features. | ||
|
||
```rust | ||
use orion::operators::ml::XGBoostRegressorTrait; | ||
``` | ||
|
||
### Data types | ||
|
||
Orion supports currently only fixed point data types for `XGBoostRegressorTrait`. | ||
|
||
| Data type | dtype | | ||
| -------------------- | ------------------------------------------------------------- | | ||
| Fixed point (signed) | `TreeRegressorTrait<FP8x23 \| FP16x16 \| FP64x64 \| FP32x32>` | | ||
|
||
*** | ||
|
||
| function | description | | ||
| --- | --- | | ||
| [`xgboost.predict`](xgboost.predict.md) | Predicts the target value for a set of features using the provided ensemble of decision trees. | | ||
|
44 changes: 44 additions & 0 deletions
44
docs/framework/operators/machine-learning/xgboost-regressor/xgboost.predict.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# XGBoostRegressorTrait::predict | ||
|
||
```rust | ||
fn predict(ref self: Span<TreeNode<T>>, ref features: Span<T>, ref weights: Span<T>) -> T; | ||
``` | ||
|
||
Predicts the target value for a set of features using the provided ensemble of decision trees | ||
and combining their results using given weights. | ||
|
||
## Args | ||
|
||
* `self`: A reference to a span representing a ensemble of decision trees. | ||
* `features`: A reference to a span representing the features for which the prediction is to be made. | ||
* `weights`: A reference to a span representing the weights applied to the predictions from each tree. | ||
|
||
## Returns | ||
|
||
The predicted target value. | ||
|
||
## Type Constraints | ||
|
||
Constrain input and output types to fixed point. | ||
|
||
## Examples | ||
|
||
```rust | ||
use orion::operators::ml::{FP16x16XGBoostRegressor, TreeRegressorTrait, TreeRegressor}; | ||
use orion::numbers::{FP16x16, FixedTrait}; | ||
|
||
fn xgboost_regressor_example(trees: Span<TreeRegressor<FP16x16>>) { | ||
|
||
let mut features = array![ | ||
FixedTrait::new_unscaled(1, false), | ||
FixedTrait::new_unscaled(2, false), | ||
].span(); | ||
|
||
let mut weights = array![ | ||
FixedTrait::new_unscaled(0.5, false), | ||
FixedTrait::new_unscaled(0.5, false) | ||
].span(); | ||
|
||
FP16x16XGBoostRegressor::predict(ref trees, ref features, ref weights); | ||
} | ||
``` |
Oops, something went wrong.