| Name | StreamingWavelet JSON |
| Version |
1.0.6
JSON |
| download |
| home_page | https://github.com/ZinYY/StreamingWavelet |
| Summary | This is an implementation for Streaming Wavelet Operator, which sequentially apply wavelet transform to a sequence efficiently. Reference: Qian et al., Efficient Non-stationary Online Learning by Wavelets with Applications to Online Distribution Shift Adaptation. In Proceedings of the 41st International Conference on Machine Learning (ICML 2024). |
| upload_time | 2024-08-12 13:07:02 |
| maintainer | None |
| docs_url | None |
| author | Yu-Yang Qian |
| requires_python | None |
| license | MIT |
| keywords |
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# Python implementation for _Streaming Wavelet Operator_
This is the python implementation for the Streaming Wavelet Operator, which **sequentially**
applies wavelet transform to a sequence efficiently in an online manner (instead of recalculation in each round).
The **speed** of the Streaming Wavelet Operator is much faster than the traditional wavelet transform for streaming data,
especially for long signals, due to its use of lazy updates and bit-wise operations in the implementation.
You can install the `StreamingWavelet` package in [https://pypi.org/project/StreamingWavelet/](https://pypi.org/project/StreamingWavelet/).
We will first introduce the structure and requirements of the code, followed by a brief instruction for a quick start.
## Reference:
- Qian et al., Efficient Non-stationary Online Learning by Wavelets with Applications to Online Distribution Shift Adaptation. In Proceedings of the 41st International Conference on Machine Learning (ICML 2024).
## Install:
```
pip install StreamingWavelet
```
## Code Structure:
- `StreamingWavelet/StreamingWavelet.py`: The main file for the Streaming Wavelet Operator, which supports dozens types of wavelet bases.
- `StreamingWavelet/MakeCDJVFilter.py`: The file for generating the filters of different wavelet transforms, thanks to the MatLab code of _Cohen, Daubechies, Jawerth and Vial, 1992_.
- `StreamingWavelet/wavelet_coeff`: The folder for storing the different wavelet coefficients.
## Requirements:
* numpy>=1.19.0
## Quick Start & Demos:
We provide a concrete demo here.
For example, one can use the following code to generate the following Streaming Wavelet Operator
for a sequence of `dim=128`, `max_length=10000`, and using the Haar wavelets (`order=1`) as wavelet basis.
```python
import StreamingWavelet
SW = StreamingWavelet.Operator(128, 10000, 1)
```
Then, for a sequence of length 10000, one can use the following code to sequentially calculate the wavelet coefficients in an online manner:
```python
import numpy as np
import StreamingWavelet
SW = StreamingWavelet.Operator(128, 10000, 1, get_coeff=False) # Initialize the Streaming Wavelet Operator
# Generate a sequence of length 10000
x_list = []
for i in range(10000):
x_list.append(np.random.randn(128)) # Generate a random element of dim=128, and add it to the sequence
for i in range(10000):
SW.add_signal(x_list[i]) # Update the wavelet coefficients by adding the new element
current_norm = SW.get_norm() # Get the norm of the wavelet coefficients
print('Norm of Wavelet Coefficients of x_list[0:{}]:'.format(i), current_norm) # Print the current norm of the wavelet coefficients
```
which will output the norm of the wavelet coefficients in each round.
---
Note that the default mode is `get_coeff=False`, which will only maintain the **2-norm** of the wavelet coefficients.
If you want to get the wavelet coefficients, you can set `get_coeff=True` when initializing the Streaming Wavelet Operator (this will take more storage):
```python
import numpy as np
import StreamingWavelet
SW = StreamingWavelet.Operator(128, 10000, 1, get_coeff=True) # Initialize the Streaming Wavelet Operator
# Generate a sequence of length 10000
x_list = []
for i in range(10000):
x_list.append(np.random.randn(128)) # Generate a random element of dim=128, and add it to the sequence
for i in range(10000):
SW.add_signal(x_list[i]) # Update the wavelet coefficients by adding the new element
current_norm = SW.get_norm() # Get the norm of the wavelet coefficients
print('Norm of Wavelet Coefficients of x_list[0:{}]:'.format(i), current_norm) # Print the current norm of the wavelet coefficients
if (i + 1) % 1000 == 0:
print('Wavelet Coefficients of x_list[0:{}]:'.format(i), SW.all_coeff_arrs[:5]) # Print the wavelet coefficients
```
## Parameters in `StreamingWavelet.Operator`:
- `dim`: The dimension of the input signal.
- `max_length`: The maximum length of the sequence.
- `order`: The order of the wavelet transform (e.g., order=1 means Haar wavelets; order>=2 means various Daubechies wavelets).
- `get_coeff`: Whether to maintain the whole wavelet coefficients (default: False).
- `axis`: The axis to apply the wavelet transform (default: -1).
- `verbose`: Whether to print the running information (default: False).
Raw data
{
"_id": null,
"home_page": "https://github.com/ZinYY/StreamingWavelet",
"name": "StreamingWavelet",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Yu-Yang Qian",
"author_email": "qianyy@lamda.nju.edu.cn",
"download_url": "https://files.pythonhosted.org/packages/11/17/de6a78d011274bed2bb8400c9af4af486a06e73b7494fc22cf4d1d7f3e46/StreamingWavelet-1.0.6.tar.gz",
"platform": "any",
"description": "# Python implementation for _Streaming Wavelet Operator_\n\nThis is the python implementation for the Streaming Wavelet Operator, which **sequentially**\napplies wavelet transform to a sequence efficiently in an online manner (instead of recalculation in each round).\n\nThe **speed** of the Streaming Wavelet Operator is much faster than the traditional wavelet transform for streaming data,\nespecially for long signals, due to its use of lazy updates and bit-wise operations in the implementation.\n\nYou can install the `StreamingWavelet` package in [https://pypi.org/project/StreamingWavelet/](https://pypi.org/project/StreamingWavelet/).\n\nWe will first introduce the structure and requirements of the code, followed by a brief instruction for a quick start.\n\n## Reference:\n\n- Qian et al., Efficient Non-stationary Online Learning by Wavelets with Applications to Online Distribution Shift Adaptation. In Proceedings of the 41st International Conference on Machine Learning (ICML 2024).\n\n## Install:\n\n```\npip install StreamingWavelet\n```\n\n## Code Structure:\n\n- `StreamingWavelet/StreamingWavelet.py`: The main file for the Streaming Wavelet Operator, which supports dozens types of wavelet bases.\n- `StreamingWavelet/MakeCDJVFilter.py`: The file for generating the filters of different wavelet transforms, thanks to the MatLab code of _Cohen, Daubechies, Jawerth and Vial, 1992_.\n- `StreamingWavelet/wavelet_coeff`: The folder for storing the different wavelet coefficients.\n\n## Requirements:\n\n* numpy>=1.19.0\n\n## Quick Start & Demos:\n\nWe provide a concrete demo here.\nFor example, one can use the following code to generate the following Streaming Wavelet Operator\nfor a sequence of `dim=128`, `max_length=10000`, and using the Haar wavelets (`order=1`) as wavelet basis.\n\n```python\nimport StreamingWavelet\n\nSW = StreamingWavelet.Operator(128, 10000, 1)\n```\n\nThen, for a sequence of length 10000, one can use the following code to sequentially calculate the wavelet coefficients in an online manner:\n\n```python\nimport numpy as np\nimport StreamingWavelet\n\nSW = StreamingWavelet.Operator(128, 10000, 1, get_coeff=False) # Initialize the Streaming Wavelet Operator\n\n# Generate a sequence of length 10000\nx_list = []\nfor i in range(10000):\n x_list.append(np.random.randn(128)) # Generate a random element of dim=128, and add it to the sequence\n\nfor i in range(10000):\n SW.add_signal(x_list[i]) # Update the wavelet coefficients by adding the new element\n current_norm = SW.get_norm() # Get the norm of the wavelet coefficients\n print('Norm of Wavelet Coefficients of x_list[0:{}]:'.format(i), current_norm) # Print the current norm of the wavelet coefficients\n```\n\nwhich will output the norm of the wavelet coefficients in each round.\n\n---\n\nNote that the default mode is `get_coeff=False`, which will only maintain the **2-norm** of the wavelet coefficients.\nIf you want to get the wavelet coefficients, you can set `get_coeff=True` when initializing the Streaming Wavelet Operator (this will take more storage):\n\n```python\nimport numpy as np\nimport StreamingWavelet\n\nSW = StreamingWavelet.Operator(128, 10000, 1, get_coeff=True) # Initialize the Streaming Wavelet Operator\n\n# Generate a sequence of length 10000\nx_list = []\nfor i in range(10000):\n x_list.append(np.random.randn(128)) # Generate a random element of dim=128, and add it to the sequence\n\nfor i in range(10000):\n SW.add_signal(x_list[i]) # Update the wavelet coefficients by adding the new element\n current_norm = SW.get_norm() # Get the norm of the wavelet coefficients\n print('Norm of Wavelet Coefficients of x_list[0:{}]:'.format(i), current_norm) # Print the current norm of the wavelet coefficients\n if (i + 1) % 1000 == 0:\n print('Wavelet Coefficients of x_list[0:{}]:'.format(i), SW.all_coeff_arrs[:5]) # Print the wavelet coefficients\n```\n\n## Parameters in `StreamingWavelet.Operator`:\n\n- `dim`: The dimension of the input signal.\n- `max_length`: The maximum length of the sequence.\n- `order`: The order of the wavelet transform (e.g., order=1 means Haar wavelets; order>=2 means various Daubechies wavelets).\n- `get_coeff`: Whether to maintain the whole wavelet coefficients (default: False).\n- `axis`: The axis to apply the wavelet transform (default: -1).\n- `verbose`: Whether to print the running information (default: False).\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "This is an implementation for Streaming Wavelet Operator, which sequentially apply wavelet transform to a sequence efficiently. Reference: Qian et al., Efficient Non-stationary Online Learning by Wavelets with Applications to Online Distribution Shift Adaptation. In Proceedings of the 41st International Conference on Machine Learning (ICML 2024).",
"version": "1.0.6",
"project_urls": {
"Homepage": "https://github.com/ZinYY/StreamingWavelet"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1117de6a78d011274bed2bb8400c9af4af486a06e73b7494fc22cf4d1d7f3e46",
"md5": "8fc1624c6449210c1a854c54bbc06491",
"sha256": "89458806fc0b6799c064fc82da138bceb913bfc62bedc0fe646e2ebed92789eb"
},
"downloads": -1,
"filename": "StreamingWavelet-1.0.6.tar.gz",
"has_sig": false,
"md5_digest": "8fc1624c6449210c1a854c54bbc06491",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 33799,
"upload_time": "2024-08-12T13:07:02",
"upload_time_iso_8601": "2024-08-12T13:07:02.811845Z",
"url": "https://files.pythonhosted.org/packages/11/17/de6a78d011274bed2bb8400c9af4af486a06e73b7494fc22cf4d1d7f3e46/StreamingWavelet-1.0.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-12 13:07:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ZinYY",
"github_project": "StreamingWavelet",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "streamingwavelet"
}