48 from daal.algorithms
import low_order_moments
50 utils_folder = os.path.realpath(os.path.abspath(os.path.dirname(os.path.dirname(__file__))))
51 if utils_folder
not in sys.path:
52 sys.path.insert(0, utils_folder)
53 from utils
import printNumericTable, createSparseTable
55 DAAL_PREFIX = os.path.join(
'..',
'data')
59 datasetFileName = os.path.join(DAAL_PREFIX,
'batch',
'covcormoments_csr.csv')
62 def printResults(res):
64 printNumericTable(res.get(low_order_moments.minimum),
"Minimum:")
65 printNumericTable(res.get(low_order_moments.maximum),
"Maximum:")
66 printNumericTable(res.get(low_order_moments.sum),
"Sum:")
67 printNumericTable(res.get(low_order_moments.sumSquares),
"Sum of squares:")
68 printNumericTable(res.get(low_order_moments.sumSquaresCentered),
"Sum of squared difference from the means:")
69 printNumericTable(res.get(low_order_moments.mean),
"Mean:")
70 printNumericTable(res.get(low_order_moments.secondOrderRawMoment),
"Second order raw moment:")
71 printNumericTable(res.get(low_order_moments.variance),
"Variance:")
72 printNumericTable(res.get(low_order_moments.standardDeviation),
"Standard deviation:")
73 printNumericTable(res.get(low_order_moments.variation),
"Variation:")
75 if __name__ ==
"__main__":
78 dataTable = createSparseTable(datasetFileName)
81 algorithm = low_order_moments.Batch()
84 algorithm.input.set(low_order_moments.data, dataTable)
87 res = algorithm.compute()