LDA
The LDA algorithms in the Shark-ML library are implemented in the LDA class. First, we have to train the algorithm with the train() method, which takes two parameters: the first one is a reference to the object of the LinearClassifier class, while the second is the dataset reference. Notice that the LDA algorithm uses objects of LinearClassifier because, in the Shark-ML library, LDA is used mostly for classification. Also, because this is a supervised algorithm, we should provide labels for the data. We can do this by initializing the LabeledData<RealVector, unsigned int> class object. In the following example, we can see how to combine UnlabeledData<RealVector> datasets with the labeled one. Note that labels should start from 0.
After ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access