Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update fpca references #636

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,15 @@
"research",
"doc"
]
},
{
"login": "luisheb",
"name": "Luis Hebrero",
"avatar_url": "https://avatars.githubusercontent.com/u/24703335?v=4",
"profile": "https://github.com/luisheb",
"contributions": [
"doc"
]
}
],
"contributorsPerLine": 7,
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-50-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/badge/all_contributors-51-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
## Contributors ✨

Expand Down Expand Up @@ -75,6 +75,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/psotom"><img src="https://avatars.githubusercontent.com/u/166627986?v=4?s=100" width="100px;" alt="psotom"/><br /><sub><b>psotom</b></sub></a><br /><a href="https://github.com/GAA-UAM/scikit-fda/commits?author=psotom" title="Code">💻</a> <a href="#example-psotom" title="Examples">💡</a> <a href="#ideas-psotom" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/GAA-UAM/scikit-fda/commits?author=psotom" title="Tests">⚠️</a> <a href="#research-psotom" title="Research">🔬</a> <a href="https://github.com/GAA-UAM/scikit-fda/commits?author=psotom" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/luisheb"><img src="https://avatars.githubusercontent.com/u/24703335?v=4?s=100" width="100px;" alt="Luis Hebrero"/><br /><sub><b>Luis Hebrero</b></sub></a><br /><a href="https://github.com/GAA-UAM/scikit-fda/commits?author=luisheb" title="Documentation">📖</a></td>
</tr>
</tbody>
<tfoot>
Expand Down
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}
}

19 changes: 18 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. These components are the directions that capture the
# main modes of variation across the function (the directions in which the
# curves vary the most). 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 FPCA expansion explains most of the variation in X.
#
# For more information abour FPCA and its objectives, see
# :footcite:ts:`wang+chiou+muller_2016_fpca`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no footbibliography, so the references are not shown in this file.

#
# 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 Expand Up @@ -111,3 +122,9 @@
fpca = FPCA(n_components=2, components_basis=MonomialBasis(n_basis=4))
fpca.fit(basis_fd)
fpca.components_.plot()

# %%
# References
# ----------
#
# .. footbibliography::
25 changes: 9 additions & 16 deletions skfda/preprocessing/dim_reduction/_fpca.py
aleexarias marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ 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:`ramsay+silverman_2005_basisfuncexp`.

Parameters:
n_components: Number of principal components to keep from
Expand Down Expand Up @@ -88,6 +91,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 +142,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 +307,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
Loading