Deprecation Notice: With the introduction of daal4py, a package that supersedes PyDAAL, Intel is deprecating PyDAAL and will discontinue support starting with Intel® DAAL 2021 and Intel® Distribution for Python 2021. Until then Intel will continue to provide compatible pyDAAL pip and conda packages for newer releases of Intel DAAL and make it available in open source. However, Intel will not add the new features of Intel DAAL to pyDAAL. Intel recommends developers switch to and use daal4py.
Note: To find daal4py examples, refer to daal4py documentation or browse github repository.
32 from daal.data_management
import Compressor_Zlib, Decompressor_Zlib, level9, DecompressionStream, CompressionStream
34 utils_folder = os.path.realpath(os.path.abspath(os.path.dirname(os.path.dirname(__file__))))
35 if utils_folder
not in sys.path:
36 sys.path.insert(0, utils_folder)
37 from utils
import getCRC32, readTextFile
39 DATA_PREFIX = os.path.join(
'..',
'data',
'batch')
40 datasetFileName = os.path.join(DATA_PREFIX,
'logitboost_train.csv')
43 def printCRC32(rawData, deCompressedData):
46 crcRawData = getCRC32(rawData)
47 crcDecompressedData = getCRC32(deCompressedData)
49 print(
"\nCompression example program results:\n")
51 print(
"Raw data checksum: 0x{:02X}".format(crcRawData))
52 print(
"Decompressed data checksum: 0x{:02X}".format(crcDecompressedData))
54 if rawData.size != deCompressedData.size:
55 print(
"ERROR: Decompressed data size mismatches with the raw data size")
57 elif crcRawData != crcDecompressedData:
58 print(
"ERROR: Decompressed data CRC mismatches with the raw data CRC")
61 print(
"OK: Decompressed data CRC matches with the raw data CRC")
64 if __name__ ==
"__main__":
66 rawData = readTextFile(datasetFileName)
69 compressor = Compressor_Zlib()
70 compressor.parameter.gzHeader =
True
71 compressor.parameter.level = level9
74 comprStream = CompressionStream(compressor)
77 comprStream.push_back(rawData)
80 compressedData = np.empty(comprStream.getCompressedDataSize(), dtype=np.uint8)
83 comprStream.copyCompressedArray(compressedData)
86 decompressor = Decompressor_Zlib()
87 decompressor.parameter.gzHeader =
True
90 deComprStream = DecompressionStream(decompressor)
93 deComprStream.push_back(compressedData)
96 deCompressedData = np.empty(deComprStream.getDecompressedDataSize(), dtype=np.uint8)
99 deComprStream.copyDecompressedArray(deCompressedData)
102 printCRC32(rawData, deCompressedData)