PrincipalComponentAnalysis Class

Represents the Principal Component Analysis (PCA) of a set of data.

Definition

Namespace: Numerics.NET.Statistics.Multivariate
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4
C#
public sealed class PrincipalComponentAnalysis : TransformationModel<double>
Inheritance
Object  →  Model  →  TransformationModel<Double>  →  PrincipalComponentAnalysis

Remarks

Use the PrincipalComponentAnalysis class to obtain information about the components that contribute the most to the variation in a dataset. The data for the analysis can be supplied in a variety of formats, including as a data frame, an array of numerical vectors, or a matrix.

The [!:Standardize] property determines whether each variable should be rescaled to have zero mean and unit standard deviation. The Fit() method performs the actual calculation.

Once the analysis has been completed, the Components property provides access to a collection of PrincipalComponent objects that provide details about each of the principal components. The components are sorted in order of their contribution to the variance in the data, in descending order. The ComponentMatrix property returns the components as the columns of a matrix. The ScoreMatrix property expresses the observations in terms of the components. The GetPredictions(Int32) method returns the observations if only the specified number of components is taken into account.

The VarianceProportions and CumulativeVarianceProportions summarize the contribution of each component. The GetVarianceThreshold(Double) calculates how many components are needed to explain a certain proportion of the variation.

Constructors

PrincipalComponentAnalysis(IDataFrame) Constructs a new PrincipalComponentAnalysis object.
PrincipalComponentAnalysis(Matrix<Double>) Constructs a new PrincipalComponentAnalysis object.
PrincipalComponentAnalysis(Vector<Double>[]) Constructs a new PrincipalComponentAnalysis object.
PrincipalComponentAnalysis(IDataFrame, String) Constructs a new PrincipalComponentAnalysis object.
PrincipalComponentAnalysis(IDataFrame, String[]) Constructs a new PrincipalComponentAnalysis object.

Properties

BaseFeatureIndex Gets an index containing the keys of the columns that are required inputs to the model.
(Inherited from Model)
Center Gets or sets whether the variables should be centered prior to computing the principal components.
ComponentMatrix Gets the matrix whose columns contain the principal components.
Components Returns the collection of principal components.
Computed Gets whether the model has been computed.
(Inherited from Model)
Obsolete.
CumulativeVarianceProportions Gets the cumulative proportion of the variance that is explained by the components.
Data Gets an object that contains all the data used as input to the model.
(Inherited from Model)
Eigenvalues Gets the eigenvalues corresponding to each of the components.
Features Gets a matrix that contains the features.
(Inherited from TransformationModel<T>)
Fitted Gets whether the model has been computed.
(Inherited from Model)
InputSchema Gets the schema for the features used for fitting the model.
(Inherited from Model)
LoadingsMatrix Gets the matrix of component loadings.
MaxDegreeOfParallelism Gets or sets the maximum degree of parallelism enabled by this instance.
(Inherited from Model)
ModelSchema Gets the collection of variables used in the model.
(Inherited from Model)
NumberOfComponents Gets or sets the number of components to retain.
NumberOfObservations Gets the number of observations the model is based on.
(Inherited from Model)
ScalingMethod Gets or sets the method used to scale the variables.
ScoreMatrix Gets the matrix of component scores.
Status Gets the status of the model, which determines which information is available.
(Inherited from Model)
SupportsWeights Indicates whether the model supports case weights.
(Inherited from Model)
VarianceProportions Gets the proportion of the variance that is explained by each of the components.
Weights Gets or sets the actual weights.
(Inherited from Model)

Methods

Compute() Computes the model.
(Inherited from Model)
Obsolete.
Compute(ParallelOptions) Computes the model.
(Inherited from Model)
Obsolete.
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Fit() Fits the model to the data.
(Inherited from Model)
Fit(ParallelOptions) Fits the model to the data.
(Inherited from Model)
GetBrokenStickThreshold Returns the number of components to retain based on the broken stick criterion.
GetEigenvalueThreshold Returns the number of components to retain based on whether the corresponding eigenvalues are greater than the specified value.
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetMahalanobisDistance Returns the Mahalanobis distance of the observations to the centroid of the observations.
GetPredictions Returns the predicted values of the variables based on the specified number of components.
GetTypeGets the Type of the current instance.
(Inherited from Object)
GetVarianceThreshold Returns the number of components needed to explain the requested proportion of the variance in the data.
InverseTransform(Matrix<Double>) Applies the inverse transformation to a set of observations.
(Inherited from TransformationModel<T>)
InverseTransform(Vector<Double>) Applies the inverse transformation to a set of observations.
(Inherited from TransformationModel<T>)
InverseTransformInto(Matrix<Double>, Matrix<Double>) Applies the inverse transformation to a set of observations.
(Overrides TransformationModel<T>.InverseTransformInto(Matrix<Double>, Matrix<Double>))
InverseTransformInto(Vector<Double>, Vector<Double>) Applies the inverse transformation to a set of observations.
(Overrides TransformationModel<T>.InverseTransformInto(Vector<Double>, Vector<Double>))
ResetComputation Clears all fitted model parameters.
(Inherited from Model)
Obsolete.
ResetFit Clears all fitted model parameters.
(Inherited from Model)
SetDataSource Uses the specified data frame as the source for all input variables.
(Inherited from Model)
Summarize() Returns a string containing a human-readable summary of the object using default options.
(Inherited from Model)
Summarize(SummaryOptions) Returns a string containing a human-readable summary of the object using the specified options.
(Inherited from Model)
ToStringReturns a string that represents the current object.
(Inherited from Model)
Transform(Matrix<Double>) Applies the transformation to a set of observations.
(Inherited from TransformationModel<T>)
Transform(Vector<Double>) Applies the transformation to a single observation.
(Inherited from TransformationModel<T>)
TransformInto(Matrix<Double>, Matrix<Double>) Applies the transformation to a set of observations.
(Overrides TransformationModel<T>.TransformInto(Matrix<Double>, Matrix<Double>))
TransformInto(Vector<Double>, Vector<Double>) Applies the transformation to a single observation.
(Overrides TransformationModel<T>.TransformInto(Vector<Double>, Vector<Double>))

See Also