Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

(no description)

File Size: 131 lines (4 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

PCA:: (5 methods):
  __construct()
  fit()
  transform()
  calculateMeans()
  normalize()


Class: PCA  - X-Ref

__construct(?float $totalVariance = null, ?int $numFeatures = null)   X-Ref
PCA (Principal Component Analysis) used to explain given
data with lower number of dimensions. This analysis transforms the
data to a lower dimensional version of it by conserving a proportion of total variance
within the data. It is a lossy data compression technique.<br>

param: float $totalVariance Total explained variance to be preserved
param: int   $numFeatures   Number of features to be preserved

fit(array $data)   X-Ref
Takes a data and returns a lower dimensional version
of this data while preserving $totalVariance or $numFeatures. <br>
$data is an n-by-m matrix and returned array is
n-by-k matrix where k <= m


transform(array $sample)   X-Ref
Transforms the given sample to a lower dimensional vector by using
the eigenVectors obtained in the last run of <code>fit</code>.


calculateMeans(array $data, int $n)   X-Ref
No description

normalize(array $data, int $n)   X-Ref
Normalization of the data includes subtracting mean from
each dimension therefore dimensions will be centered to zero