Metadata-Version: 2.1
Name: py-pod
Version: 2.0.3
Summary: Implementation of a Proper Orthogonal Decomposition (POD) method
Author: Christophe
Author-email: christophe.alexandre@pm.me
Requires-Python: >=3.10,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: nose2 (>=0.13.0,<0.14.0)
Requires-Dist: numpy (>=1.25.2,<2.0.0)
Requires-Dist: pydoctor (>=23.4.1,<24.0.0)
Description-Content-Type: text/markdown

# Proper Orthogonal Decomposition

## Principle
The package contains a processing algorithm for decomposing an input using
a limited number of predefined signals from a bigger set.

Decomposition is performed by iterating projections onto the straight lines
generated by the reference signals.

The proposed algorithm takes a vector space approach. A signal, or more 
precisely its sequence of _N_ temporal samples, is mapped to a point *P* 
in a vector space of dimension _N_. A value taken by a signal *P* at 
sample time _t<sub>i</sub>_ becomes the coordinate of *P* along
the axis _t<sub>i</sub>_.

The set of reference signals represents a library the algorithm micks from
in order to synthetize or approximate any input. The reference points form a 
cloud in the space described above. A linear combination of appropriately 
selected reference points will approximate the target signal *S*.

## Use case: asset replication

In order to illustrate how the algorithm works, let's assume we
replicate a _fund_ using two assets _stock 1_ and _stock 2_, with
only 3 data points for past performances.

|             | Day 1 | Day 2 | Day 3 |
|-------------|-------|-------|-------|
| Stock 1     | 0.8   | 2     | 0     |
| Stock 2     | 1.2   | -0.5  | 0     |
| Fund        | 1     | -1    | 3     |
| Replication | 1     | -1    | 0     |

The chart below shows the first and final projections in the case of a 3D space:
3 daily performances for a 2 stocks-universe, plus a target fund to replicate.

The first projection is performed on the second stock (yellow), since it better
matches the fund performances than those of the first stock.

![Example showing the first and final projections in the case of a 3D space](docs/first_and_final_projections.png?raw=true "Example")

The interactive version of the chart above is available 
at [math3d.org](https://www.math3d.org/oXFLiVH54).

From a time perspective:
![Example showing the time series](docs/time-view.png?raw=true "Example")


Typical sizes for asset replication: 1000 dimensions (~5 years of daily data), 200 candidate assets
for use in replication, target portfolio with 5 assets.

## Documentation
Generated with PyDoctor:

`pydoctor --make-html --html-output=docs/api pod`


## Publication
`poetry build`

`poetry publish`

