API Reference¶
These pages are generated from the live infotheory_rs binding that the Python package exposes.
Python bindings for infotheory (import name: infotheory_rs).
This module re-exports symbols from the native extension and provides:
ergonomic wrappers for common entry points (ncd_paths, ncd_bytes)
abstract base classes for Python-driven AIXI trait adapters
Callback error policy:
Exceptions raised inside PredictorABC, EnvironmentABC, or AgentSimulatorABC callbacks are treated as fatal by the Rust shim layer.
The process exits after printing callback context and traceback. This avoids silently continuing MCTS/planning with corrupted fallback values.
Functions¶
- infotheory_rs.biased_entropy_rate_backend(data, max_order, backend=None, method=None)¶
- infotheory_rs.biased_entropy_rate_bytes(data, max_order)¶
- infotheory_rs.compress_bytes_backend(data, compression_backend=None, method='5', rate_backend=None, rate_method=None)¶
- infotheory_rs.compress_file(input_path, output_path, compression_backend=None, method='5', rate_backend=None, rate_method=None)¶
- infotheory_rs.compress_size_backend(data, compression_backend=None, method='5', rate_backend=None, rate_method=None)¶
- infotheory_rs.compress_size_chain_backend(parts, compression_backend=None, method='5', rate_backend=None, rate_method=None)¶
- infotheory_rs.conditional_entropy_bytes(x, y, max_order)¶
- infotheory_rs.conditional_entropy_paths(x, y, max_order)¶
- infotheory_rs.conditional_entropy_rate_bytes(x, y, max_order)¶
- infotheory_rs.cross_entropy_bytes(x, y, max_order)¶
- infotheory_rs.cross_entropy_paths(x, y, max_order)¶
- infotheory_rs.cross_entropy_rate_backend(test_data, train_data, max_order, backend=None, method=None)¶
- infotheory_rs.cross_entropy_rate_bytes(x, y, max_order)¶
- infotheory_rs.d_kl_bytes(x, y)¶
- infotheory_rs.decode_bits(symbols, bits)¶
- infotheory_rs.decode_reward_bits(symbols, bits)¶
- infotheory_rs.decode_reward_offset_bits(symbols, bits, offset)¶
- infotheory_rs.decompress_bytes_backend(input, compression_backend=None, method='5', rate_backend=None, rate_method=None)¶
- infotheory_rs.decompress_file(input_path, output_path, compression_backend=None, method='5', rate_backend=None, rate_method=None)¶
- infotheory_rs.encode_bits(value, bits)¶
- infotheory_rs.encode_reward_bits(value, bits)¶
- infotheory_rs.encode_reward_offset_bits(value, bits, offset)¶
- infotheory_rs.entropy_rate_backend(data, max_order, backend=None, method=None)¶
- infotheory_rs.entropy_rate_bytes(data, max_order)¶
- infotheory_rs.environment_probe(environment, actions)¶
- infotheory_rs.generate_bytes(prompt, bytes, max_order=Ellipsis, backend=None, method=None, config=None)¶
- infotheory_rs.generate_bytes_conditional_chain(prefix_parts, bytes, max_order=Ellipsis, backend=None, method=None, config=None)¶
- infotheory_rs.get_bytes_from_paths(paths)¶
- infotheory_rs.get_compressed_size(path, method)¶
- infotheory_rs.get_compressed_size_parallel(path, method, threads)¶
- infotheory_rs.get_compressed_sizes_from_paths(paths, method='5')¶
- infotheory_rs.get_default_ctx()¶
- infotheory_rs.get_parallel_compressed_sizes_from_parallel_paths(paths, method='5', threads=1)¶
- infotheory_rs.get_parallel_compressed_sizes_from_sequential_paths(paths, method='5', threads=1)¶
- infotheory_rs.get_sequential_compressed_sizes_from_parallel_paths(paths, method='5')¶
- infotheory_rs.get_sequential_compressed_sizes_from_sequential_paths(paths, method='5')¶
- infotheory_rs.intrinsic_dependence_bytes(data, max_order)¶
- infotheory_rs.joint_entropy_rate_backend(x, y, max_order, backend=None, method=None)¶
- infotheory_rs.joint_entropy_rate_bytes(x, y, max_order)¶
- infotheory_rs.joint_marginal_entropy_bytes(x, y)¶
- infotheory_rs.js_div_bytes(x, y)¶
- infotheory_rs.js_divergence_paths(x, y)¶
- infotheory_rs.kl_divergence_paths(x, y)¶
- infotheory_rs.marginal_entropy_bytes(data)¶
- infotheory_rs.mutual_information_bytes(x, y, max_order)¶
- infotheory_rs.mutual_information_marg_bytes(x, y)¶
- infotheory_rs.mutual_information_paths(x, y, max_order)¶
- infotheory_rs.mutual_information_rate_backend(x, y, max_order, backend=None, method=None)¶
- infotheory_rs.mutual_information_rate_bytes(x, y, max_order)¶
- infotheory_rs.ncd_bytes(x, y, method='5', variant='vitanyi', backend=None)¶
- infotheory_rs.ncd_bytes_default(x, y, variant='vitanyi')¶
- infotheory_rs.ncd_bytes_with_backend(x, y, backend=None, method=None, variant='vitanyi')¶
- infotheory_rs.ncd_cons(x, y, method='5')¶
- infotheory_rs.ncd_matrix_bytes(datas, method='5', variant='vitanyi')¶
- infotheory_rs.ncd_matrix_bytes_with_backend(datas, backend=None, method=None, variant='vitanyi')¶
- infotheory_rs.ncd_matrix_paths(paths, method='5', variant='vitanyi')¶
- infotheory_rs.ncd_matrix_paths_with_backend(paths, backend=None, method=None, variant='vitanyi')¶
- infotheory_rs.ncd_paths(x, y, method='5', variant='vitanyi', backend=None)¶
- infotheory_rs.ncd_paths_with_backend(x, y, backend=None, method=None, variant='vitanyi')¶
- infotheory_rs.ncd_sym_cons(x, y, method='5')¶
- infotheory_rs.ncd_sym_vitanyi(x, y, method='5')¶
- infotheory_rs.ncd_vitanyi(x, y, method='5')¶
- infotheory_rs.ned_bytes(x, y, max_order)¶
- infotheory_rs.ned_cons_bytes(x, y, max_order)¶
- infotheory_rs.ned_cons_marg_bytes(x, y)¶
- infotheory_rs.ned_cons_rate_bytes(x, y, max_order)¶
- infotheory_rs.ned_marg_bytes(x, y)¶
- infotheory_rs.ned_paths(x, y, max_order)¶
- infotheory_rs.ned_rate_backend(x, y, max_order, backend=None, method=None)¶
- infotheory_rs.ned_rate_bytes(x, y, max_order)¶
- infotheory_rs.nhd_bytes(x, y, max_order)¶
- infotheory_rs.nhd_paths(x, y, max_order)¶
- infotheory_rs.nte_bytes(x, y, max_order)¶
- infotheory_rs.nte_marg_bytes(x, y)¶
- infotheory_rs.nte_paths(x, y, max_order)¶
- infotheory_rs.nte_rate_backend(x, y, max_order, backend=None, method=None)¶
- infotheory_rs.nte_rate_bytes(x, y, max_order)¶
- infotheory_rs.observation_key_from_stream(mode, observations, observation_bits)¶
- infotheory_rs.observation_repr_from_stream(mode, observations, observation_bits)¶
- infotheory_rs.predictor_probe(predictor, steps=8)¶
- infotheory_rs.rate_backend(name, method=None)¶
- infotheory_rs.resistance_to_transformation_bytes(x, tx, max_order)¶
- infotheory_rs.run_agent_with_environment(environment, config, learn_cycles=None, eval_cycles=None, terminate_lifetime=20, explore_epsilon=0.0, explore_gamma=1.0, prev_action=0, check_finished=False)¶
- infotheory_rs.run_aiqi_with_environment(environment, config, learn_cycles=None, eval_cycles=None, terminate_lifetime=20, explore_epsilon=0.0, explore_gamma=1.0, check_finished=False)¶
- infotheory_rs.search(query, target_path, granularity=None, universal_prior=None, stage2_prior_mode=None, max_order=8, top_k=50, stage0_keep_frac=0.2, rate_backend=None, compression_backend=None, method=None)¶
- infotheory_rs.search_with_simulator(simulator, prev_obs_stream, prev_rew, prev_act, num_simulations)¶
- infotheory_rs.set_default_ctx(ctx)¶
- infotheory_rs.tvd_bytes(x, y, max_order)¶
- infotheory_rs.tvd_paths(x, y, max_order)¶
- infotheory_rs.validate_zpaq_rate_method(method)¶
- infotheory_rs.verify_chain_rule(x, y, tolerance=1e-09)¶
- infotheory_rs.verify_conditioning_reduces_entropy(x, y, tolerance=1e-09)¶
- infotheory_rs.verify_entropy_bounds(data)¶
- infotheory_rs.verify_identity(x, y, tolerance=1e-09)¶
- infotheory_rs.verify_mi_nonnegative(x, y)¶
- infotheory_rs.verify_ncd_bounds(x, y)¶
- infotheory_rs.verify_non_negativity(x, y)¶
- infotheory_rs.verify_subadditivity(x, y, tolerance=1e-09)¶
- infotheory_rs.verify_symmetry(x, y, tolerance=1e-09)¶
- infotheory_rs.verify_triangle_inequality(x, y, z, tolerance=1e-09)¶
- infotheory_rs.vm_enabled()¶
Classes and Enums¶
- class infotheory_rs.Agent(config)¶
- get_planned_action(prev_obs_stream, prev_rew, prev_act)¶
- model_update_action_external(action)¶
- model_update_percept(observation, reward)¶
- model_update_percept_stream(observations, reward)¶
- observation_repr_from_stream(observations)¶
- reset()¶
- class infotheory_rs.AgentConfig(algorithm=Ellipsis, ct_depth=16, agent_horizon=6, observation_bits=8, observation_stream_len=1, observation_key_mode=None, reward_bits=8, agent_actions=2, num_simulations=256, exploration_exploitation_ratio=1.41, discount_gamma=1.0, min_reward=Ellipsis, max_reward=127, reward_offset=128, random_seed=None, rwkv_model_path=None, rosa_max_order=None, zpaq_method=None)¶
- class infotheory_rs.AgentSimulatorABC¶
Python-side adapter for the Rust AgentSimulator trait.
- abstractmethod get_num_actions()¶
- Return type:
int
- abstractmethod get_num_observation_bits()¶
- Return type:
int
- observation_stream_len()¶
- Return type:
int
- observation_key_mode()¶
- abstractmethod get_num_reward_bits()¶
- Return type:
int
- abstractmethod horizon()¶
- Return type:
int
- abstractmethod max_reward()¶
- Return type:
int
- abstractmethod min_reward()¶
- Return type:
int
- reward_offset()¶
- Return type:
int
- get_explore_exploit_ratio()¶
- Return type:
float
- discount_gamma()¶
- Return type:
float
- abstractmethod model_update_action(action)¶
- Parameters:
action (int)
- abstractmethod gen_percept_and_update(bits)¶
- Parameters:
bits (int)
- Return type:
int
- abstractmethod model_revert(steps)¶
- Parameters:
steps (int)
- abstractmethod gen_range(end)¶
- Parameters:
end (int)
- Return type:
int
- abstractmethod gen_f64()¶
- Return type:
float
- boxed_clone_with_seed(seed)¶
- Parameters:
seed (int)
- class infotheory_rs.AiqiAgent(config)¶
- get_planned_action()¶
- get_planned_action_with_extra_exploration(extra_exploration=0.0)¶
- num_actions()¶
- observe_transition(action, observations, reward)¶
- steps_observed()¶
- class infotheory_rs.AiqiConfig(algorithm=Ellipsis, ct_depth=16, observation_bits=8, observation_stream_len=1, reward_bits=8, agent_actions=2, min_reward=Ellipsis, max_reward=127, reward_offset=128, discount_gamma=0.99, return_horizon=6, return_bins=32, augmentation_period=None, history_prune_keep_steps=None, baseline_exploration=0.01, random_seed=None, rate_backend=None, rate_backend_max_order=20, rwkv_model_path=None, rosa_max_order=None, zpaq_method=None)¶
- class infotheory_rs.BiasedRockPaperScissorEnv¶
- drain_observations()¶
- get_observation()¶
- get_reward()¶
- is_finished()¶
- perform_action(action)¶
- class infotheory_rs.CalibrationContextKind¶
- ByteClass = CalibrationContextKind.ByteClass¶
- Global = CalibrationContextKind.Global¶
- Repeat = CalibrationContextKind.Repeat¶
- Text = CalibrationContextKind.Text¶
- TextRepeat = CalibrationContextKind.TextRepeat¶
- class infotheory_rs.CoinFlipEnv(p=0.5)¶
- drain_observations()¶
- get_observation()¶
- get_reward()¶
- is_finished()¶
- perform_action(action)¶
- class infotheory_rs.CompressionBackend¶
- static rate_ac(rate_backend, framing='framed')¶
- static rate_rans(rate_backend, framing='framed')¶
- static rwkv7(method=None, coder='ac')¶
- static zpaq(method=None)¶
- class infotheory_rs.CtwPredictor(depth)¶
- model_name()¶
- pop_history()¶
- predict_one()¶
- predict_prob(sym)¶
- revert()¶
- update(sym)¶
- update_history(sym)¶
- class infotheory_rs.CtwTestEnv¶
- drain_observations()¶
- get_observation()¶
- get_reward()¶
- is_finished()¶
- perform_action(action)¶
- class infotheory_rs.EnvironmentABC¶
Python-side adapter for the Rust Environment trait.
- abstractmethod perform_action(action)¶
- Parameters:
action (int)
- abstractmethod get_observation()¶
- Return type:
int
- drain_observations()¶
- abstractmethod get_reward()¶
- Return type:
int
- abstractmethod is_finished()¶
- Return type:
bool
- abstractmethod get_observation_bits()¶
- Return type:
int
- abstractmethod get_reward_bits()¶
- Return type:
int
- abstractmethod get_action_bits()¶
- Return type:
int
- class infotheory_rs.ExtendedTigerEnv¶
- drain_observations()¶
- get_observation()¶
- get_reward()¶
- is_finished()¶
- perform_action(action)¶
- class infotheory_rs.FacCtwPredictor(base_depth, num_percept_bits)¶
- model_name()¶
- pop_history()¶
- predict_one()¶
- predict_prob(sym)¶
- revert()¶
- update(sym)¶
- update_history(sym)¶
- class infotheory_rs.GenerationConfig(strategy=None, update_mode=None, seed=42, temperature=1.0, top_k=0, top_p=1.0)¶
- static greedy_frozen()¶
- static sampled_frozen(seed=42)¶
- seed¶
- strategy¶
- temperature¶
- top_k¶
- top_p¶
- update_mode¶
- class infotheory_rs.GenerationStrategy¶
- Greedy = GenerationStrategy.Greedy¶
- Sample = GenerationStrategy.Sample¶
- class infotheory_rs.GenerationUpdateMode¶
- Adaptive = GenerationUpdateMode.Adaptive¶
- Frozen = GenerationUpdateMode.Frozen¶
- class infotheory_rs.InfotheoryCtx(rate_backend=None, compression_backend=None)¶
- biased_entropy_rate_bytes(data, max_order)¶
- compress_size(data)¶
- compress_size_chain(parts)¶
- conditional_entropy_bytes(x, y, max_order)¶
- conditional_entropy_rate_bytes(x, y, max_order)¶
- cross_entropy_bytes(test_data, train_data, max_order)¶
- cross_entropy_conditional_chain(prefix_parts, data)¶
- cross_entropy_rate_bytes(test_data, train_data, max_order)¶
- entropy_rate_bytes(data, max_order)¶
- generate_bytes(prompt, bytes, max_order=Ellipsis, config=None)¶
- generate_bytes_conditional_chain(prefix_parts, bytes, max_order=Ellipsis, config=None)¶
- intrinsic_dependence_bytes(data, max_order)¶
- joint_entropy_rate_bytes(x, y, max_order)¶
- mutual_information_bytes(x, y, max_order)¶
- mutual_information_rate_bytes(x, y, max_order)¶
- ncd_bytes(x, y, variant=None)¶
- ncd_paths(x, y, variant=None)¶
- ned_bytes(x, y, max_order)¶
- ned_cons_bytes(x, y, max_order)¶
- nte_bytes(x, y, max_order)¶
- rate_backend_session(max_order=Ellipsis, total_symbols=None)¶
- resistance_to_transformation_bytes(x, tx, max_order)¶
- class infotheory_rs.KuhnPokerEnv¶
- drain_observations()¶
- get_observation()¶
- get_reward()¶
- is_finished()¶
- perform_action(action)¶
- class infotheory_rs.MixtureExpertSpec(backend, max_order=Ellipsis, log_prior=0.0, name=None)¶
- class infotheory_rs.MixtureKind¶
- Bayes = <builtins.MixtureKind object>¶
- FadingBayes = <builtins.MixtureKind object>¶
- Mdl = <builtins.MixtureKind object>¶
- Neural = <builtins.MixtureKind object>¶
- Switching = <builtins.MixtureKind object>¶
- class infotheory_rs.MixtureSpec(kind, experts, alpha=0.01, decay=None)¶
- class infotheory_rs.NcdVariant¶
- Cons = NcdVariant.Cons¶
- SymCons = NcdVariant.SymCons¶
- SymVitanyi = NcdVariant.SymVitanyi¶
- Vitanyi = NcdVariant.Vitanyi¶
- class infotheory_rs.ObservationKeyMode¶
- First = <builtins.ObservationKeyMode object>¶
- FullStream = <builtins.ObservationKeyMode object>¶
- Last = <builtins.ObservationKeyMode object>¶
- StreamHash = <builtins.ObservationKeyMode object>¶
- class infotheory_rs.ParticleSpec(num_particles=16, context_window=32, unroll_steps=2, num_cells=8, cell_dim=32, num_rules=4, selector_hidden=64, rule_hidden=64, noise_dim=8, deterministic=True, enable_noise=False, noise_scale=0.1, noise_anneal_steps=8192, learning_rate_readout=0.01, learning_rate_selector=0.0001, learning_rate_rule=0.0003, bptt_depth=3, optimizer_momentum=0.05, grad_clip=1.0, state_clip=8.0, forget_lambda=0.0, resample_threshold=0.5, mutate_fraction=0.1, mutate_scale=0.01, mutate_model_params=False, diagnostics_interval=0, min_prob=5.960464477539063e-08, seed=42)¶
- class infotheory_rs.PredictorABC¶
Python-side adapter for the Rust Predictor trait.
- abstractmethod update(sym)¶
- Parameters:
sym (bool)
- update_history(sym)¶
- Parameters:
sym (bool)
- abstractmethod revert()¶
- pop_history()¶
- abstractmethod predict_prob(sym)¶
- Parameters:
sym (bool)
- Return type:
float
- predict_one()¶
- Return type:
float
- model_name()¶
- Return type:
str
- boxed_clone_with_seed(seed)¶
- Parameters:
seed (int)
- class infotheory_rs.RandomGenerator¶
- fork_with(salt)¶
- gen_bool(p)¶
- gen_f64()¶
- gen_range(end)¶
- next_u64()¶
- class infotheory_rs.RateBackend¶
- static calibrated(base_backend, context=None, bins=33, learning_rate=0.02, bias_clip=4.0)¶
- static ctw(depth=16)¶
- static fac_ctw(base_depth=16, num_percept_bits=8, encoding_bits=8)¶
- static mamba(method)¶
- static match(hash_bits=20, min_len=4, max_len=255, base_mix=0.02, confidence_scale=1.0)¶
- static mixture(spec)¶
- static particle(spec)¶
- static ppmd(order=10, memory_mb=64)¶
- static rosaplus()¶
- static rwkv7(method)¶
- static sparse_match(hash_bits=19, min_len=3, max_len=64, gap_min=1, gap_max=2, base_mix=0.05, confidence_scale=1.0)¶
- static zpaq(method=None)¶
- class infotheory_rs.RateBackendSession(backend, max_order=Ellipsis, total_symbols=None)¶
- condition(data)¶
- fill_log_probs()¶
- finish()¶
- generate_bytes(bytes, config=None)¶
- observe(data)¶
- reset_frozen(total_symbols=None)¶
- class infotheory_rs.RosaPredictor(max_order=20)¶
- model_name()¶
- pop_history()¶
- predict_one()¶
- predict_prob(sym)¶
- revert()¶
- update(sym)¶
- update_history(sym)¶
- class infotheory_rs.RwkvPredictor(model_path)¶
- model_name()¶
- pop_history()¶
- predict_one()¶
- predict_prob(sym)¶
- revert()¶
- update(sym)¶
- update_history(sym)¶
- class infotheory_rs.SearchGranularity¶
- File = SearchGranularity.File¶
- Snippet = SearchGranularity.Snippet¶
- class infotheory_rs.SearchTree¶
- search(agent, prev_obs_stream, prev_rew, prev_act, num_simulations)¶
- class infotheory_rs.Stage2PriorMode¶
- Disable = Stage2PriorMode.Disable¶
- Summarize = Stage2PriorMode.Summarize¶
- Use = Stage2PriorMode.Use¶