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