timesift (Python)
The Python side of timesift. It fits and compares representations of time-varying data against a
prediction target, from the same one call the R package offers, and it answers to
../inst/spec/representation.md, the document both implementations answer to.
import timesift as ts
fit = ts.timesift(plots, logger, y="sp_*", id="plot_id", time="datetime",
models=[ts.elasticnet(), ts.forest()],
sift=ts.grains("day", "week", "month"),
resampling=ts.cv(v=5))
print(ts.summary(fit))
timesift 80 targets, 4 responses, 5-fold random CV, tss
candidate mean won responses
forest / week 0.503 0 separate
elasticnet / month 0.504 0 separate
forest / month 0.507 1 separate
elasticnet / day 0.515 1 separate
elasticnet / week 0.528 1 separate
forest / day 0.535 1 separate
ensemble 0.571 -
weights elasticnet / week 0.37 elasticnet / day 0.22 forest / month 0.17 elasticnet / month 0.12 forest / day 0.09 forest / week 0.04
targets and series are mappings of column name to array, which a data frame satisfies. y, x
and static are selections over their own table: a column name, a list of names, a glob such as
"sp_*", or a function of a name. fit.predict(targets, series) rebuilds each member's
representation for the new rows and combines them.
What is here
timesift,Timesift: the entry point and the fitted run, carrying its candidates, its scores, its out-of-fold predictions and its stack.native,grain,multigrain,lookbackand the setsgrainsandlookbacks: what a representation is, before any record has been read.build_representationturns one into the array a learner is handed.grain_matrix,lookback_matrix,calendar_channels,bind_channels,feature_matrix,timesift_set: the arrays themselves, reachable without the fitting layer.coverageis the count of readings per unit and bin, which is where a refused record's gaps are read off.cv,grouped_cv,fold_map,read_folds,scorable_cells: the split, and which cells admit a score.elasticnet,stepwise,forest(scikit-learn),mlp,cnn,rescnn(torch), andLearnerfor one of your own.train_controlcarries how any of the neural ones is trained.ensemble,ensemble_fit,ensemble_combine,ensemble_weights: the stack over the candidates' out-of-fold predictions.tss,roc_auc,kappa_score,model_agreement,decision_threshold: the metrics.grain_ladder,select_grain,paired_contrast,tss_inflation,implied_skill: fitting across a set of grains on its own, comparing two arms cell by cell, and reading a level that was taken at its own best threshold.occlusion: hold each bin or each channel back and rescore, without refitting. It takes a run or a ladder.register_learner,register_metric,register_response: the three registries the fitting path reads.
The mixed-model grain contrast the R side offers as grain_contrasts() has no counterpart here.
The contract's last section carries the rest of what each language holds.
The binning and the reduction are not written here. They are ../src/ts_core.cpp, the same
implementation the R package compiles, reached through the _core extension that ../CMakeLists.txt
builds with nanobind. What is written here is the boundary: resolving the columns, resolving the
zone, and putting the result into a TimesiftMatrix.
At runtime the package needs numpy alone. A learner that needs a package declares it and stops without it.
The time zone
grain_matrix takes a tz argument. Left at None the instants are taken as already expressed
in the calendar to bin by, which is what a zone-free datetime64 says. Given a zone name they are
read as UTC and binned by that zone's clock, which is what the R side does for a series carrying a
tzone. The same instants and the same zone give the same answer in both languages, and
digests.csv carries zone rows that pin it.
A time column that carries a zone of its own names the calendar the same way, so a pandas column
in Europe/Vienna bins by Vienna days without being told to. Naming a different zone in tz
beside one the column carries is an error rather than a silent choice between the two.
The fold map crosses the language boundary; the fold builder does not
fold_map draws on numpy's random stream and the R side draws on R's, so the same seed gives
different maps. Where both languages must see identical splits, build the map once and read it in
the other with read_folds. The map is an artifact, like the response and the representation.
Two rules govern this directory
tests/oracle.pyis implemented from the spec, not transcribed from the R source. It is the NumPy representation as it was written before the two languages shared a core, kept because reading the R code and copying it would reproduce its bugs and hide its assumptions. Nothing imports it outside the suite; it exists so the shared core is checked against an implementation that shares none of its code.- A digest mismatch is a bug, never a fixture to regenerate. Regenerating fixtures happens on the R side, deliberately, in its own commit, and only when the spec changed with it.
The project directory is the repository root, because a source distribution cannot reach above itself and the shared sources are not vendored into a second copy. Build and test from there:
pip install -e ".[test,torch,sklearn]"
pytest
Release files for timesift 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| timesift-0.3.2.tar.gz | 621.6 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| timesift-0.3.2-cp313-cp313-win_amd64.whl | CPython 3.13 | CPython 3.13 | Windows x86-64 | Details |
| timesift-0.3.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | CPython 3.13 | CPython 3.13 | Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 | Details |
| timesift-0.3.2-cp313-cp313-macosx_11_0_arm64.whl | CPython 3.13 | CPython 3.13 | macOS 11.0+ ARM64 | Details |
| timesift-0.3.2-cp312-cp312-win_amd64.whl | CPython 3.12 | CPython 3.12 | Windows x86-64 | Details |
| timesift-0.3.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| timesift-0.3.2-cp312-cp312-macosx_11_0_arm64.whl | CPython 3.12 | CPython 3.12 | macOS 11.0+ ARM64 | Details |
| timesift-0.3.2-cp311-cp311-win_amd64.whl | CPython 3.11 | CPython 3.11 | Windows x86-64 | Details |
| timesift-0.3.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 | Details |
| timesift-0.3.2-cp311-cp311-macosx_11_0_arm64.whl | CPython 3.11 | CPython 3.11 | macOS 11.0+ ARM64 | Details |
Total release size: 3.1 MB
Release files / timesift-0.3.2.tar.gz
| Download URL | timesift-0.3.2.tar.gz |
|---|---|
| Size | 621.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
361e86a3402cc12d73c94cf20980fec74e6889c7fd9d9a9f377f01ff518c2738
|
|
BLAKE2b-256 checksum How to use checksums |
0359f923e1d303fb9b845ad7bd88fb0e986dc6d86f574d75373ff9a372bfe337
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / timesift-0.3.2-cp313-cp313-win_amd64.whl
| Download URL | timesift-0.3.2-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 418.5 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
9d2d1c7ce8b68e2bed2a4f7218d8db9dd72b9e4dcd399f9d4e8dcb8baaf4b546
|
|
BLAKE2b-256 checksum How to use checksums |
895646ef782d7dead29e8ae27e2d25cf06196bb192a9c2e72296fc59fdedb945
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / timesift-0.3.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | timesift-0.3.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 218.3 kB |
| Tags | CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
9022bcfae7f66535565eece33f2cea54631f7e1f53d3fe942932c0cde7959136
|
|
BLAKE2b-256 checksum How to use checksums |
1a39da8427ac52151393b52f5346ea280b4028fbe0203c446314bd0d096e0d75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / timesift-0.3.2-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | timesift-0.3.2-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 201.4 kB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
d0e639121e9fe4bec61290290f9ebf704f8e9ea4fbebd26578d22f62aab90298
|
|
BLAKE2b-256 checksum How to use checksums |
366e138f4d5e0aa0f59a34ffd912b2cb5db6b01b53b171d2de82b9f9e8808c4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / timesift-0.3.2-cp312-cp312-win_amd64.whl
| Download URL | timesift-0.3.2-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 418.4 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
bc15c5804f180ae2dfdb981c3e06d5fa7d61af7d596babf8ab69d4a2d02cb9b2
|
|
BLAKE2b-256 checksum How to use checksums |
367f76a98c90d3d8a7c0fa49ef0f0874b1b5ae07d0e15e1f392fecb02b1ba17f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / timesift-0.3.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | timesift-0.3.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 218.4 kB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
9dc0b5f766cde2d845dea9b046522cf831e1201cd92b3853128d9228574f7550
|
|
BLAKE2b-256 checksum How to use checksums |
96b167d714fdd85e689b549d4579f5a6e100f1ac0ec539ec2d5156dab3ddba62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / timesift-0.3.2-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | timesift-0.3.2-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 201.3 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
eef4ce80a725a17c6f4eaa6f03601dff7395c4ebaf97c496952d20ceaa9af1d2
|
|
BLAKE2b-256 checksum How to use checksums |
0b8c5ce536a802a7964fca955cb7548a3db7175ab0de7cda97d0973c573b2fab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / timesift-0.3.2-cp311-cp311-win_amd64.whl
| Download URL | timesift-0.3.2-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 418.6 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
e4d357bfd88f43a2e36be2a72fc9cb47f45b55e5e63a2cb722796700d201adff
|
|
BLAKE2b-256 checksum How to use checksums |
c9ebba685403b51fdf3f1d917b381709c974f54a16ad892db59c89a3f78db661
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / timesift-0.3.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | timesift-0.3.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 218.9 kB |
| Tags | CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
599aada9084415d1d477351ae3d94ca64091586d2c7329dc34e19195f79744c6
|
|
BLAKE2b-256 checksum How to use checksums |
6c9c4790b0610d54217db959929095f25c26aa99ee8d201a5aceebf1acaa4529
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / timesift-0.3.2-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | timesift-0.3.2-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 202.1 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c5770d135f67d39da102e9aaa9896a30c36dd768393b8b9eb2a886ad8d0897f6
|
|
BLAKE2b-256 checksum How to use checksums |
a8250988c3a5250327af531f5ffdc4580dd4b073d021cbe9fa50617eb9334319
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency log