KarhunenLoeveDecomposition
✖
KarhunenLoeveDecomposition
gives the Karhunen–Loeve transform {{b1,b2,…},m} of the numerical arrays {a1,a2,…}, where m.aibi.
uses the inverse of the matrix m for transforming bi to ai.
Details and Options

- Karhunen–Loeve decomposition is typically used to reduce the dimensionality of data and capture the most important variation in the first few components.
- The ai can be arbitrary rank arrays or images of the same dimensions.
- The inner product of m and {a1,a2,…} gives {b1,b2,…}.
- In KarhunenLoeveDecomposition[{a1,…}], rows of the transformation matrix m are the eigenvectors of the covariance matrix formed from the arrays ai.
- The matrix m is a linear transformation of ai. The transformed arrays bi are uncorrelated, are given in order of decreasing variance, and have the same total variance as ai.
- KarhunenLoeveDecomposition[{b1,b2,…},m] effectively computes the inverse Karhunen–Loeve transformation. If the length of {b1,b2,…} is less than the size of m, missing components are assumed to be zero.
- With an option setting StandardizedTrue, datasets ai are shifted so that their means are zero.
Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Scope (5)Survey of the scope of standard use cases
Principal components of two grayscale images:

https://wolfram.com/xid/0b6jc6p63p4r5i51zoyjrm-j1ll2v

Karhunen–Loeve decomposition of three matrix-valued datasets:

https://wolfram.com/xid/0b6jc6p63p4r5i51zoyjrm-pyroz


https://wolfram.com/xid/0b6jc6p63p4r5i51zoyjrm-32j1v7

Principal components of a list of color images:

https://wolfram.com/xid/0b6jc6p63p4r5i51zoyjrm-ouqstd

Specify the transformation matrix:

https://wolfram.com/xid/0b6jc6p63p4r5i51zoyjrm-zsnmgd

Use a transformation matrix and lesser datasets:

https://wolfram.com/xid/0b6jc6p63p4r5i51zoyjrm-prlgd3

Options (1)Common values & functionality for each option
Applications (3)Sample problems that can be solved with this function
Enhance the color contrast of an RGB image:

https://wolfram.com/xid/0b6jc6p63p4r5i51zoyjrm-c1h72f

Reconstruct a multichannel image from 1, 2, or 3 components:

https://wolfram.com/xid/0b6jc6p63p4r5i51zoyjrm-iqpvla

Transform a list of pictorial faces:

https://wolfram.com/xid/0b6jc6p63p4r5i51zoyjrm-exvhvo

Show the residual images when using only the first three components:

https://wolfram.com/xid/0b6jc6p63p4r5i51zoyjrm-9lk0x

Properties & Relations (7)Properties of the function, and connections to other functions
The Karhunen–Loeve decomposition preserves the total variance:

https://wolfram.com/xid/0b6jc6p63p4r5i51zoyjrm-xfttmi


https://wolfram.com/xid/0b6jc6p63p4r5i51zoyjrm-m3ehi9

The Karhunen–Loeve decomposition yields uncorrelated sets:

https://wolfram.com/xid/0b6jc6p63p4r5i51zoyjrm-f0wukw

https://wolfram.com/xid/0b6jc6p63p4r5i51zoyjrm-f89dvf

The Karhunen–Loeve decomposition yields an orthogonal transformation matrix:

https://wolfram.com/xid/0b6jc6p63p4r5i51zoyjrm-ng385z

https://wolfram.com/xid/0b6jc6p63p4r5i51zoyjrm-t4u4e8

Relation to PrincipalComponents:

https://wolfram.com/xid/0b6jc6p63p4r5i51zoyjrm-dnw4l2


https://wolfram.com/xid/0b6jc6p63p4r5i51zoyjrm-bav5vr

A setting Standardized->True is equivalent to subtracting the mean from the input data:

https://wolfram.com/xid/0b6jc6p63p4r5i51zoyjrm-7ff1rn


https://wolfram.com/xid/0b6jc6p63p4r5i51zoyjrm-nvp2ii

Normalizing by the square root of the number of datasets better preserves the input dynamics:

https://wolfram.com/xid/0b6jc6p63p4r5i51zoyjrm-gucqhn

KarhunenLoeveDecomposition normally returns images of a real type:

https://wolfram.com/xid/0b6jc6p63p4r5i51zoyjrm-buunxk

Wolfram Research (2010), KarhunenLoeveDecomposition, Wolfram Language function, https://reference.wolfram.com/language/ref/KarhunenLoeveDecomposition.html (updated 2015).
Text
Wolfram Research (2010), KarhunenLoeveDecomposition, Wolfram Language function, https://reference.wolfram.com/language/ref/KarhunenLoeveDecomposition.html (updated 2015).
Wolfram Research (2010), KarhunenLoeveDecomposition, Wolfram Language function, https://reference.wolfram.com/language/ref/KarhunenLoeveDecomposition.html (updated 2015).
CMS
Wolfram Language. 2010. "KarhunenLoeveDecomposition." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/KarhunenLoeveDecomposition.html.
Wolfram Language. 2010. "KarhunenLoeveDecomposition." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/KarhunenLoeveDecomposition.html.
APA
Wolfram Language. (2010). KarhunenLoeveDecomposition. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/KarhunenLoeveDecomposition.html
Wolfram Language. (2010). KarhunenLoeveDecomposition. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/KarhunenLoeveDecomposition.html
BibTeX
@misc{reference.wolfram_2025_karhunenloevedecomposition, author="Wolfram Research", title="{KarhunenLoeveDecomposition}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/KarhunenLoeveDecomposition.html}", note=[Accessed: 13-May-2025
]}
BibLaTeX
@online{reference.wolfram_2025_karhunenloevedecomposition, organization={Wolfram Research}, title={KarhunenLoeveDecomposition}, year={2015}, url={https://reference.wolfram.com/language/ref/KarhunenLoeveDecomposition.html}, note=[Accessed: 13-May-2025
]}