Skip to main content

fdars – Functional Data Analysis for Python

CI PyPI MIT licensed Status: Experimental

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.

Documentation

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.7 on Python 3.9, >=1.3 on 3.10+) and enables the fdars.sklearn layer: 28 estimators that pass the full check_estimator battery and plug into Pipeline / 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 + grounded advise() 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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fdars-0.9.0.tar.gz (4.0 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

fdars-0.9.0-cp39-abi3-win_amd64.whl (3.2 MB view details)

Uploaded CPython 3.9+Windows x86-64

fdars-0.9.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

fdars-0.9.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.1 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

fdars-0.9.0-cp39-abi3-macosx_11_0_arm64.whl (3.0 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

fdars-0.9.0-cp39-abi3-macosx_10_12_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file fdars-0.9.0.tar.gz.

File metadata

  • Download URL: fdars-0.9.0.tar.gz
  • Upload date:
  • Size: 4.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for fdars-0.9.0.tar.gz
Algorithm Hash digest
SHA256 1803f85f59365dd75bedc8318bb0c3617e8b64b70eabc263b273c13bf067aa29
MD5 1a5dbe010ebee46049ce28f4ffa5a99b
BLAKE2b-256 2c88224836b700c8c414da07c407d2b44ffcb18c015fa3b8b9300e53dabc6056

See more details on using hashes here.

File details

Details for the file fdars-0.9.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: fdars-0.9.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for fdars-0.9.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 4136dc5848dc8784fe01bebe22fa34ca7ce1bc05f263f0dc98c478831aba7d96
MD5 2e8b15f4bbb2b7da772aebef8a6f9ff6
BLAKE2b-256 71143e7df4dda03b931983ba370c1fffefdbf3305927d639b69627e9c20b64ed

See more details on using hashes here.

File details

Details for the file fdars-0.9.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fdars-0.9.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f723207842fe9f8575084dba10658118e34163598d8361ecfca3eba955bd1458
MD5 99cad4838779d645ca302ed4e9997d9a
BLAKE2b-256 f6ac13d80b9334f4f0a2944de684b1c2dc510a42089190d1fa8706234113ce32

See more details on using hashes here.

File details

Details for the file fdars-0.9.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for fdars-0.9.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 99a2c3ab8e13342464745d194d5917128affbe405a9ea8571b301adc687ef3f8
MD5 ab9a29c92c82853b5726d819af540bea
BLAKE2b-256 05ab243a446f94746bc04a3e0769648b99921942eea505f46274fc985d3a3e80

See more details on using hashes here.

File details

Details for the file fdars-0.9.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: fdars-0.9.0-cp39-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.9+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for fdars-0.9.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ff682d8492340fafa8d270fecb07e5642cb69bee5390ba1080676747c08abf43
MD5 45e7487a059b31ede396002cb17d8f21
BLAKE2b-256 d5ce0659b377be242ee44a0b8b3c1078e3ada322abd69b825def746a35ac79d1

See more details on using hashes here.

File details

Details for the file fdars-0.9.0-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for fdars-0.9.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 37886aec5a8d3d6457efea4d7bab4950492b303fb73672c5924b72e3d174ba63
MD5 32b8003debed6f4f76407d42c558a8be
BLAKE2b-256 c184ffda3f9c93065df89ea838b1b4ddf43a5e3d8cf371d1fdc16694c1ee2a50

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.9.0 This release

6 files

0.7.0

6 files

0.6.0

6 files

0.5.0

6 files

0.4.0

6 files

0.3.0

6 files

0.2.0

6 files

0.1.0

6 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page