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')
33 datasetFileName = os.path.join(DAAL_PREFIX,
'batch',
'covcormoments_csr.csv')
36 def printResults(res):
38 printNumericTable(res.get(low_order_moments.minimum),
"Minimum:")
39 printNumericTable(res.get(low_order_moments.maximum),
"Maximum:")
40 printNumericTable(res.get(low_order_moments.sum),
"Sum:")
41 printNumericTable(res.get(low_order_moments.sumSquares),
"Sum of squares:")
42 printNumericTable(res.get(low_order_moments.sumSquaresCentered),
"Sum of squared difference from the means:")
43 printNumericTable(res.get(low_order_moments.mean),
"Mean:")
44 printNumericTable(res.get(low_order_moments.secondOrderRawMoment),
"Second order raw moment:")
45 printNumericTable(res.get(low_order_moments.variance),
"Variance:")
46 printNumericTable(res.get(low_order_moments.standardDeviation),
"Standard deviation:")
47 printNumericTable(res.get(low_order_moments.variation),
"Variation:")
49 if __name__ ==
"__main__":
52 dataTable = createSparseTable(datasetFileName)
55 algorithm = low_order_moments.Batch()
58 algorithm.input.set(low_order_moments.data, dataTable)
61 res = algorithm.compute()