Skip to content

Commit

Permalink
Anomaly detection; Surface the isolation forest learner and model in …
Browse files Browse the repository at this point in the history
…the python API (part 9)

PiperOrigin-RevId: 644093348
  • Loading branch information
achoum authored and copybara-github committed Jun 17, 2024
1 parent aa9fcdd commit 78190b2
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions documentation/public/docs/py_api/IsolationForestLearner
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[TOC]

::: ydf.IsolationForestLearner
3 changes: 3 additions & 0 deletions documentation/public/docs/py_api/IsolationForestModel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[TOC]

::: ydf.IsolationForestModel
2 changes: 2 additions & 0 deletions documentation/public/docs/py_api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ A **Learner** trains models and can be cross-validated.
- [DecisionTreeLearner](CartLearner.md): Alias to
[CartLearner](CartLearner.md).
- [DistributedGradientBoostedTreesLearner](DistributedGradientBoostedTreesLearner.md)
- [IsolationForestLearner](IsolationForestLearner.md)

All learners derive from [GenericLearner](GenericLearner.md).

Expand All @@ -29,6 +30,7 @@ arguments of learner classes.
- [RandomForestModel](RandomForestModel.md)
- [CARTModel](RandomForestModel.md): Alias to
[RandomForestModel](RandomForestModel.md).
- [IsolationForestModel](IsolationForestModel.md)

All models derive from [GenericModel](GenericModel.md).

Expand Down
1 change: 1 addition & 0 deletions yggdrasil_decision_forests/port/python/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Feature

- Add support for Isolation Forests model.
- Add `max_depth` argument to `model.print_tree`.
- Add `verbose` argument to `train` method which is equivalent but sometime
more convenient than`ydf.verbose`.
Expand Down
3 changes: 3 additions & 0 deletions yggdrasil_decision_forests/port/python/ydf/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ py_library(
"//ydf/model:model_lib",
"//ydf/model:model_metadata",
"//ydf/model/gradient_boosted_trees_model",
"//ydf/model/isolation_forest_model",
"//ydf/model/random_forest_model",
"//ydf/model/tree:all",
"//ydf/utils:log",
Expand Down Expand Up @@ -56,6 +57,7 @@ py_library(
"@ydf_cc//yggdrasil_decision_forests/learner/gradient_boosted_trees/early_stopping:early_stopping_snapshot_py_proto",
"@ydf_cc//yggdrasil_decision_forests/learner/hyperparameters_optimizer:hyperparameters_optimizer_py_proto",
"@ydf_cc//yggdrasil_decision_forests/learner/hyperparameters_optimizer/optimizers:random_py_proto",
"@ydf_cc//yggdrasil_decision_forests/learner/isolation_forest:isolation_forest_py_proto",
"@ydf_cc//yggdrasil_decision_forests/learner/multitasker:multitasker_py_proto",
"@ydf_cc//yggdrasil_decision_forests/learner/random_forest:random_forest_py_proto",
"@ydf_cc//yggdrasil_decision_forests/metric:metric_py_proto",
Expand All @@ -64,6 +66,7 @@ py_library(
"@ydf_cc//yggdrasil_decision_forests/model:prediction_py_proto",
"@ydf_cc//yggdrasil_decision_forests/model/decision_tree:decision_tree_py_proto",
"@ydf_cc//yggdrasil_decision_forests/model/gradient_boosted_trees:gradient_boosted_trees_py_proto",
"@ydf_cc//yggdrasil_decision_forests/model/isolation_forest:isolation_forest_py_proto",
"@ydf_cc//yggdrasil_decision_forests/model/multitasker:multitasker_py_proto",
"@ydf_cc//yggdrasil_decision_forests/model/random_forest:random_forest_py_proto",
"@ydf_cc//yggdrasil_decision_forests/serving:serving_py_proto",
Expand Down
2 changes: 2 additions & 0 deletions yggdrasil_decision_forests/port/python/ydf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ def _check_install():
from ydf.learner.specialized_learners import RandomForestLearner
from ydf.learner.specialized_learners import GradientBoostedTreesLearner
from ydf.learner.specialized_learners import DistributedGradientBoostedTreesLearner
from ydf.learner.specialized_learners import IsolationForestLearner

DecisionTreeLearner = CartLearner

# Model
from ydf.model.generic_model import GenericModel
from ydf.model.random_forest_model.random_forest_model import RandomForestModel
from ydf.model.gradient_boosted_trees_model.gradient_boosted_trees_model import GradientBoostedTreesModel
from ydf.model.isolation_forest_model.isolation_forest_model import IsolationForestModel
# A CART model is a Random Forest with a single tree
CARTModel = RandomForestModel

Expand Down

0 comments on commit 78190b2

Please sign in to comment.