See Release Notes
Long Term Support Release
(no description)
File Size: | 223 lines (7 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
LDA:: (8 methods):
__construct()
fit()
transform()
getLabels()
calculateMeans()
calculateClassVar()
calculateClassCov()
calculateVar()
__construct(?float $totalVariance = null, ?int $numFeatures = null) X-Ref |
Linear Discriminant Analysis (LDA) is used to reduce the dimensionality of the data. Unlike Principal Component Analysis (PCA), it is a supervised technique that requires the class labels in order to fit the data to a lower dimensional space. <br><br> The algorithm can be initialized by speciyfing either with the totalVariance(a value between 0.1 and 0.99) or numFeatures (number of features in the dataset) to be preserved. param: float|null $totalVariance Total explained variance to be preserved param: int|null $numFeatures Number of features to be preserved |
fit(array $data, array $classes) X-Ref |
Trains the algorithm to transform the given data to a lower dimensional space. |
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>. |
getLabels(array $classes) X-Ref |
Returns unique labels in the dataset |
calculateMeans(array $data, array $classes) X-Ref |
Calculates mean of each column for each class and returns n by m matrix where n is number of labels and m is number of columns |
calculateClassVar(array $data, array $classes) X-Ref |
Returns in-class scatter matrix for each class, which is a n by m matrix where n is number of classes and m is number of columns |
calculateClassCov() X-Ref |
Returns between-class scatter matrix for each class, which is an n by m matrix where n is number of classes and m is number of columns |
calculateVar(array $row, array $means) X-Ref |
Returns the result of the calculation (x - m)T.(x - m) |