Finite-Interval Forecasting Engine: Machine learning models for discrete-time survival analysis and multivariate time series forecasting
Project description
The Finite-Interval Forecasting Engine (FIFE) provides machine learning and other models for discrete-time survival analysis and multivariate time series forecasting.
Suppose you have a dataset that looks like this:
ID | period | feature_1 | feature_2 | feature_3 | ... |
---|---|---|---|---|---|
0 | 2019 | 7.2 | A | 2AX | ... |
0 | 2020 | 6.4 | A | 2AX | ... |
0 | 2021 | 6.6 | A | 1FX | ... |
0 | 2022 | 7.1 | A | 1FX | ... |
1 | 2019 | 5.3 | B | 1RM | ... |
1 | 2020 | 5.4 | B | 1RM | ... |
2 | 2020 | 6.7 | A | 1FX | ... |
2 | 2021 | 6.9 | A | 1RM | ... |
2 | 2022 | 6.9 | A | 1FX | ... |
3 | 2020 | 4.3 | B | 2AX | ... |
3 | 2021 | 4.1 | B | 2AX | ... |
4 | 2022 | 7.4 | B | 1RM | ... |
... | ... | ... | ... | ... | ... |
The entities with IDs 0, 2, and 4 are observed in the dataset in 2022.
- What are each of their probabilities of being observed in 2023? 2024? 2025?
- Given that they will be observed, what will be the value of feature_1? feature_3?
- Suppose entities can exit the dataset under a variety of circumstances. If entities 0, 2, or 4 exit in a given year, what will their circumstances be?
- How reliable can we expect these forecasts to be?
- How do the values of the features inform these forecasts?
FIFE can estimate answers to these questions for any unbalanced panel dataset.
FIFE unifies survival analysis (including competing risks) and multivariate time series analysis. Tools for the former neglect future states of survival; tools for the latter neglect the possibility of discontinuation. Traditional forecasting approaches for each, such as proportional hazards and vector autoregression (VAR), respectively, impose restrictive functional forms that limit forecasting performance. FIFE supports the state-of-the-art approaches for maximizing forecasting performance: gradient-boosted trees (using LightGBM) and neural networks (using Keras).
FIFE is simple to use:
from fife.processors import PanelDataProcessor
from fife.lgb_modelers import LGBSurvivalModeler
import pandas as pd
data_processor = PanelDataProcessor(data=pd.read_csv(path_to_your_data))
data_processor.build_processed_data()
modeler = LGBSurvivalModeler(data=data_processor.data)
modeler.build_model()
forecasts = modeler.forecast()
Want to forecast future states, too? Just replace LGBSurvivalModeler
with LGBStateModeler
and specify the column you'd like to forecast with the state_col
argument.
Want to forecast circumstances of exit ("competing risks")? Try LGBExitModeler
with the exit_col
argument instead.
Here's a guided example notebook with real data, where we forecast when world leaders will lose power.
You can read the documentation for FIFE here.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file fife-1.6.2.tar.gz
.
File metadata
- Download URL: fife-1.6.2.tar.gz
- Upload date:
- Size: 52.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da0b53437a3fdb65e47e2d1719075d367783ca22dab2867b2759daea581fd54e |
|
MD5 | 6ba444daea672edc831d8a04938eb8c8 |
|
BLAKE2b-256 | b8b9a3296e91b8a578a3ac19ad20b6eb2f8fa791a9bda9dd00a458370196c6df |
File details
Details for the file fife-1.6.2-py3-none-any.whl
.
File metadata
- Download URL: fife-1.6.2-py3-none-any.whl
- Upload date:
- Size: 50.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2ac2946ac6ce2e4c1425dd3e5a8bd5d1f89f6ff711fad91ca73cb876db33043 |
|
MD5 | 50249f97cf00481edb8d4be4168c4138 |
|
BLAKE2b-256 | 1ea2ca88ec323551ded870fb6525e7f3dcc633f62fdb1a99f8bb625e71ff6669 |