Latent imputation for time series with optional encoder calibration
Project description
LIFTS
LIFTS is a package version of the latent factor imputation workflow developed in this repository. It keeps the original FBI implementation available internally, but exposes a cleaner estimator-style API for simulation experiments and downstream packaging.
The main entry point is LIFTSImputer, which follows the usual pattern:
model = LIFTSImputer(...)
model.fit(X_train, mask_train)
samples = model.impute_samples(X_test, mask_test)
Install
From this folder:
pip install -e .
For a fresh environment, install the listed runtime dependencies first if needed:
pip install -r requirements.txt
Release instructions for PyPI are in RELEASE.md.
Quickstart
from lifts import LIFTSImputer, make_case4_dataset
data = make_case4_dataset(
num_sample_train=200,
num_sample_test=50,
p=20,
d=5,
T=48,
obs_rate=0.5,
version="v1",
seed=42,
)
model = LIFTSImputer(
d=5,
total_loops=20,
batch_size=64,
n_samples=20,
lambda_selfmask=5.0,
lambda_enc=1.0,
enc_warmup=5,
seed=42,
)
model.fit(data["X_train"], data["mask_train"], verbose=True)
samples = model.impute_samples(data["X_test"], data["mask_test"], n_samples=20)
print(samples.shape) # (N, n_samples, p, T)
p and T can be passed to the constructor, or inferred from X_train during fit.
Data Format
LIFTS expects numpy arrays with shape (N, p, T):
X: observed time series values, with missing entries either zero-filled ornanmask: binary observation mask with1for observed and0for missing- returned imputation samples:
(N, n_samples, p, T)
The dataset helpers return both observed and complete arrays:
X_train,mask_train,X_train_fullX_test,mask_test,X_test_full
Key Parameters
lambda_selfmask: weight for the self-mask imputation loss. Default is5.0.lambda_enc: weight for synthetic encoder calibration. Default is0.0, which preserves the original training behavior.enc_warmup: number of training loops before encoder calibration starts. Default is50.enc_syn_batch: number of synthetic trajectories used by encoder calibration.Noneresolves tomin(4000, N)during training.enc_syn_mini_batch: chunk size for encoder calibration synthesis.Noneresolves tomin(batch_size, enc_syn_batch).
The training objective is:
L_total = L_forecast + lambda_selfmask * L_selfmask + lambda_enc * L_encoder
L_encoder is only added when lambda_enc > 0 and the warmup has completed.
Included Simulation Cases
make_case1_dataset(...): linear factor state-space simulationmake_case3_dataset(...): nonlinear simulation variantmake_case4_dataset(..., version="v1"): benchmark-compatible Case 4 used by the packaged examplesmake_case4_dataset(..., version="v2"): current local Case 4 generator
Examples
Scripts:
examples/scripts/case1_minimal.pyexamples/scripts/case3_minimal.pyexamples/scripts/case4_minimal.py
Notebooks:
examples/notebooks/case1_lifts.ipynbexamples/notebooks/case4_lifts.ipynb
The notebooks include plot_probabilistic_imputation, exported at the package root:
from lifts import plot_probabilistic_imputation
Backward Compatibility
The lower-level FBIImputer and get_fbi_config APIs remain importable:
from lifts import FBIImputer, get_fbi_config
For new code, prefer LIFTSImputer because it exposes the common training controls directly in the constructor.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lifts-0.1.0.tar.gz.
File metadata
- Download URL: lifts-0.1.0.tar.gz
- Upload date:
- Size: 100.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d59e7774a68f669a986f942497ae6667b83739dcdf9b89676021c0c97f1c71c
|
|
| MD5 |
a987e5df2ecd5ead7023e739d086927d
|
|
| BLAKE2b-256 |
4ab044448b17d336a86cd56b3a10ce231f8d4a2a2b30fc86d31d954669ea7cc4
|
Provenance
The following attestation bundles were made for lifts-0.1.0.tar.gz:
Publisher:
python-package-lifts.yml on sanyouwu/EHR
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lifts-0.1.0.tar.gz -
Subject digest:
6d59e7774a68f669a986f942497ae6667b83739dcdf9b89676021c0c97f1c71c - Sigstore transparency entry: 2024633608
- Sigstore integration time:
-
Permalink:
sanyouwu/EHR@c425bef2f3f4416257f1a48423211ac55b4555e5 -
Branch / Tag:
refs/tags/lifts-v0.1.0 - Owner: https://github.com/sanyouwu
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-package-lifts.yml@c425bef2f3f4416257f1a48423211ac55b4555e5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file lifts-0.1.0-py3-none-any.whl.
File metadata
- Download URL: lifts-0.1.0-py3-none-any.whl
- Upload date:
- Size: 108.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77a5689f47700622f957a192207dd5210529ae054568a6f11a0309319cfe874a
|
|
| MD5 |
c04f301143d5774b53ec581d81c4d782
|
|
| BLAKE2b-256 |
117a302030f975b82471c41d37bb0d25a3f803390ab3ee1ebcdaacd4916bce0c
|
Provenance
The following attestation bundles were made for lifts-0.1.0-py3-none-any.whl:
Publisher:
python-package-lifts.yml on sanyouwu/EHR
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lifts-0.1.0-py3-none-any.whl -
Subject digest:
77a5689f47700622f957a192207dd5210529ae054568a6f11a0309319cfe874a - Sigstore transparency entry: 2024633748
- Sigstore integration time:
-
Permalink:
sanyouwu/EHR@c425bef2f3f4416257f1a48423211ac55b4555e5 -
Branch / Tag:
refs/tags/lifts-v0.1.0 - Owner: https://github.com/sanyouwu
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-package-lifts.yml@c425bef2f3f4416257f1a48423211ac55b4555e5 -
Trigger Event:
push
-
Statement type: