-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from pygod-team/dev
major refactor for 0.4.0
- Loading branch information
Showing
122 changed files
with
7,349 additions
and
9,182 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
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
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
Large diffs are not rendered by default.
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
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
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
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,15 @@ | ||
.. role:: hidden | ||
:class: hidden-section | ||
.. currentmodule:: {{ module }} | ||
|
||
{{ name | underline}} | ||
|
||
{% if objname == "ANOMALOUS" or objname == "ONE" or objname == "Radar" or objname == "SCAN"%} | ||
.. autoclass:: {{ name }} | ||
:show-inheritance: | ||
:members: fit, predict | ||
{% else %} | ||
.. autoclass:: {{ name }} | ||
:show-inheritance: | ||
:members: fit, predict, emb | ||
{% endif %} |
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,9 @@ | ||
.. role:: hidden | ||
:class: hidden-section | ||
.. currentmodule:: {{ module }} | ||
|
||
{{ name | underline}} | ||
|
||
.. autoclass:: {{ name }} | ||
:show-inheritance: | ||
:members: forward, loss_func, process_graph |
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 |
---|---|---|
@@ -1,37 +1,40 @@ | ||
API CheatSheet | ||
============== | ||
|
||
The following APIs are applicable for all detector models for easy use. | ||
The following APIs are applicable for all detectors for easy use. | ||
|
||
* :func:`pygod.models.base.BaseDetector.fit`: Fit detector. y is ignored in unsupervised methods. | ||
* :func:`pygod.models.base.BaseDetector.decision_function`: Predict raw anomaly scores of PyG Graph G using the fitted detector | ||
* :func:`pygod.detector.Detector.fit`: Fit detector. | ||
* :func:`pygod.detector.Detector.decision_function`: Predict raw anomaly scores of PyG data using the fitted detector | ||
|
||
Key Attributes of a fitted model: | ||
Key Attributes of a fitted detector: | ||
|
||
* :attr:`pygod.models.base.BaseDetector.decision_scores_`: The outlier scores of the training data. The higher, the more abnormal. | ||
Outliers tend to have higher scores. | ||
* :attr:`pygod.models.base.BaseDetector.labels_`: The binary labels of the training data. 0 stands for inliers and 1 for outliers/anomalies. | ||
* :attr:`pygod.detector.Detector.decision_score_`: The outlier scores of the input data. Outliers tend to have higher scores. | ||
* :attr:`pygod.detector.Detector.label_`: The binary labels of the input data. 0 stands for inliers and 1 for outliers. | ||
|
||
For the inductive setting: | ||
|
||
* :func:`pygod.models.base.BaseDetector.predict`: Predict if a particular sample is an outlier or not using the fitted detector. | ||
* :func:`pygod.models.base.BaseDetector.predict_proba`: Predict the probability of a sample being outlier using the fitted detector. | ||
* :func:`pygod.models.base.BaseDetector.predict_confidence`: Predict the model's sample-wise confidence (available in predict and predict_proba). | ||
|
||
* :func:`pygod.detector.Detector.predict`: Predict if a particular sample is an outlier or not using the fitted detector. | ||
|
||
**Input of PyGOD**: Please pass in a `PyTorch Geometric (PyG) <https://www.pyg.org/>`_ data object. | ||
See `PyG data processing examples <https://pytorch-geometric.readthedocs.io/en/latest/notes/introduction.html#data-handling-of-graphs>`_. | ||
|
||
* :func:`pygod.models.base.BaseDetector.process_graph` (you do not need to call this explicitly): Process the raw PyG data object into a tuple of sub data objects needed for the underlying model. | ||
|
||
|
||
See base class definition below: | ||
Base Detector | ||
------------- | ||
|
||
pygod.models.base module | ||
------------------------ | ||
``Detector`` is the abstract class for all detectors: | ||
|
||
.. automodule:: pygod.models.base | ||
.. autoclass:: pygod.detector.Detector | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
:inherited-members: | ||
:inherited-members: | ||
|
||
Deep Detector | ||
------------- | ||
|
||
By inherit ``Detector`` class, we also provide base deep detector class for deep learning based detectors to ease the implementation. | ||
|
||
.. autoclass:: pygod.detector.DeepDetector | ||
:members: emb, init_model, forward_model, process_graph | ||
:undoc-members: fit, decision_function, predict |
Oops, something went wrong.