#include "daal.h"
#include "service.h"
using namespace std;
using namespace daal;
using namespace daal::algorithms;
string datasetFileName = "../data/batch/apriori.csv";
const double minSupport = 0.001;
const double minConfidence = 0.7;
int main(int argc, char *argv[])
{
checkArguments(argc, argv, 1, &datasetFileName);
FileDataSource<CSVFeatureManager> dataSource(datasetFileName, DataSource::doAllocateNumericTable,
DataSource::doDictionaryFromContext);
dataSource.loadDataBlock();
association_rules::Batch<> algorithm;
algorithm.input.set(association_rules::data, dataSource.getNumericTable());
algorithm.parameter.minSupport = minSupport;
algorithm.parameter.minConfidence = minConfidence;
algorithm.compute();
services::SharedPtr<association_rules::Result> res = algorithm.getResult();
printAprioriItemsets(res->get(association_rules::largeItemsets),
res->get(association_rules::largeItemsetsSupport));
printAprioriRules(res->get(association_rules::antecedentItemsets),
res->get(association_rules::consequentItemsets),
res->get(association_rules::confidence));
return 0;
}