Skip to content

Commit 962c3c9

Browse files
author
Martin D. Weinberg
committed
Added doc for new 'wCorr*' behavior
1 parent b870b3b commit 962c3c9

1 file changed

Lines changed: 62 additions & 29 deletions

File tree

pyEXP/MSSAWrappers.cc

Lines changed: 62 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,12 @@ void MSSAtoolkitClasses(py::module &m) {
366366
367367
Notes
368368
-----
369+
The w-correlation matrix needs the reconstructed trajectory matrices for each
370+
of the eigenvalue, PC pairs. Calling this method will recompute the reconstruction
371+
for all eigenvalues up to 'nPC' and return an nPC x nPC matrix. If the 'nPC'
372+
parameter is not specified, it will be set to `numpc` used to construct the
373+
instance. Any previous reconstruction will be overwritten.
374+
369375
Returns the combined cosine+sine correlation for complex types for viewing
370376
(e.g., with 'imshow').
371377
@@ -390,8 +396,15 @@ void MSSAtoolkitClasses(py::module &m) {
390396
391397
Notes
392398
-----
393-
The index key here is 'extended' by the prefixed component index
399+
The index key here is 'extended' by the prefixed component index.
394400
401+
Computation of the w-correlation matrix needs the reconstructed
402+
trajectory matrices for each of the (eigenvalue, PC) pairs. Calling
403+
this method will recompute the reconstruction for all eigenvalues up to
404+
order 'npc' and return an (nPC x nPC) matrix. If the 'nPC' parameter is
405+
not specified, it will be set to the `numpc` used in the original
406+
construction. Any prior reconstruction will be overwritten.
407+
395408
The rows and columns contain distinct cosine and sine indicies if the channel
396409
is complex valued.
397410
@@ -419,8 +432,15 @@ void MSSAtoolkitClasses(py::module &m) {
419432
420433
Notes
421434
-----
422-
The w-correlation values range from 0 to 1, where a higher value corresponds to a
423-
stronger correlation.
435+
The w-correlation values range from 0 to 1, where a higher value
436+
corresponds to a stronger correlation.
437+
438+
Computation of the w-correlation matrix needs the reconstructed
439+
trajectory matrices for each of the (eigenvalue, PC) pairs. Calling
440+
this method will recompute the reconstruction for all eigenvalues up to
441+
order 'npc' and return an (nPC x nPC) matrix. If the 'nPC' parameter is
442+
not specified, it will be set to the `numpc` used in the original
443+
construction. Any prior reconstruction will be overwritten.
424444
425445
See also
426446
--------
@@ -441,8 +461,15 @@ void MSSAtoolkitClasses(py::module &m) {
441461
442462
Notes
443463
-----
444-
The w-correlation values range from 0 to 1, where a higher value corresponds to a
445-
stronger correlation.
464+
The w-correlation values range from 0 to 1, where a higher value
465+
corresponds to a stronger correlation.
466+
467+
Computation of the w-correlation matrix needs the reconstructed
468+
trajectory matrices for each of the (eigenvalue, PC) pairs. Calling
469+
this method will recompute the reconstruction for all eigenvalues up to
470+
order 'npc' and return an (nPC x nPC) matrix. If the 'nPC' parameter is
471+
not specified, it will be set to the `numpc` used in the original
472+
construction. Any prior reconstruction will be overwritten.
446473
447474
See also
448475
--------
@@ -455,17 +482,18 @@ void MSSAtoolkitClasses(py::module &m) {
455482
py::arg("clusters") = 4,
456483
py::arg("stride") = 2,
457484
R"(
458-
Do a k-means analysis on the reconstructed trajectory matrices for a single channel (specified key value) to
459-
provide grouping insight. A vector of channel indices that identify clusters is return in a vector ordered by PC
460-
index.
485+
Do a k-means analysis on the reconstructed trajectory matrices for a
486+
single channel (specified key value) to provide grouping insight. A
487+
vector of channel indices that identify clusters is return in a vector
488+
ordered by PC index.
461489
462490
Parameters
463491
----------
464492
clusters : int, default=4
465493
number of clusters for the k-means analysis
466494
stride : int, default=2
467-
if positive, the initial cluster centers are stride selected from the PC list. If zero, the centers are
468-
selected randomly from the PC list
495+
if positive, the initial cluster centers are stride selected from the PC list.
496+
If zero, the centers are selected randomly from the PC list
469497
470498
Returns
471499
-------
@@ -476,24 +504,29 @@ void MSSAtoolkitClasses(py::module &m) {
476504
477505
Notes
478506
-----
479-
The k-means partitions n vector observations into k clusters in which each observation belongs to the cluster with
480-
the nearest centers while minimizing the variance within each cluster. In this case, the vectors are the full
481-
trajectory matrices and the distance is the distance between the trajectory matricies reconstructed from each
482-
eigentriple from mSSA. The distance used here is the Frobenius distance or matrix norm distance: the square root
483-
of the sum of squares of all elements in the difference between two matrices.
484-
485-
This version does the analysis for all channels together, the most useful for estimating groups. For individual
486-
contributions by channel, use kmeansChannel.
507+
The k-means partitions n vector observations into k clusters in which
508+
each observation belongs to the cluster with the nearest centers while
509+
minimizing the variance within each cluster. In this case, the vectors
510+
are the full trajectory matrices and the distance is the distance
511+
between the trajectory matricies reconstructed from each eigentriple
512+
from mSSA. The distance used here is the Frobenius distance or matrix
513+
norm distance: the square root of the sum of squares of all elements in
514+
the difference between two matrices.
515+
516+
This version does the analysis for all channels together, the most
517+
useful for estimating groups. For individual contributions by channel,
518+
use kmeansChannel.
487519
)");
488520

489521
f.def("kmeansChannel", &expMSSA::kmeansChannel,
490522
py::arg("key"),
491523
py::arg("clusters") = 4,
492524
py::arg("stride") = 2,
493525
R"(
494-
Do a k-means analysis on the reconstructed trajectory matrices for a single channel (specified key value) to
495-
provide grouping insight. In most cases, you will want to use the kmeans() version which analyzes all channels
496-
together.
526+
Do a k-means analysis on the reconstructed trajectory matrices for a
527+
single channel (specified key value) to provide grouping insight. In
528+
most cases, you will want to use the kmeans() version which analyzes all
529+
channels together.
497530
498531
Parameters
499532
----------
@@ -529,18 +562,18 @@ void MSSAtoolkitClasses(py::module &m) {
529562
- F: Each PC's contribution to each channel. The columns are L2 normed.
530563
- G: Each channel's contribution to each PC. The rows are L2 normed.
531564
532-
By default, channels for non-zero 'm' are split into cosine and sine components
533-
from the real+imaginary values.
565+
By default, channels for non-zero 'm' are split into cosine and sine
566+
components from the real+imaginary values.
534567
535-
The L2 norm, or Euclidean norm, computes the length of a vector in a multi-dimensional space.
536-
For a vector v = [v1, v2, ..., vn], the L2 norm is calculated as sqrt(v1^2 + v2^2 + ... + vn^2).
568+
The L2 norm, or Euclidean norm, computes the length of a vector in a
569+
multi-dimensional space. For a vector v = [v1, v2, ..., vn], the L2
570+
norm is calculated as sqrt(v1^2 + v2^2 + ... + vn^2).
537571
538-
The L2 normed views provide a measure of the relative contribution of each PC to each channel
539-
and the relative contribution of each channel to each PC. These contributions can be plotted
540-
using 'imshow'.
572+
The L2 normed views provide a measure of the relative contribution of
573+
each PC to each channel and the relative contribution of each channel to
574+
each PC. These contributions can be plotted using 'imshow'.
541575
)");
542576

543-
544577
f.def("saveState", &expMSSA::saveState,
545578
R"(
546579
Save the current MSSA state to an HDF5 file

0 commit comments

Comments
 (0)