DATFID SDK
A Python SDK to access the DATFID API to forecast your data.
Features
- Easy model fitting: Build panel data models with time-dependent and static features.
- Flexible lag handling: Specify lags for the dependent variable and selected features.
- Forecasting: Generate future predictions with aligned timestamps and IDs.
- Statistical options: Filter features by significance and apply mean-variance tests.
- White box full interpretability: Get fully interpretable model with equation, estimated parameters, and standard errors.
Installation
pip install datfid
Usage
Before using the SDK, please request an access token by emailing admin@datfid.com or by visiting our website datfid.com.
from datfid import DATFIDClient
# Initialize the client with your DATFID token
client = DATFIDClient(token="your_DATFID_token")
# Fit a model
fit_result = client.fit_model(
df=dataframe,
id_col="name of id column",
time_col="name of time column",
y="name of dependent variable",
lag_y="starting lag : ending lag",
lagged_features={
"feature 1": "starting lag : ending lag",
"feature 2": "starting lag : ending lag"
},
current_features=["feature 3", "feature 4"],
filter_by_significance=True/False,
dummy_sqrt=True/False,
dummy_interact=True/False,
dummy_logs=True/False,
dummy_yejo=True/False,
dummy_asinh=True/False,
dummy_logs_interact=True/False,
meanvar_test=True/False
)
# Generate forecasts
forecast_df = client.forecast_model(
df_forecast=dataframe
)
# The forecast DataFrame contains the individual IDs and timestamps
# from the original data plus a "forecast" column with predicted values.
Example 1
Sample dataset from GitHub (Food and Beverages demand forecasting):
import pandas as pd
from datfid import DATFIDClient
# Initialize the client with your DATFID token
client = DATFIDClient(token="your_DATFID_token")
# Load dataset for model fitting
url_fit = "https://raw.githubusercontent.com/datfid-valeriidashuk/sample-datasets/main/Food_Beverages.xlsx"
df = pd.read_excel(url_fit)
# Fit the model
result = client.fit_model(df=df,
id_col="Product",
time_col="Time",
y="Revenue",
current_features='all',
filter_by_significance=True
)
# Load dataset for forecasting
url_forecast = "https://raw.githubusercontent.com/datfid-valeriidashuk/sample-datasets/main/Food_Beverages_forecast.xlsx"
df_forecast = pd.read_excel(url_forecast)
# Forecast revenue using the fitted model
forecast = client.forecast_model(df_forecast=df_forecast)
Example 2
Slightly larger sample dataset from GitHub (Banking sector, forecasting loan probability):
import pandas as pd
from datfid import DATFIDClient
# Initialize the client with your DATFID token
client = DATFIDClient(token="your_DATFID_token")
# Load dataset for model fitting
url_fit = "https://raw.githubusercontent.com/datfid-valeriidashuk/sample-datasets/main/Banking_extended.xlsx"
df = pd.read_excel(url_fit)
# Fit the model
result = client.fit_model(df=df,
id_col="Individual",
time_col="Time",
y="Loan Probability",
lag_y="1:3",
lagged_features={"Income Level": "1:3"},
filter_by_significance=True)
# Load dataset for forecasting
url_forecast = "https://raw.githubusercontent.com/datfid-valeriidashuk/sample-datasets/main/Banking_extended_forecast.xlsx"
df_forecast = pd.read_excel(url_forecast)
# Forecast loan probability using the fitted model
forecast = client.forecast_model(df_forecast=df_forecast)
API Reference
DATFIDClient
client = DATFIDClient(token: str)
Initialize the client with your DATFID token.
client.fit_model(df: pd.DataFrame, id_col: str, time_col: str, y: str, lag_y: Optional[Union[int, str, list[int]]] = None, lagged_features: Optional[Dict[str, int]] = None, current_features: Optional[list] = None, filter_by_significance: bool = False, meanvar_test: bool = False) -> SimpleNamespace
Fit a model using the provided dataset.
client.forecast_model(df_forecast: pd.DataFrame) -> pd.DataFrame
Generate forecasts using the fitted model.
Metadata
Release files for datfid 0.1.28
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| datfid-0.1.28.tar.gz | 3.8 kB | Without provenance | Details for datfid-0.1.28.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| datfid-0.1.28-py3-none-any.whl | Python 3 | none | any | Details for datfid-0.1.28-py3-none-any.whl |
Total release size: 11.6 kB
Release files / datfid-0.1.28.tar.gz
| Download URL | datfid-0.1.28.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
23a5804d95112dada786be775123cdd2b3e0aea3519f6fd93ab532f92ddd32eb
|
|
BLAKE2b-256 checksum How to use checksums |
983381c3507cc066c282bae998a004fb75edcf96393490a103d137ab05776b42
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / datfid-0.1.28-py3-none-any.whl
| Download URL | datfid-0.1.28-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9e4765eb488536d38c19e2221537e85a471553651f7a250d43f9badaffea9df4
|
|
BLAKE2b-256 checksum How to use checksums |
bc1f59f64d8961c1cb27332ac3a03be2babf322db743c0d6c6960165ffcf00bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Security for datfid 0.1.28
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.