Skip to main content

fdars – Functional Data Analysis for Python

CI PyPI MIT licensed Claude Code Plugin Status: Experimental

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

Selected modules (30 in total; see the documentation for the full list):

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 Registration: elastic (SRSF, Karcher mean), shift, affine, landmark, continuous, exponential-family, Bayesian; curve shapes in R^d
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 Split-conformal prediction (regression, classification, elastic models, partially observed curves)
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 30 analysis submodules with 558 public callables (plus the Fdata class and the scikit-learn, advisor, plotting and MCP layers), 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.

Claude Code plugin (Agent Skills)

This repo doubles as a Claude Code plugin marketplace. Two Agent Skills ship with it:

  • fdars-capabilities — discover the full API surface: list modules and callables, get a call signature and one-line purpose, and find the right method for a task.
  • fdars-advisor — grounded parameter tuning and before/after diagnostics (clustering, smoothing, FPCA, alignment, depth, outliers, classification, regression, SPM).

Install them from the built-in marketplace:

/plugin marketplace add sipemu/pyfda
/plugin install fdars@pyfda

They then appear as /fdars:fdars-capabilities and /fdars:fdars-advisor and are auto-invoked from their descriptions. fdars-advisor needs the fdars package installed in the skill's execution environment (see Optional extras above and the skill's SKILL.md).

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.

Metadata

Release files for fdars 0.14.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fdars 0.14.2
File Size Uploaded Provenance Actions
fdars-0.14.2.tar.gz 6.7 MB Without provenance Details for fdars-0.14.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for fdars 0.14.2
File Actions
fdars-0.14.2-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for fdars-0.14.2-cp39-abi3-win_amd64.whl
fdars-0.14.2-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for fdars-0.14.2-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
fdars-0.14.2-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for fdars-0.14.2-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
fdars-0.14.2-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for fdars-0.14.2-cp39-abi3-macosx_11_0_arm64.whl
fdars-0.14.2-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details for fdars-0.14.2-cp39-abi3-macosx_10_12_x86_64.whl

Total release size: 33.3 MB

Release files / fdars-0.14.2.tar.gz

Download URL fdars-0.14.2.tar.gz
Size 6.7 MB
Tags Source
SHA-256 checksum
How to use checksums
9ddc973b33cfe0119c8e0d23c0f718744ec5e9936e81f0e86ff54bdbfa510d39
BLAKE2b-256 checksum
How to use checksums
a8d1531fde5d72abe1aadaa14411ee2359d353910da1cf319bdfbc872ddc7e31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / fdars-0.14.2-cp39-abi3-win_amd64.whl

Download URL fdars-0.14.2-cp39-abi3-win_amd64.whl
Size 5.5 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
fe1de6df164948700324d7640783db68642adc88f619c5097102cd6505b2985e
BLAKE2b-256 checksum
How to use checksums
c19cc5ae79520f6d33150ccb3bb7e754d3856d93c44b30cb3151f2c9001a1624
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / fdars-0.14.2-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL fdars-0.14.2-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 5.5 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
a046b3107081e8cb89bae8ba5980fc8ac23e1d67ed5ed1d1cbc521a662af2a64
BLAKE2b-256 checksum
How to use checksums
71f4553d164c30b2eff15685ad9e5c65c19d37da6858804db4d88fd85ae55cb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / fdars-0.14.2-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL fdars-0.14.2-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 5.2 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
2adefeff1e716624e4b5a4d42aa99a3f153151bb81ef3098514a2dce4d22346d
BLAKE2b-256 checksum
How to use checksums
4b65a56f352641a9032abf2d2fcbf84e148672be1c0f9253270deed3f945f6ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / fdars-0.14.2-cp39-abi3-macosx_11_0_arm64.whl

Download URL fdars-0.14.2-cp39-abi3-macosx_11_0_arm64.whl
Size 4.9 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
466fe5a5d8b847b34703550b358be87bb7eea215fa5108f032847912555d16d9
BLAKE2b-256 checksum
How to use checksums
09e2a889104a8755dd5dd0044b40703f3bd5124cf94dd78471c3cede8fa33b7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / fdars-0.14.2-cp39-abi3-macosx_10_12_x86_64.whl

Download URL fdars-0.14.2-cp39-abi3-macosx_10_12_x86_64.whl
Size 5.4 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
e51e46ca3eba8016920f022b15fb429069cb44d10306d829e15cda6aab43033e
BLAKE2b-256 checksum
How to use checksums
c24e6d0cee0a212912d5ede577c112d3f83cee7e9c3f427eb51b079852fd0c49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Security for fdars 0.14.2

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.

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