Repository navigation
Fabel 1.0.0
Renamed: this release was published under the old name fabel. The project is now fdatools — see v1.1.0.
Install the wheel from this release:
pip install https://github.com/hameddavodi/fabel/releases/download/v1.0.0/fabel-1.0.0-py3-none-any.whlDataset files for fabel.datasets are in the data-v1 release and download on first use.
First public release: a clean-room Python rewrite of R fda 6.3.0 with
golden-file parity (rtol = 1e-8, 1e-5 for iterative fits).
Added
- Basis systems (
fabel.basis):BSpline,Fourier,Monomial,Exponential,
Power,Constant,Polygonal, with evaluation and derivatives, roughness
penalties for anyLDO, cached Gram matrices and exact basis products. - Core objects (
fabel.core):FData(callable curves, exact derivatives,
arithmetic,mean/std/center/cov, indexing,@inner product),
BiFData,LDO(including the harmonic accelerator) andinprod. - Smoothing (
fabel.smoothing):smooth()with GCV or degrees-of-freedom
selection of λ, positive / monotone / morph constraints, observation weights
and irregular per-curve designs;SmoothResult; the scikit-learnSmoother;
gcv_curve,lambda_to_df,df_to_lambda. - Decomposition (
fabel.decomposition):FPCA(with roughness-penalised
harmonics and varimax rotation) andFCCA, both scikit-learn estimators. - Regression (
fabel.regression):fregress()for scalar and functional
responses with scalar and functional covariates (model type read from the
arguments, or an R-style formula string with treatment-coded factors), with
predict(),stderr()andcv(); the scikit-learnFRegressestimator. - Registration (
fabel.registration): continuous registrationregister()
(Newton with the exact Hessian, optional periodic shift), landmark registration
(landmarks=orlandmark_register()), the amplitude/phase decomposition
RegistrationResult.decompose()and the scikit-learnRegistrator. - Dynamics (
fabel.dynamics): principal differential analysisPDAfor single
equations and coupled systems, with an ODEsolve()andplot_overlay(), and
thephase_plane()plot. - Statistics (
fabel.stats):cov,cor, functional depth (MBD, BD2, FM),
the functionalboxplot, and the permutation testst_testandf_test.
f_testtakes either raw inputs(y, x, basis=, lam=, penalty=)like R
Fperm.fd, or a fittedfregressmodel:f_test(model, n_perm=, q=, t=, random_state=). - scikit-learn:
check_estimatorpasses forSmoother,FPCA,FRegressand
Registratorwith no exemptions.FRegressvalidatesyas scikit-learn does
(finite, column vectors flattened with a warning, at least 2 samples).
Registratorhasn_iter_, and its default basis for an n-column coefficient
matrix isBSpline(n_basis=n, order=min(4, n)), the same rule asFPCA. - PyTorch layers (
fabel.nn, optionalfabel[torch]extra):BasisLayer,
SmoothingLayer(learnable λ) andFDataDataset.import fabeldoes not
import PyTorch;fabel.nnloads on first use. - Top-level exports:
smooth,Smoother,SmoothResult,FPCA,FCCA,
fregress,FRegress,register,landmark_register,Registrator,PDA,
phase_plane, and thestatsmodule. - Datasets (
fabel.datasets): 14 loaders for the FDA book datasets;growth,
gaitandpinchship in the package, the others download once with SHA-256
verification and aFABEL_DATA_DIR-overridable cache. - I/O (
fabel.io):from_pandas,to_pandas,to_xarrayandread_rdsfor R
fd/bifd/basisfdobjects. - Array API backend: NumPy and PyTorch inputs, with gradients flowing through
evaluation, products and inner products. - Golden-file parity suite against R
fda6.3.0, andtools/parity_report.py,
which measures every parity check and writesPARITY_REPORT.md. - Documentation site (MkDocs Material + mkdocstrings): quickstart, R migration
table, API reference for every module, and six tutorials (smoothing, FPCA,
registration, regression, dynamics, machine learning). Tests run every
tutorial block and check that every public symbol is rendered. notebooks/book_figures.ipynb: figures of Ramsay, Hooker & Graves (2009),
assembled fromnotebooks/book/ch*.pybytools/build_book_notebook.py
(make book) and run in CI withnbmake.- Packaging: typed (
py.typed) wheel and sdist for Python 3.10 to 3.13,
BSD-3-Clause license,CITATION.cff. register()accepts anFDatawith PyTorch coefficients and returns PyTorch
results; gradients flow from the registered curves to the input coefficients
(autodiff Newton path; the optimal warps are held fixed).- Build: the Makefile uses the
.venvPython and has newsyncandgate5
targets. - Sparse / longitudinal FPCA (
fabel.sparse, PACE):sparse_mean
(Rsmooth.sparse.mean),sparse_cov/SparseCov(RcovPACE, with the
measurement-error variancesigma2), and thePACEestimator (RpcaPACE)
with conditional-expectation (BLUP) scores intransform(replaces R's
defectivescoresPACE) andinverse_transform. - Density and intensity estimation (
fabel.density):fit_density(R
density.fd, no longer shipped in fda 6.3.0) andfit_intensity(R
intensity.fd), damped Newton with the exact Hessian and exact integrals;
DensityResult,IntensityResult. - Generalized profiling for ODE parameters (
fabel.profiling, replaces the R
CSTR family):ODEModel(analytic, finite-difference or torch-autodiff
derivatives),ProfiledODE,profile_ode,ProfileResult, built-in
cstr_model/cstr_inputsandfitzhugh_nagumo_model, andsimpson_rule
(Rquadset). Unobserved states are allowed. - Regression:
linmod()/LinmodResultfor a functional response on a
functional covariate with a bivariate coefficient beta(s, t) (Rlinmod),
with weights and apredict()method.fregressnow computes in the input's
array namespace: torch tensors in give torch results, with gradients to the
response, covariates and weights. - Registration:
register()accepts multivariate curves (one warp per curve,
newvar_weights=keyword;var_weights=[1, 0, ...]reproduces R, which uses
the first variable only); landmark registration anddecompose()accept
multivariate curves; newRegistrationResult.apply(fd)(Rregister.newfd). - Dynamics:
PDAforcing functions (forcing_basis=,forcing_lam=,
fit(X, forcing=u),forcing_weights_; Rpda.fdawtlist/ufdlist) and
PDA.stability()returningPDAStability(Reigen.pda, with the true
equilibrium limits). - Smoothing: monotone, positive and morph
SmoothResults evaluate exact
derivatives of any order (Faà di Bruno / complete Bell polynomials; R
eval.monfd,eval.posfd,predict.monfd). - Statistics: pointwise
confidence_band()/ConfidenceBandfor a smooth
(viay2c_map) or anfregressresult (viastderr), and the plots
plot_beta(Rplotbeta),cycleplot(Rcycleplot.fd) andplot_scores
(Rplotscores). - Top-level exports added:
PACE,SparseCov,sparse_mean,sparse_cov,
fit_density,fit_intensity,DensityResult,IntensityResult,
ODEModel,ProfiledODE,profile_ode,linmod,LinmodResult,
PDAStability, and thesparse,densityandprofilingmodules.
Fixed
register(lam=0, criterion='eigen')no longer raisesLinAlgError: it warns
(RuntimeWarning) when a curve has no finite optimum, and raisesValueError
on NaN or infinite input.FPCAandFCCAaccept any integer-liken(SupportsIndex).FData.stdsamples the pointwise standard deviation on
max(201, 10 * n_basis + 1)points, matching Rsd.fdto 1.8e-15.
Documentation
- Dataset docstrings state the unit of every value and time field.
- Observation weights: behaviour compared with R
fRegress(wt=)and
Fperm.fdin thefregress/f_testnotes and the R migration page.
Known differences from R fda
- Where R
fda6.3.0 is demonstrably less accurate (for examplederiv.fd,
times.fd, B-spline penalties with no interior knots,smooth.posstopping
one iteration short), Fabel returns the exact value. Each case is a strict
expected failure in the test suite with its measured error; see
PARITY_REPORT.md.