SDK to access the DATFID API hosted on Hugging Face Spaces
Project description
DATFID SDK
A Python SDK to access the DATFID API running on Hugging Face Spaces.
Installation
pip install datfid
Usage
from datfid import DATFIDClient
# Initialize the client with your Hugging Face token
client = DATFIDClient(token="your_huggingface_token")
# Fit a model
fit_result = client.fit_model(
file_path="path/to/your/data.xlsx",
id_col="Individual",
time_col="Time",
y="Loan Probability",
lagged_features={"Repayment Amount": 1, "Missed Payments": 2},
current_features=["Credit Score", "Unemployment Rate"],
filter_by_significance=True,
meanvar_test=False
)
# Generate forecasts
forecast_df = client.generate_forecast(
file_path="path/to/your/forecast_data.xlsx",
id_col="Individual",
time_col="Time",
y="Loan Probability",
lagged_features={"Repayment Amount": 1, "Missed Payments": 2},
current_features=["Credit Score", "Unemployment Rate"],
filter_by_significance=True,
meanvar_test=False
)
# The forecast DataFrame includes the original data plus forecast columns:
# - forecast: The predicted values
# - forecast_lower: Lower bound of the prediction interval
# - forecast_upper: Upper bound of the prediction interval
# - forecast_error: Standard error of the forecast
API Reference
DATFIDClient
__init__(token: str)
Initialize the client with your Hugging Face token.
fit_model(file_path: str, id_col: str, time_col: str, y: str, lagged_features: Optional[Dict[str, int]] = None, current_features: Optional[list] = None, filter_by_significance: bool = False, meanvar_test: bool = False) -> Dict[str, Any]
Fit a model using the provided data.
generate_forecast(file_path: str, id_col: str, time_col: str, y: str, lagged_features: Optional[Dict[str, int]] = None, current_features: Optional[list] = None, filter_by_significance: bool = False, meanvar_test: bool = False) -> pd.DataFrame
Generate forecasts using the fitted model.
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
datfid-0.1.12.tar.gz
(4.3 kB
view details)
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 datfid-0.1.12.tar.gz.
File metadata
- Download URL: datfid-0.1.12.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
569b10c3cfdefd479806bbdfc9eef1acc48070cb438b9c2351bc68eefa49858c
|
|
| MD5 |
e29115063509d59b55e659fe205aec9a
|
|
| BLAKE2b-256 |
21cbdde03b87f0d236aa4cf6e2cd9f4d72151eb2fdb8d993aa714b3381a1119e
|
File details
Details for the file datfid-0.1.12-py3-none-any.whl.
File metadata
- Download URL: datfid-0.1.12-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a88b6996d34d13e4e22c9fabe7afdc40c560003d3aea937330618b696f546687
|
|
| MD5 |
c955fd629179cb9ed50eddceeb61ae99
|
|
| BLAKE2b-256 |
ea055a325649eb794d201b34e82680e2751eb2970d0c8070ecd4e26e73825e76
|