Skip to content

Commit

Permalink
FPCA reference added to docstring + added FPCA explanation in example
Browse files Browse the repository at this point in the history
update fpca references

FPCA reference added to docstring + added FPCA explanation in example

Fix references in FPCA
  • Loading branch information
aleexarias committed Oct 25, 2024
1 parent 7792400 commit 9031ea2
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 18 deletions.
37 changes: 36 additions & 1 deletion docs/refs.bib
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,25 @@ @inbook{ramsay+silverman_2005_registration
keywords = {Multivariate analysis}
}

@inbook{ramsay+silverman_2005_basisfuncexp,
title = {Basis function expansion of the functions},
booktitle = {Functional Data Analysis},
author = {Ramsay, James and Silverman, Bernard W.},
year = {2005},
series = {Springer {{Series}} in {{Statistics}}},
edition = {Second},
pages = {161--164},
publisher = {{Springer-Verlag}},
address = {{New York}},
doi = {10.1007/b98888},
url = {https://www.springer.com/gp/book/9780387400808},
urldate = {2024-10-20},
collaborator = {Ramsay, James and Silverman, Bernard W.},
isbn = {978-0-387-40080-8},
langid = {english},
keywords = {Multivariate analysis}
}

@incollection{romeo+marzoljaen_2014_analisis,
title = {{An\'alisis del viento y la niebla en el aeropuerto de Los Rodeos (Tenerife). Cambios y tendencias}},
booktitle = {{Cambio clim\'atico y cambio global.}},
Expand Down Expand Up @@ -643,6 +662,23 @@ @inproceedings{torrecilla+suarez_2016_feature
urldate = {2018-09-25}
}

@article{wang+chiou+muller_2016_fpca,
title = {Functional Data Analysis},
author = {Wang, Jane-Ling and Chiou, Jeng-Min and M{\"u}ller, Hans-Georg},
year = {2016},
journal = {Annual Review of Statistics and Its Application},
volume = {3},
number = {Volume 3, 2016},
pages = {257--295},
publisher = {{Annual Reviews}},
issn = {2326-831X},
doi = {10.1146/annurev-statistics-041715-033624},
url = {https://www.annualreviews.org/content/journals/10.1146/annurev-statistics-041715-033624},
urldate = {2024-10-23},
abstract = {With the advance of modern technology, more and more data are being recorded continuously during a time interval or intermittently at several discrete time points. These are both examples of functional data, which has become a commonly encountered type of data. Functional data analysis (FDA) encompasses the statistical methodology for such data. Broadly interpreted, FDA deals with the analysis and theory of data that are in the form of functions. This paper provides an overview of FDA, starting with simple statistical notions such as mean and covariance functions, then covering some core techniques, the most popular of which is functional principal component analysis (FPCA). FPCA is an important dimension reduction tool, and in sparse data situations it can be used to impute functional data that are sparsely observed. Other dimension reduction approaches are also discussed. In addition, we review another core technique, functional linear regression, as well as clustering and classification of functional data. Beyond linear and single- or multiple- index methods, we touch upon a few nonlinear approaches that are promising for certain applications. They include additive and other nonlinear functional regression models and models that feature time warping, manifold learning, and empirical differential equations. The paper concludes with a brief discussion of future directions.},
keywords = {functional linear regression, functional principal component analysis, functional additive model, functional correlation, clustering and classification, time warping}
}

@inbook{wasserman_2006_nonparametric,
title = {Nonparametric Regression},
booktitle = {All of Nonparametric Statistics},
Expand All @@ -658,4 +694,3 @@ @inbook{wasserman_2006_nonparametric
isbn = {978-0-387-25145-5},
langid = {english}
}

13 changes: 12 additions & 1 deletion examples/plot_fpca.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,18 @@
# to explore datasets and obtain conclusions about said dataset using this
# technique.
#
# First we are going to fetch the Berkeley Growth Study data. This dataset
# FPCA is a dimensionality reduction method for functional data that aims to
# reduce the complexity of studying observations by finding a finite number of
# principal components, which are the directions that capture the main modes
# of variation across the function (the most important directions in which the
# curves vary). FPCA can be though of as a basis expansion, but what
# distinguishes FPCA is that among all basis expansions that use K components
# for a fixed K, the FPC expansion explains most of the variation in X.
#
# For more information abour FPCA and its objectives, see
# :footcite:ts:`wang+chiou+muller_2016_fpca`.
#
# Firstly, we are going to fetch the Berkeley Growth Study data. This dataset
# correspond to the height of several boys and girls measured from birth to
# when they are 18 years old. The number and time of the measurements are the
# same for each individual. To better understand the data we plot it.
Expand Down
24 changes: 8 additions & 16 deletions skfda/preprocessing/dim_reduction/_fpca.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ class FPCA( # noqa: WPS230 (too many public attributes)
Class that implements functional principal component analysis for both
basis and grid representations of the data. The parameters are shared
when fitting a FDataBasis or FDataGrid, except for
``components_basis``.
when fitting a FDataBasis or FDataGrid, except for ``components_basis``.
For more information about the implementation of the computation of the
first principal components see :footcite:ts:`silverman_2005_basisfuncexp`.
Parameters:
n_components: Number of principal components to keep from
Expand Down Expand Up @@ -88,6 +90,10 @@ class FPCA( # noqa: WPS230 (too many public attributes)
>>> fd = FDataGrid(data_matrix, grid_points)
>>> fpca_grid = FPCA(2)
>>> fpca_grid = fpca_grid.fit(fd)
References:
.. footbibliography::
"""

def __init__(
Expand Down Expand Up @@ -135,22 +141,13 @@ def _fit_basis(
"""
Compute the first n_components principal components and saves them.
The eigenvalues associated with these principal components are also
saved. For more details about how it is implemented please view the
referenced book.
Args:
X: The functional data object to be analysed.
y: Ignored.
Returns:
self
References:
.. [RS05-8-4-2] Ramsay, J., Silverman, B. W. (2005). Basis function
expansion of the functions. In *Functional Data Analysis*
(pp. 161-164). Springer.
"""
# the maximum number of components is established by the target basis
# if the target basis is available.
Expand Down Expand Up @@ -309,11 +306,6 @@ def _fit_grid(
Returns:
self.
References:
.. [RS05-8-4-1] Ramsay, J., Silverman, B. W. (2005). Discretizing
the functions. In *Functional Data Analysis* (p. 161).
Springer.
"""
# check that the number of components is smaller than the sample size
if self.n_components > X.n_samples:
Expand Down

0 comments on commit 9031ea2

Please sign in to comment.