Skip to content

Commit

Permalink
Updating README to include documentation about how to use this code.
Browse files Browse the repository at this point in the history
  • Loading branch information
drewoldag committed Dec 20, 2024
1 parent 6d05cb2 commit 5690b25
Showing 1 changed file with 63 additions and 11 deletions.
74 changes: 63 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,64 @@

# resspect_external
# External library examples for ``RESSPECT``

[![Template](https://img.shields.io/badge/Template-LINCC%20Frameworks%20Python%20Project%20Template-brightgreen)](https://lincc-ppt.readthedocs.io/en/latest/)

[![PyPI](https://img.shields.io/pypi/v/resspect_external?color=blue&logo=pypi&logoColor=white)](https://pypi.org/project/resspect_external/)
[![resspect](https://img.shields.io/badge/COIN--Focus-RESSPECT-red)](http://cosmostatistics-initiative.org/resspect/)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/lsstdesc/resspect_external/smoke-test.yml)](https://github.com/lsstdesc/resspect_external/actions/workflows/smoke-test.yml)
[![Codecov](https://codecov.io/gh/lsstdesc/resspect_external/branch/main/graph/badge.svg)](https://codecov.io/gh/lsstdesc/resspect_external)
[![Read The Docs](https://img.shields.io/readthedocs/resspect-external)](https://resspect-external.readthedocs.io/)
[![Template](https://img.shields.io/badge/Template-LINCC%20Frameworks%20Python%20Project%20Template-brightgreen)](https://lincc-ppt.readthedocs.io/en/latest/)

This project was automatically generated using the LINCC-Frameworks
[python-project-template](https://github.com/lincc-frameworks/python-project-template).
<!-- [![Codecov](https://codecov.io/gh/lsstdesc/resspect_external/branch/main/graph/badge.svg)](https://codecov.io/gh/lsstdesc/resspect_external)
[![Read The Docs](https://img.shields.io/readthedocs/resspect-external)](https://resspect-external.readthedocs.io/) -->

A repository badge was added to show that this project uses the python-project-template, however it's up to
you whether or not you'd like to display it!

For more information about the project template see the
[documentation](https://lincc-ppt.readthedocs.io/en/latest/).
This collection of example classes demonstrates the minimum code needed to define
the various plugin classes that ``RESSPECT`` supports. For more information about
``RESSPECT`` please see the following:
* Repository: https://github.com/lsstdesc/resspect
* ReadTheDocs: https://lsst-resspect.readthedocs.io/en/latest/

Feel free to copy or fork this repository as a way to get started using an externally
defined feature extractor, classifier, or query strategy for ``RESSPECT``.

Note that it is not a requirement to implement all three example classes, they
are simply grouped together here to be concise. Implementing only one or two of
the different classes shown here is completely acceptable.

## Example usage of externally library

``RESSPECT`` has two primary function to drive active learning:
* ``learn_loop`` ([link](https://github.com/LSSTDESC/RESSPECT/blob/6e1396bdf83c495fea3f9752887db8fcd36b68b0/src/resspect/learn_loop.py#L288))
* ``time_domain_loop`` ([link](https://github.com/LSSTDESC/RESSPECT/blob/6e1396bdf83c495fea3f9752887db8fcd36b68b0/src/resspect/time_domain_loop.py#L805))

To define the use of an external class and organize the large number of input
parameters necessary for each of these a configuration class is used, either:
``LoopConfiguration`` ([link](https://github.com/LSSTDESC/RESSPECT/blob/6e1396bdf83c495fea3f9752887db8fcd36b68b0/src/resspect/loop_configuration.py#L8)) for ``learn_loop`` or,
``TimeDomainConfiguration`` ([link](https://github.com/LSSTDESC/RESSPECT/blob/6e1396bdf83c495fea3f9752887db8fcd36b68b0/src/resspect/time_domain_configuration.py#L8C7-L8C30)) for ``time_domain_loop``.

To make use of an externally defined feature extractor, classifier, or query
strategy, simply define the class to be used in the configuration object. The
following example shows how to use the libpath to specify which of the external
classes ``RESSPECT`` should use when running ``learn_loop``.

```python
from resspect.loop_configuration import LoopConfiguration
from resspect.learn_loop import learn_loop

# Define the loop configuration
loop_config = LoopConfiguration(
# ... preceding parameters
strategy='resspect_external.example_query_strategy.ExampleQueryStrategy',
classifier='resspect_external.example_classifier.ExampleClassifier',
features_method='resspect_external.example_feature_extractor.ExampleFeatureExtractor',
# ... additional parameters
)

# Use loop configuration to call active learning loop
learn_loop(loop_config)
```

Note in this example code, we instruct ``RESSPECT`` to make use of the
``ExampleFeatureExtractor`` as well as the ``ExampleClassifier`` and ``ExampleQueryStrategy``
classes by providing the libpath string as the parameters.

## Dev Guide - Getting Started

Expand Down Expand Up @@ -46,3 +89,12 @@ Notes:
into documentation for ReadTheDocs works as expected. For more information, see
the Python Project Template documentation on
[Sphinx and Python Notebooks](https://lincc-ppt.readthedocs.io/en/latest/practices/sphinx.html#python-notebooks)


## Acknoledgements

This project was automatically generated using the LINCC-Frameworks
[python-project-template](https://github.com/lincc-frameworks/python-project-template).

For more information about the project template see the
[documentation](https://lincc-ppt.readthedocs.io/en/latest/).

0 comments on commit 5690b25

Please sign in to comment.