Tempora AI Python Client Library
Project description
Tempora AI Python Client
Tempora helps you build ML-ready batches from structured or sequential data stored in local files, cloud object stores, or enterprise data platforms. It provides dataset abstractions, batch samplers, target specification, and feature transform hooks enabling you to build powerful ML data prep workflows in just a few lines of Python.
Tempora Server
The tempora-ai package is a Python client that connects to a Tempora server instance,
which in turn handles all the computation and data processing required for data prep workflows.
In production deployments, the server runs as a containerized application in your own environment (for example in your VPC or on-prem infrastructure). However, if you would like to try Tempora before deploying it, we offer a free hosted trial.
Installation
pip install tempora-ai
Optional extras
pip install tempora-ai[torch]
pip install tempora-ai[tensorflow]
pip install tempora-ai[jax]
Example Workflow
import pandas as pd
import tempora
from tempora.datasets import Pivot, SnowflakeDataset, connect_snowflake
from tempora.samplers import RandomSampler, PredictionWindowTargetSpec, EventEncoder
# Login to the Tempora server and connect to Snowflake
tempora.login(host='10.0.8.0', username='tempora')
connect_snowflake(user='nick', account='xy12345', warehouse='my_warehouse')
# Define the datasets for source data in Snowflake.
# Specify a pivot transformation for the sensor data that is in EAV form
sensor_data = SnowflakeDataset(
database='industrial', table='sensor_data',
time_column='datetime', entity_keys=['Machine Serial'],
pivot=Pivot(on='param', using='value', agg_function='first'),
)
failure_data = SnowflakeDataset(
database='industrial', table='failure_data', time_column='Failure Date',
)
# Join the two datasets using an ASOF join. ASOF joins must be the final join
# in a join chain, but they can still be followed by filters and other
# non-join operations.
dataset = sensor_data.join(failure_data, ['Machine Serial'], asof_join=True)
dataset = dataset.filter("Model = 'XC-500' AND ENGINE_HOURS IS NOT NULL")
# Create a random segment sampler with event-based targets
target_spec = PredictionWindowTargetSpec(
window_len=pd.Timedelta('20h'), columns=['Failure Date'],
transform_spec=EventEncoder(),
)
sampler = RandomSampler(
context_len=pd.Timedelta('50h'), batch_size=32, output_format='torch',
target_spec=target_spec,
)
# Generate 1000 batches from the sampler and serialize them to S3 as parquet
sampler.write_batches(dataset, 1000, 's3://bucket-name/tempora_batches/')
Core Concepts
datasets: Define datasets backed by file systems, object stores, data warehouses or databases.samplers: Sample training/eval batches according to different strategies (random, sequential, series).target specification: Specify the targets or labels for each sampled segment in the batch.transforms: Apply custom transforms to either context and/or target window data.
Environment Variables
TEMPORA_SERVER_HOST: Server address inhostname:portformat.TEMPORA_SERVER_USERNAME: Username to authenticate with.TEMPORA_SERVER_PASSWORD: Password to authenticate with.
Documentation
Support
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 tempora_ai-0.2.0.tar.gz.
File metadata
- Download URL: tempora_ai-0.2.0.tar.gz
- Upload date:
- Size: 62.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.14.0 Darwin/25.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf417db5899e62d0c787afdf3de1d0e8c389324da877ea46ec04c0bec961daea
|
|
| MD5 |
a618cbb9db02292f6648bfd92a0b8490
|
|
| BLAKE2b-256 |
23dd74c00fb827eff0a0d5c9fc4b4575aa5b231e7e82b03c37e8a18ec8f3f17b
|
File details
Details for the file tempora_ai-0.2.0-py3-none-any.whl.
File metadata
- Download URL: tempora_ai-0.2.0-py3-none-any.whl
- Upload date:
- Size: 85.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.14.0 Darwin/25.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6426072c2013c0ee53d081028c1e5825b0fb21503bed77afb457dba646c12464
|
|
| MD5 |
4cb259ac5d2ada549ef6c41d79eea477
|
|
| BLAKE2b-256 |
42d62662e20c3b4e73dc52af319cbcb3656d903943cafc183e41cc71e587e04d
|