MCPcopy Create free account
hub / github.com/bamler-lab/constriction / fixed_model_params

Function fixed_model_params

tests/python/test_docexamples.py:675–686  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

673
674def test_custom_model_ans():
675 def fixed_model_params():
676 model_scipy = scipy.stats.cauchy(loc=10.3, scale=5.8)
677 # Wrap the scipy-model in a `CustomModel`, which will implicitly
678 # quantize it to integers in the given range from -100 to 100 (both
679 # ends inclusively).
680 model = constriction.stream.model.CustomModel(
681 model_scipy.cdf, model_scipy.ppf, -100, 100)
682
683 symbols = np.array([5, 14, -1, 21], dtype=np.int32)
684 coder = constriction.stream.stack.AnsCoder()
685 coder.encode_reverse(symbols, model)
686 assert np.all(coder.decode(model, 4) == symbols)
687
688 def variable_model_params():
689 # The optional argument `params` will receive a 1-d python array when

Callers 3

test_custom_model_ansFunction · 0.70
test_custom_model_rangeFunction · 0.70

Calls 8

encode_reverseMethod · 0.95
decodeMethod · 0.95
encodeMethod · 0.95
get_compressedMethod · 0.95
decodeMethod · 0.95
decodeMethod · 0.95
encode_reverseMethod · 0.95
get_dataMethod · 0.95

Tested by

no test coverage detected