fdars – Functional Data Analysis for Python
High-performance Functional Data Analysis for Python, powered by a Rust backend (fdars-core).
The Fdata Class
The central object in fdars is Fdata — a functional data container that bundles
observation data, evaluation grid, identifiers, and metadata into a single object
(mirroring the R package's fdata class).
import numpy as np
import pandas as pd
from fdars import Fdata
# Create functional data: 30 sine curves on [0, 1]
t = np.linspace(0, 1, 100)
X = np.array([np.sin(2 * np.pi * t + p) + np.random.normal(0, 0.1, 100)
for p in np.random.uniform(0, np.pi, 30)])
# Attach metadata as a pandas DataFrame
meta = pd.DataFrame({"group": ["A"] * 15 + ["B"] * 15,
"score": np.random.randn(30)})
fd = Fdata(X, argvals=t, metadata=meta)
fd
# Fdata (1D) – 30 obs × 100 points – range [0.0, 1.0] – metadata: group, score
# Subset — metadata DataFrame and IDs are preserved
fd_sub = fd[0:10]
fd_sub.metadata # DataFrame with 10 rows
# Methods delegate to the Rust backend
mu = fd.mean() # pointwise mean
fd_c = fd.center() # centered Fdata
d1 = fd.deriv(nderiv=1) # first derivative (returns Fdata)
norms = fd.norm(p=2.0) # L2 norms per curve
depths = fd.depth("fraiman_muniz") # depth values
D = fd.distance(method="lp") # self-distance matrix
# 2D surfaces work the same way
surfaces = np.random.randn(5, 8, 10) # 5 surfaces on 8×10 grid
fd2d = Fdata(surfaces, argvals=(np.arange(8), np.arange(10)))
You can still call low-level functions directly with raw NumPy arrays:
from fdars.depth import fraiman_muniz_1d
from fdars.metric import lp_self_1d
from fdars.clustering import kmeans_fd
depths = fraiman_muniz_1d(X, X)
D = lp_self_1d(X, t, p=2.0)
result = kmeans_fd(X, t, k=3, seed=42)
Modules
| Module | Description |
|---|---|
fdars.Fdata |
Functional data container (1D curves, 2D surfaces) with metadata |
fdars.fdata |
Low-level functional data operations (mean, derivatives, norms, centering) |
fdars.depth |
Depth functions (Fraiman-Muniz, modal, band, random projection, …) |
fdars.metric |
Distance metrics (Lp, Hausdorff, DTW, soft-DTW, Fourier, h-shift) |
fdars.basis |
Basis representations (B-splines, P-splines, Fourier) |
fdars.smoothing |
Nonparametric smoothing (Nadaraya-Watson, local polynomial, k-NN) |
fdars.clustering |
Clustering (k-means, fuzzy c-means, GMM) |
fdars.regression |
Regression (FPC linear, PLS, nonparametric, robust, FOSR, FANOVA) |
fdars.alignment |
Elastic alignment (SRSF, Karcher mean, elastic FPCA) |
fdars.outliers |
Outlier detection (LRT, outliergram, magnitude-shape) |
fdars.seasonal |
Seasonal analysis (SAZED, autoperiod, STL, peak detection) |
fdars.spm |
Statistical process monitoring (Phase I/II, EWMA, CUSUM) |
fdars.classification |
Classification (LDA, QDA, k-NN, kernel with cross-validation) |
fdars.tolerance |
Tolerance bands (FPCA, conformal, Degras SCB) |
fdars.conformal |
Conformal prediction (split, jackknife+) |
fdars.simulation |
Simulation (Karhunen-Loève, Gaussian processes) |
fdars.explain |
Explainability (SHAP, PDP, permutation importance, significant regions) |
Quick Start
git clone https://github.com/sipemu/pyfda.git
cd pyfda
python -m venv .venv && source .venv/bin/activate
pip install maturin numpy
maturin develop --release
The package exposes 16 submodules wrapping 130+ functions with zero-copy NumPy conversion. Requires Python >= 3.9.
Optional extras
The base package imports with zero optional dependencies. Feature layers install as extras:
pip install "fdars[sklearn]" # scikit-learn estimator layer (fit/transform/predict)
pip install "fdars[advisor]" # grounded parameter advisor (pydantic + Anthropic)
pip install "fdars[plot]" # matplotlib plotting helpers
[sklearn]installs scikit-learn (>=1.3,<1.7on Python 3.9,>=1.3on 3.10+) and enables thefdars.sklearnlayer: 28 estimators that pass the fullcheck_estimatorbattery and plug intoPipeline/GridSearchCV/cross_val_score. The base package still imports with zero scikit-learn installed. See the scikit-learn API docs.[advisor]enables the offline diagnostics + groundedadvise()layer; provider extras ([openai],[gemini],[ollama]) swap the LLM backend.
Development
# Install dev dependencies
pip install maturin numpy pytest matplotlib
# Build in development mode
maturin develop
# Run tests
pytest tests/
# Build documentation
pip install mkdocs-material
mkdocs serve
MSRV
The minimum supported Rust version is 1.83.
License
MIT — see LICENSE.
Release files for fdars 0.12.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fdars-0.12.0.tar.gz | 5.1 MB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| fdars-0.12.0-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details |
| fdars-0.12.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| fdars-0.12.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| fdars-0.12.0-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details |
| fdars-0.12.0-cp39-abi3-macosx_10_12_x86_64.whl | CPython 3.9 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 23.0 MB
Release files / fdars-0.12.0.tar.gz
| Download URL | fdars-0.12.0.tar.gz |
|---|---|
| Size | 5.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
28ef52b0004ea9a5381ad8cf7e6c734095c602d3c74695680fd9101cbccc6d1e
|
|
BLAKE2b-256 checksum How to use checksums |
4244794d2683dd52b546b16aff9d99938d9e9ad601ad8ddf60d9b167dcf3964d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / fdars-0.12.0-cp39-abi3-win_amd64.whl
| Download URL | fdars-0.12.0-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 3.7 MB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
5aee9f14aa386ebb87affe5cb40c7941de5401c5bd878bdba191100fb73a6af6
|
|
BLAKE2b-256 checksum How to use checksums |
f9e5272958a2d6fbc0353de363831a2253e598160ad535d557c61cf09d85b0a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / fdars-0.12.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | fdars-0.12.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 3.7 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
565b735ee486e828556b55e4756d04df773d28506b4bc0aaccab995cd548ea8a
|
|
BLAKE2b-256 checksum How to use checksums |
cd0f8378a385de413d529ad138e664cb23d8cc0c200b5b11555bd1d049b83a71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / fdars-0.12.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | fdars-0.12.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 3.6 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
c6b420913805a0d153162065f0dd3f81076c3cc9e9a1b1815d0567e787a257f4
|
|
BLAKE2b-256 checksum How to use checksums |
ec6af3958924ed4721c57294c700cfc6c88349fc97eb31eeec85cc162305283e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / fdars-0.12.0-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | fdars-0.12.0-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 3.4 MB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
5c069d74703d4b01bcf8fd85ba065c4eb3699eaeb101f026c69f853aa871fd4d
|
|
BLAKE2b-256 checksum How to use checksums |
33d21c0f3526601c518550e50949fe14320cabf0621ba1d396f4bc0b294167a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / fdars-0.12.0-cp39-abi3-macosx_10_12_x86_64.whl
| Download URL | fdars-0.12.0-cp39-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 3.6 MB |
| Tags | CPython 3.9 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
ba572ef2a9bcd9373aabdaa9d95dbc7c24bf56a1458476cdbf5ef17dc151f1c5
|
|
BLAKE2b-256 checksum How to use checksums |
4da5e8a5275c989f73b32c742bbbb1c3123e1876ce98442d324cdbbb60b28757
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|