math

package
v0.0.0-...-d2369fc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExplainedVarianceGraph

func ExplainedVarianceGraph(root *op.Scope, phs tf.Output, numSamples int) tf.Output

func SvdFlipU

func SvdFlipU(scope *op.Scope, signProdMat, u tf.Output) tf.Output

SvdFlipU flips the u matrix from svd.

func SvdFlipV

func SvdFlipV(scope *op.Scope, signProdMat, v tf.Output) tf.Output

SvdFlipV flips the v matrix from svd.

func SvdGraph

func SvdGraph(root *op.Scope, x tf.Output) (tf.Output, tf.Output, tf.Output, tf.Output)

SvdGraph implements the svd and mean to be used to calculate the pca.

func SvdSignU

func SvdSignU(scope *op.Scope, u tf.Output) tf.Output

SvdSignU calculate the matrix with the signals from u.

func TransGraph

func TransGraph(root *op.Scope, x, mean, v tf.Output, comps int) tf.Output

TransGraph is the sub graph to approximate the pca.

Types

type PCA

type PCA struct {
	Mean float64
	S    []float64
	U    [][]float64
	V    [][]float64
	// contains filtered or unexported fields
}

PCA calc the PCA...

func NewPCA

func NewPCA(components int) *PCA

NewPCA creates a new PCA struct.

func (*PCA) Accumulated

func (p *PCA) Accumulated() (*mat.VecDense, error)

func (*PCA) ExplainedVariance

func (p *PCA) ExplainedVariance() (*mat.VecDense, error)

ExplainedVariance is the amount of variance explained by each of the selected components.

func (*PCA) ExplainedVarianceRatio

func (p *PCA) ExplainedVarianceRatio() (*mat.VecDense, error)

ExplainedVarianceRatio is the percentage of variance explained by each of the selected components. If “n_components“ is not set then all components are stored and the sum of explained variances is equal to 1.0.

func (*PCA) Fit

func (p *PCA) Fit(dense *mat.Dense) (*PCA, error)

Fit finds the svd and flip it.

func (*PCA) FitTransform

func (p *PCA) FitTransform(dense *mat.Dense) (*mat.Dense, error)

FitTransform approximate the pca like in fit and calculate the transformed matrix.

func (*PCA) NumComponents

func (p *PCA) NumComponents() (int, error)

NumComponents return the number of resulting components.

func (*PCA) Transform

func (p *PCA) Transform(dense *mat.Dense) (*mat.Dense, error)

Transform calculate the pca from the input matrix.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL