22 from daal.algorithms
import low_order_moments
24 utils_folder = os.path.realpath(os.path.abspath(os.path.dirname(os.path.dirname(__file__))))
25 if utils_folder
not in sys.path:
26 sys.path.insert(0, utils_folder)
27 from utils
import printNumericTable, createSparseTable
29 DAAL_PREFIX = os.path.join(
'..',
'data')
35 os.path.join(DAAL_PREFIX,
'online',
'covcormoments_csr_1.csv'),
36 os.path.join(DAAL_PREFIX,
'online',
'covcormoments_csr_2.csv'),
37 os.path.join(DAAL_PREFIX,
'online',
'covcormoments_csr_3.csv'),
38 os.path.join(DAAL_PREFIX,
'online',
'covcormoments_csr_4.csv')
42 def printResults(res):
43 printNumericTable(res.get(low_order_moments.minimum),
"Minimum:")
44 printNumericTable(res.get(low_order_moments.maximum),
"Maximum:")
45 printNumericTable(res.get(low_order_moments.sum),
"Sum:")
46 printNumericTable(res.get(low_order_moments.sumSquares),
"Sum of squares:")
47 printNumericTable(res.get(low_order_moments.sumSquaresCentered),
"Sum of squared difference from the means:")
48 printNumericTable(res.get(low_order_moments.mean),
"Mean:")
49 printNumericTable(res.get(low_order_moments.secondOrderRawMoment),
"Second order raw moment:")
50 printNumericTable(res.get(low_order_moments.variance),
"Variance:")
51 printNumericTable(res.get(low_order_moments.standardDeviation),
"Standard deviation:")
52 printNumericTable(res.get(low_order_moments.variation),
"Variation:")
54 if __name__ ==
"__main__":
57 algorithm = low_order_moments.Online()
59 for i
in range(nBlocks):
60 dataTable = createSparseTable(datasetFileNames[i])
63 algorithm.input.set(low_order_moments.data, dataTable)
69 res = algorithm.finalizeCompute()