47 from daal.algorithms
import low_order_moments
49 utils_folder = os.path.realpath(os.path.abspath(os.path.dirname(os.path.dirname(__file__))))
50 if utils_folder
not in sys.path:
51 sys.path.insert(0, utils_folder)
52 from utils
import printNumericTable, createSparseTable
54 DAAL_PREFIX = os.path.join(
'..',
'data')
60 os.path.join(DAAL_PREFIX,
'online',
'covcormoments_csr_1.csv'),
61 os.path.join(DAAL_PREFIX,
'online',
'covcormoments_csr_2.csv'),
62 os.path.join(DAAL_PREFIX,
'online',
'covcormoments_csr_3.csv'),
63 os.path.join(DAAL_PREFIX,
'online',
'covcormoments_csr_4.csv')
67 def printResults(res):
68 printNumericTable(res.get(low_order_moments.minimum),
"Minimum:")
69 printNumericTable(res.get(low_order_moments.maximum),
"Maximum:")
70 printNumericTable(res.get(low_order_moments.sum),
"Sum:")
71 printNumericTable(res.get(low_order_moments.sumSquares),
"Sum of squares:")
72 printNumericTable(res.get(low_order_moments.sumSquaresCentered),
"Sum of squared difference from the means:")
73 printNumericTable(res.get(low_order_moments.mean),
"Mean:")
74 printNumericTable(res.get(low_order_moments.secondOrderRawMoment),
"Second order raw moment:")
75 printNumericTable(res.get(low_order_moments.variance),
"Variance:")
76 printNumericTable(res.get(low_order_moments.standardDeviation),
"Standard deviation:")
77 printNumericTable(res.get(low_order_moments.variation),
"Variation:")
79 if __name__ ==
"__main__":
82 algorithm = low_order_moments.Online()
84 for i
in range(nBlocks):
85 dataTable = createSparseTable(datasetFileNames[i])
88 algorithm.input.set(low_order_moments.data, dataTable)
94 res = algorithm.finalizeCompute()