#include "daal.h"
#include "service.h"
using namespace std;
using namespace daal;
using namespace daal::algorithms;
const size_t nVectorsInBlock = 250;
const string dataFileName = "../data/online/pca_normalized.csv";
int main(int argc, char *argv[])
{
checkArguments(argc, argv, 1, &dataFileName);
FileDataSource<CSVFeatureManager> dataSource(dataFileName, DataSource::doAllocateNumericTable,
DataSource::doDictionaryFromContext);
pca::Online<> algorithm;
while(dataSource.loadDataBlock(nVectorsInBlock) == nVectorsInBlock)
{
algorithm.input.set(pca::data, dataSource.getNumericTable());
algorithm.compute();
}
algorithm.finalizeCompute();
pca::ResultPtr result = algorithm.getResult();
printNumericTable(result->get(pca::eigenvalues), "Eigenvalues:");
printNumericTable(result->get(pca::eigenvectors), "Eigenvectors:");
return 0;
}