Skip to content
This repository has been archived by the owner on Dec 22, 2018. It is now read-only.

Commit

Permalink
stat: address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kortschak committed Dec 21, 2016
1 parent 1c1eb49 commit dbd7b00
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pca_cca.go
Expand Up @@ -13,9 +13,9 @@ import (
"github.com/gonum/matrix/mat64"
)

// PC is the result of a principal components analysis. The results of a principal
// components analysis held by a PC are only valid after a call to PrincipalComponents
// has returned true.
// PC is a type for computing and extracting the principal components of a
// matrix. The results of the principal components analysis are only valid
// if the call to PrincipalComponents was successful.
type PC struct {
n, d int
weights []float64
Expand All @@ -29,11 +29,11 @@ type PC struct {
//
// PrincipalComponents centers the variables but does not scale the variance.
//
// The slice weights is used to weight the observations. If weights is nil, each
// The weights slice is used to weight the observations. If weights is nil, each
// weight is considered to have a value of one, otherwise the length of weights
// must match the number of observations or PrincipalComponents will panic.
//
// PrincipleComponents returns whether the analysis was successful.
// PrincipalComponents returns whether the analysis was successful.
func (c *PC) PrincipalComponents(a mat64.Matrix, weights []float64) (ok bool) {
c.n, c.d = a.Dims()
if weights != nil && len(weights) != c.n {
Expand Down Expand Up @@ -66,9 +66,9 @@ func (c *PC) Vectors(dst *mat64.Dense) *mat64.Dense {
}

// Vars returns the column variances of the principal component scores,
// b * vecs where b is a matrix with centered columns. Variances are returned
// in descending sort order.
// If dst is not nil is is used to store the variances and returned.
// b * vecs, where b is a matrix with centered columns. Variances are returned
// in descending order.
// If dst is not nil it is used to store the variances and returned.
// Vars will panic if the receiver has not successfully performed a principal
// components analysis or dst is not nil and the length of dst is not min(n, d).
func (c *PC) Vars(dst []float64) []float64 {
Expand Down

0 comments on commit dbd7b00

Please sign in to comment.