Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path based interface #113

Open
inakleinbottle opened this issue May 25, 2021 · 0 comments
Open

Path based interface #113

inakleinbottle opened this issue May 25, 2021 · 0 comments
Assignees

Comments

@inakleinbottle
Copy link
Contributor

This is a proposal for a path based interface to esig to be the primary interface for computing signatures and log signatures. This will provide a Path class, which is initialised with some collection of data that constitutes either the increments or the values of a (rough) path. The path class will be responsible for selecting the correct underlying type of the path, and link functions to compute the signature, log signature, and various other metrics associated with the path.

Path class

The first iteration of the path class will provide functions to compute the signature and log signature to a specific depth. This class will be implemented at the Python level, and be a simple interface to various C++ level Path types that will not be available to the user. The minimal template for this class is as follows.

class Path:
    """
    Interface class for various computations involving rough paths.
    """

    def __init__(self, data, type=None):
         # Create a new instance, either deriving the underlying type
         # from the data, or using the type argument

    def signature(self, depth: int = 2, lower: Optional[int] = None, 
                  upper: Optional[int] = None) -> Signature:
        """
        Compute the signature of the path up to the given depth (default = 2). 
        Optionally restrict the range over which the signature is computed.
        """

    def log_signature(self, depth: int = 2, lower: Optional[int] = None, 
                      upper: Optional[int] = None) -> LogSignature:
        """
        Compute the log signature of the path up to the given depth (default = 2). 
        Optionally restrict the range over which the log signature is computed.
        """

The Signature and LogSignature classes indicated above are thin wrappers around the libalgebra free_tensor and lie types, respectively, that allows direct inspection and computation with these underlying objects.

This Path class should also have methods to inspect the width, data, and underlying path type (as an Enum value or similar).

Path backends

The backend paths are C++ layer classes that actually implement the various types of rough path. For instance, the basic path type is a LieIncrementPath, which simply has a list of Lie increments stored in an array. This is the type of path assumed by the tosig interface as it stands.

Other types of path that could be implemented include generated paths (where there is a definite function that defines the increment over a given width), value paths, and time indexed paths.

Old tosig interface

The tosig module currently provides a very simple interface broadly based around two functions stream2sig and stream2logsig. For the sake of backwards compatibility, the way these functions work should not change externally.
However, we can adjust the function here actually make use of the C++ paths interface to dramatically simplify the background code.

@inakleinbottle inakleinbottle self-assigned this May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant