Download quick_test.py from osteele/enumerative-entropy-coding: direct link, hf CLI and curl.
- Browser
- Download file 831 Bytes
-
https://huggingface.co/osteele/enumerative-entropy-coding/resolve/24c19d8a83a00734d89b3315a447ddbd69b2da12/quick_test.py
- Command line
-
hf download hf://osteele/enumerative-entropy-coding@24c19d8a83a00734d89b3315a447ddbd69b2da12/quick_test.py
-
curl -L -o quick_test.py https://huggingface.co/osteele/enumerative-entropy-coding/resolve/24c19d8a83a00734d89b3315a447ddbd69b2da12/quick_test.py
831 Bytes
| #!/usr/bin/env python3 | |
| """Quick test with smaller datasets to verify functionality.""" | |
| import numpy as np | |
| from enumerative_coding import EnumerativeEncoder | |
| from entropy_coding import HuffmanEncoder, theoretical_minimum_size | |
| from test_compression import generate_iid_data, compress_and_compare, print_results | |
| def main(): | |
| np.random.seed(42) | |
| # Test with a small dataset | |
| print("Testing with small uniform dataset...") | |
| data = generate_iid_data(100, 10, 'uniform') | |
| results = compress_and_compare(data, "small_test") | |
| print_results(results) | |
| # Test with non-uniform distribution | |
| print("\nTesting with small Zipf dataset...") | |
| data = generate_iid_data(100, 10, 'zipf') | |
| results = compress_and_compare(data, "small_zipf_test") | |
| print_results(results) | |
| if __name__ == "__main__": | |
| main() |