Utilities shared between TabPFN codebases
Project description
TabPFN Common Utilities
Shared Python utilities used across the TabPFN ecosystem (the tabular foundation model).
Features
Data Processing Utilities
- Regression Results: Handling of prediction outputs with mean, median, mode, and quantiles
- Data Serialization: Convert between pandas DataFrames, NumPy arrays, and CSV formats
- Dataset Management: Load and preprocess standard ML datasets with proper train/test splits
- Preprocessing Configuration: Options for data transformation strategies
Cost Estimation
- Resource Planning: Estimation of computational costs and duration for TabPFN predictions
- Cloud Pricing: Useful for resource planning in cloud-based TabPFN services
- Task-Specific Calculations: Different cost models for classification vs regression tasks
Telemetry (optional, opt-out)
- Anonymous & Aggregated: No personal information or sensitive data is collected or transmitted
- Configurable: Can be disabled via environment variable
- Usage Patterns: Aggregate signals used to improve TabPFN
Installation
pip install tabpfn-common-utils
Or with uv:
uv add tabpfn-common-utils
Quick Start
Regression Results
from tabpfn_common_utils.regression_pred_result import RegressionPredictResult
# Handle regression prediction results
result = RegressionPredictResult({
"mean": [1.2, 2.3, 3.4],
"median": [1.1, 2.2, 3.3],
"mode": [1.0, 2.0, 3.0],
"quantile_0.25": [0.9, 1.9, 2.9],
"quantile_0.75": [1.5, 2.5, 3.5]
})
# Convert to basic representation for serialization
basic_repr = RegressionPredictResult.to_basic_representation(result)
Data Utilities
from tabpfn_common_utils.utils import get_example_dataset, serialize_to_csv_formatted_bytes
import pandas as pd
# Load example dataset
X_train, X_test, y_train, y_test = get_example_dataset("iris")
# Serialize data to CSV bytes
csv_bytes = serialize_to_csv_formatted_bytes(X_train)
Telemetry
from tabpfn_common_utils.telemetry import ProductTelemetry
# Initialize telemetry service (anonymous; opt-out)
telemetry = ProductTelemetry()
# Track usage events
telemetry.capture(...)
# Disable via environment variable
export TABPFN_DISABLE_TELEMETRY=1
Telemetry notes
- Anonymous and aggregated only — no user identification or tracking
- Disabled by setting
TABPFN_DISABLE_TELEMETRY=1 - Open source — see
src/tabpfn_common_utils/telemetry/for what is sent
Development
Setup
# Install dependencies
uv sync
# Activate virtual environment
source .venv/bin/activate
# Run tests
uv run pytest
# Type checking
uv run pyright
# Code formatting
uv run ruff check --fix
Adding Dependencies
# Add runtime dependency
uv add <package_name>
# Add development dependency
uv add --group dev <package_name>
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Contributing
Contributions are welcome! Please ensure all code passes type checking and formatting requirements.
Links
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 tabpfn_common_utils-0.2.21.tar.gz.
File metadata
- Download URL: tabpfn_common_utils-0.2.21.tar.gz
- Upload date:
- Size: 2.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc4f00c8a5e759fa91210eb19adfebe201ec49edc354075fe6e65031b0f76053
|
|
| MD5 |
f8c249a01c5bb7d71864d2355da088e8
|
|
| BLAKE2b-256 |
7d6d3035d1d809e1243c1785ef218a21d87ce6c5a5750dcbb09d32e15e2c981f
|
Provenance
The following attestation bundles were made for tabpfn_common_utils-0.2.21.tar.gz:
Publisher:
release.yml on PriorLabs/tabpfn_common_utils
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tabpfn_common_utils-0.2.21.tar.gz -
Subject digest:
dc4f00c8a5e759fa91210eb19adfebe201ec49edc354075fe6e65031b0f76053 - Sigstore transparency entry: 1396375754
- Sigstore integration time:
-
Permalink:
PriorLabs/tabpfn_common_utils@bcd8a405d4967f1c117a3540964e77ba695793dc -
Branch / Tag:
refs/tags/v0.2.21 - Owner: https://github.com/PriorLabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bcd8a405d4967f1c117a3540964e77ba695793dc -
Trigger Event:
push
-
Statement type:
File details
Details for the file tabpfn_common_utils-0.2.21-py3-none-any.whl.
File metadata
- Download URL: tabpfn_common_utils-0.2.21-py3-none-any.whl
- Upload date:
- Size: 39.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
480b2f24a6150bc10a49485ca5e88885ffa476499ddc3d0c5f8080b379955cb9
|
|
| MD5 |
ddc8ef6faa3fb9165fe96342e8212a78
|
|
| BLAKE2b-256 |
3d5597fb9d02a5d4e28abd9e76b90b9ab2366df828588024d713ebb37750aead
|
Provenance
The following attestation bundles were made for tabpfn_common_utils-0.2.21-py3-none-any.whl:
Publisher:
release.yml on PriorLabs/tabpfn_common_utils
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tabpfn_common_utils-0.2.21-py3-none-any.whl -
Subject digest:
480b2f24a6150bc10a49485ca5e88885ffa476499ddc3d0c5f8080b379955cb9 - Sigstore transparency entry: 1396375767
- Sigstore integration time:
-
Permalink:
PriorLabs/tabpfn_common_utils@bcd8a405d4967f1c117a3540964e77ba695793dc -
Branch / Tag:
refs/tags/v0.2.21 - Owner: https://github.com/PriorLabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bcd8a405d4967f1c117a3540964e77ba695793dc -
Trigger Event:
push
-
Statement type: