{"id":19881272,"url":"https://github.com/nike-inc/timeseries-generator","last_synced_at":"2025-04-24T00:22:12.542Z","repository":{"id":43743284,"uuid":"387904038","full_name":"Nike-Inc/timeseries-generator","owner":"Nike-Inc","description":"A library to generate synthetic time series data by easy-to-use factors and generator","archived":false,"fork":false,"pushed_at":"2024-07-08T10:31:25.000Z","size":782,"stargazers_count":149,"open_issues_count":8,"forks_count":35,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-06T18:17:11.353Z","etag":null,"topics":["generator","python","time-series"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Nike-Inc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-20T20:15:19.000Z","updated_at":"2025-04-02T17:33:12.000Z","dependencies_parsed_at":"2024-01-07T22:23:15.604Z","dependency_job_id":"926b481c-a28a-4746-946b-6dbed283e851","html_url":"https://github.com/Nike-Inc/timeseries-generator","commit_stats":null,"previous_names":["nike-inc/ts-generator"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nike-Inc%2Ftimeseries-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nike-Inc%2Ftimeseries-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nike-Inc%2Ftimeseries-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nike-Inc%2Ftimeseries-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nike-Inc","download_url":"https://codeload.github.com/Nike-Inc/timeseries-generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250536239,"owners_count":21446698,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["generator","python","time-series"],"created_at":"2024-11-12T17:13:44.328Z","updated_at":"2025-04-24T00:22:12.504Z","avatar_url":"https://github.com/Nike-Inc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# timeseries-generator\nThis repository consists of a python packages that generates synthetic time series dataset in a generic way (under `/timeseries_generator`) and demo notebooks on how to generate synthetic timeseries data (under `/examples`). The goal here is to have non-sensitive data available to demo solutions and test the effectiveness of those solutions and/or algorithms. In order to test your algorithm, you want to have time series available containing different kinds of trends. The python package should help create different kinds of time series while still being maintainable.\n\n## `timeseries_generator` package\nFor this package, it is assumed that a time series is composed of a base value multiplied by many factors.\n```\nts = base_value * factor1 * factor2 * ... * factorN + Noiser\n```\n![Diagram](figs/diagram.png)\n\n\nThese factors can be anything, random noise, linear trends, to seasonality. The factors can affect different features. For example, some features in your time series may have a seasonal component, while others do not.\n\nDifferent factors are represented in different classes, which inherit from the `BaseFactor` class. Factor classes are input for the `Generator` class, which creates a dataframe containing the features, base value, all the different factors working on the base value and and the final factor and value.\n\n### Core concept\n- **Generator**: a python class to generate the time series. A generator contains a list of factors and noiser. By overlaying the factors and noiser, generator can produce a customized time series\n- **Factor**: a python class to generate the trend, seasonality, holiday factors, etc. Factors take effect by multiplying on the base value of the generator.\n- **Noised**: a python class to generate time series noise data. Noiser take effect by summing on top of \"factorized\" time series.\nThis formula describes the concepts we talk above\n\n### Built-in Factors\n- **LinearTrend**: give a linear trend based on the input slope and intercept\n- **CountryYearlyTrend**: give a yearly-based market cap factor based on the GDP per - capita. \n- **EUEcoTrendComponents**: give a monthly changed factor based on EU industry product public data\n- **HolidayTrendComponents**: simulate the holiday sale peak. It adapts the holiday days - differently in different country\n- **BlackFridaySaleComponents**: simulate the BlackFriday sale event\n- **WeekendTrendComponents**: more sales at weekends than on weekdays\n- **FeatureRandFactorComponents**: set up different sale amount for different stores and different product\n- **ProductSeasonTrendComponents**: simulate season-sensitive product sales. In this example code, we have 3 different types of product:\n    - winter jacket: inverse-proportional to the temperature, more sales in winter\n    - basketball top: proportional to the temperature, more sales in summer\n    - Yoga Mat: temperature insensitive\n\n## Installation\n```sh\npip install timeseries-generator\n```\n\n## Usage\n``` python\nfrom timeseries_generator import LinearTrend, Generator, WhiteNoise, RandomFeatureFactor\nimport pandas as pd\n\n# setting up a linear tren\nlt = LinearTrend(coef=2.0, offset=1., col_name=\"my_linear_trend\")\ng = Generator(factors={lt}, features=None, date_range=pd.date_range(start=\"01-01-2020\", end=\"01-20-2020\"))\ng.generate()\ng.plot()\n\n# update by adding some white noise to the generator\nwn = WhiteNoise(stdev_factor=0.05)\ng.update_factor(wn)\ng.generate()\ng.plot()\n```\n\n### Example Notebooks\nWe currently have 2 example notebooks available:\n1. `generate_stationary_process`: Good for introducing the basics of the `timeseries_generator`. Shows how to apply\nsimple linear trends and how to introduce features and labels, as well as random noise.\n1. `use_external_factors`: Goes more into detail and shows how to use the `external_factors` submodule. Shows how to\ncreate seasonal trends.\n\n## Web based prototyping UI\nWe also use [Streamlit](https://streamlit.io/) to build a web-based UI to demonstrate how to use this package to generate synthesis time series data in an interactive web UI.\n``` sh\nstreamlit run examples/streamlit/app.py\n```\n![Web UI](figs/webui.png)\n\n\n## License\nThis package is released under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnike-inc%2Ftimeseries-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnike-inc%2Ftimeseries-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnike-inc%2Ftimeseries-generator/lists"}