Skip to main content

python package for generating calendars for machine learning timeseries analysis.

Project description

lilio: Calendar generator for machine learning with timeseries data

Logo

github repo badge github license badge fair-software badge

A python package for generating calendars to resample timeseries into training and target data for machine learning.

Installation

To install the in-development version from the GitHub repository, do:

python3 -m pip install git+https://github.com/AI4S2S/lilio.git

Configure the package for development and testing

The testing framework used here is pytest. Before running the test, we get a local copy of the source code and install lilio via the command:

git clone https://github.com/AI4S2S/lilio.git
cd lilio
python3 -m pip install -e .

Then, run tests:

python3 -m pytest

How the lilio calendars work

In a typical ML-based timeseries analysis, the first step is always data processing. A calendar-based datetime module time is implemented for time operations. For instance, a user is looking for predictors for winter climate at seasonal timescales (~180 days). First, a calendar object is created using AdventCalendar:

>>> calendar = s2spy.time.AdventCalendar(anchor="11-30", freq='180d')
>>> calendar = calendar.map_years(2020, 2021)
>>> calendar.show()
i_interval                         -1                         1
anchor_year
2021         [2021-06-03, 2021-11-30)  [2021-11-30, 2022-05-29)
2020         [2020-06-03, 2020-11-30)  [2020-11-30, 2021-05-29)

Now, the user can load the data input_data (e.g. pandas DataFrame) and resample it to the desired timescales configured in the calendar:

>>> calendar = calendar.map_to_data(input_data)
>>> bins = s2spy.time.resample(calendar, input_data)
>>> bins
  anchor_year  i_interval                  interval  mean_data  target
0        2020          -1  [2020-06-03, 2020-11-30)      275.5    True
1        2020           1  [2020-11-30, 2021-05-29)       95.5   False
2        2021          -1  [2021-06-03, 2021-11-30)      640.5    True
3        2021           1  [2021-11-30, 2022-05-29)      460.5   False

Depending on data preparations, we can choose different types of calendars e.g. MonthlyCalendar and WeeklyCalendar.

Contributing

If you want to contribute to the development of lilio, have a look at the contribution guidelines.

Credits

This package was created with Cookiecutter and the NLeSC/python-template.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lilio-0.2.1.tar.gz (1.5 MB view details)

Uploaded Source

Built Distribution

lilio-0.2.1-py3-none-any.whl (30.6 kB view details)

Uploaded Python 3

File details

Details for the file lilio-0.2.1.tar.gz.

File metadata

  • Download URL: lilio-0.2.1.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.23.3

File hashes

Hashes for lilio-0.2.1.tar.gz
Algorithm Hash digest
SHA256 94d69de1e41832dbe350e2ff5053d9ebf25dcdfe487f356f191e13a82946e9d2
MD5 3b0c8295bc271ac7a8048f5384c74510
BLAKE2b-256 5e252112c9daed8c3186a86cf7d24dfc093f3dcf3c5b51296876f560ba74ed1a

See more details on using hashes here.

File details

Details for the file lilio-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: lilio-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 30.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.23.3

File hashes

Hashes for lilio-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d761e589ab15e1b379c8ad2dc8136f628e1e99e4dfb9c8a233777cc145651406
MD5 2917cf907472e815e921acb067c139e7
BLAKE2b-256 6b880ebdd9b6d3228cc5143ade0a7963308a09c90cbff4516a115db97a23ce85

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page