{"id":15908896,"url":"https://github.com/christiansch/dsc17","last_synced_at":"2025-10-10T10:15:27.196Z","repository":{"id":75537942,"uuid":"95208230","full_name":"ChristianSch/dsc17","owner":"ChristianSch","description":"Code for the data science competition 2017","archived":false,"fork":false,"pushed_at":"2017-06-25T10:59:50.000Z","size":4899,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-08T15:13:38.762Z","etag":null,"topics":["data-science","eve-online","machine-learning"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ChristianSch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":"2017-06-23T10:01:26.000Z","updated_at":"2023-04-12T07:35:25.000Z","dependencies_parsed_at":"2023-06-06T20:15:44.068Z","dependency_job_id":null,"html_url":"https://github.com/ChristianSch/dsc17","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristianSch%2Fdsc17","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristianSch%2Fdsc17/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristianSch%2Fdsc17/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristianSch%2Fdsc17/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChristianSch","download_url":"https://codeload.github.com/ChristianSch/dsc17/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246916741,"owners_count":20854511,"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":["data-science","eve-online","machine-learning"],"created_at":"2024-10-06T14:40:57.346Z","updated_at":"2025-10-10T10:15:22.163Z","avatar_url":"https://github.com/ChristianSch.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Data Science Competition 2017\n## Task Overview\nFor the multiplayer online game `EVE: Online` users can craft, develop and trade products,\nmaterials and other goods freely on \"space stations\". Different forecasting and prediction\ntasks based on these data is to be done.\n\n### Task 1\nThe sales for five market segments (ships, ship equipment, ammunition and charges, manufacturing and\nresearch) are to be forecasted for different horizons:\n\n1. 24.12.15 to 01.01.16 (9 days)\n2. weeks of january (30 days )\n3. months of january to march\n\nEach segment is represented by 5 individual products. Data is given with daily\ngranularity.\n\nThe forecasting is done with prophet, where details are available at the bottom of this document. The data is imputed with zeros for missing values, representing no sales\non the said day. Forecasts are made for 98 days, bigger granularities such as weeks and\nmonths are then aggregated.\n\n### Task 2\nThree segment indices are to be forecasted for the same horizons as in task 1, again\nthe data is given with daily granularity. Again the data is modelled by prophet.\n\nExample decomposition and model for the `cpi`:\n![CPI decomposition and model](figures/cpi.png)\n\nExample forecast with uncertainty for `mpi`:\n![MPI forecast](figures/mpi.png)\n\n---\nDifferent things have been tried to improve forecasts based on the given data. Several\nmethods for changepoint detection have been employed, where the task is to separate the\ndata into different stochastic processes, so a changepoint is a shift in the statistical\nattributes of the data. No methods have been working as expected, and thus haven't been\nused subsequently.\nDifferent approaches have been compared by simulated historical forecasts (see bottom\nof document).\n\nAnother thing that was tried was to remove outliers with filtering techniques such as\nmoving median. The forecasts didn't improve notably.\n\n#### To be done\n* use item attribute patches as changepoints to improve accuracy by accounting for\n  external changes\n\n### Task 3\nFor given data with monthly granularity and the market segments *ships*, *missile launchers* and *materials* (where each is defined as a set of a varying number of products) the market share for each segment is to be forecasted for the first quarter of the next year (2016).\n\nAs the sum of the forecasted shares cannot exceed 1 (or 100%) the problem differs substantially from the other three tasks. For the final solution an LSTM neural network is trained, which can model temporal dependency, and has a softmax activation function at the end, which *squashes* the values into `[0,1]`, and hence provides a probability distribution of the market shares. These are then taken as the respective market shares.\n\n### Task 4\nFor a number of products with demand/supply data, stores (in this case \"stations\") and days for the year of 2016\nthe price and quantity tuple for January 2017 shall be forecasted.\nThe maximum number of products to be sold is given as the supply at the beginning of the\nmonth. Nothing more can be sold.\nHence the task is no forecasting, but rather an optimization problem.\n\nAs a simple approximate solution the task is \"solved\" by estimating the price and quantity\nper day, product and station via a Evolutionary Strategy optimization method per product.\nThe cost function is to be maximized, solutions which exceed the monthly supply are marked\nas infeasible by returning `0`. For an extensive overview on other constraint handling\nmethods for genetic programming/evolution strategies see [2].\n\n#### Possible Improvements\n* The basic maximization of said cost function can be extended by\naccepting only prices which are within the IRQ (+1.5/-1.5 times the forecasted price)\nepsilon region of the forecasted price. The same applies to forecasted quantity.\n* The initial vectors can be initialized with the forecasted demand and price\ninstead of just zero.\n\n## Installation\n### Notebooks\nThe notebooks need two extensions to work properly:\n\n\nfor beautiful progress bars with `tqdm` and `ipywidgets`:\n\n```\njupyter nbextension enable --py --sys-prefix widgetsnbextension\n```\n\n## To be done\nDue to time issues some tasks were ignored, and which are yet to be done:\n* the lstm solution to task 3 should be evaluated against VAR with softmax\nspecifically or with simulated historical forecasting in general\n\n\n## Concepts\n### Prophet Models\nThe model is based on the additive decomposition, where the signal is decomposed in additive, conceptual components:\n\n* `g(t)`: growth (piecewise linear segmented trend modelled by the logistic growth model) with optional changepoints\n* `s(t)`: periodicity such as weekly, monthly or annual changes, modelled by a fourier transformation\n* `h(t)`: holidays, unused\n* residuals: signals the mentioned components isn't modelling\n\nFor details see [1].\n\n### Simulated Historical Forecasts\nDue to the i.i.d. assumption of cross validation and similar approaches in machine\nlearning we cannot simply select training and testing/evaluation data for time series\nanalysis. Henceforth different, increasing horizons are chosen, where the partitions are\nthen used for training and testing and subsequently evaluated.\n\nExample:\nSay we have daily data for two years. The forecasting horizon is 31 days.\nWe partition the data (starting at the end of the first year) into training data:\n* first year as training\n* second year as testing data\nas the first iteration of shf.\nThe next iteration then divides the data into `end of first year + chosen granularity` \nas training and the rest as evaluation data. The granularity can be daily, monthly,\nquarterly, or with enough data even yearly or more.\nThe empirical distribution of accuracy measurements of each of these partitions can be\nevaluated subsequently to determine the overall accuracy of the model.\n\nNB: the accuracy is expected to improve with more training data and less testing data.\n\n## References\n* [[1] Taylor, Lethan: Forecasting at Scale (2017)](https://facebookincubator.github.io/prophet/static/prophet_paper_20170113.pdf)\n* [[2] Kramer : A Review of Constraint-Handling Techniques for Evolution Strategies (2010)](https://www.hindawi.com/journals/acisc/2010/185063/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristiansch%2Fdsc17","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchristiansch%2Fdsc17","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristiansch%2Fdsc17/lists"}