boofun.core.errormodels
Error models for Boolean function analysis.
This module provides various error models for handling uncertainty, noise, and approximation in Boolean function computations.
Functions
|
Factory function to create error models. |
Classes
Abstract base class for all error models. |
|
Exact error model - no errors or uncertainty. |
|
Linear error propagation model using uncertainties library. |
|
|
Noise error model for handling bit-flip and measurement errors. |
|
PAC (Probably Approximately Correct) error model. |
- class boofun.core.errormodels.ErrorModel[source]
Abstract base class for all error models.
- abstractmethod apply_error(result: Any) Any[source]
Apply error model to a computation result.
- Parameters:
result – The original computation result
- Returns:
Result with error model applied
- class boofun.core.errormodels.ExactErrorModel[source]
Exact error model - no errors or uncertainty.
This model assumes perfect computation with no noise or approximation.
- class boofun.core.errormodels.PACErrorModel(epsilon: float = 0.1, delta: float = 0.1)[source]
PAC (Probably Approximately Correct) error model.
Provides probabilistic guarantees with specified error and confidence bounds.
- __init__(epsilon: float = 0.1, delta: float = 0.1)[source]
Initialize PAC error model.
- Parameters:
epsilon – Approximation error bound (0 < epsilon < 1)
delta – Confidence failure probability (0 < delta < 1)
- apply_error(result: Any) Dict[str, Any][source]
Apply PAC bounds to result.
- Returns:
Dictionary with result and PAC bounds
- combine_pac_bounds(error1: PACErrorModel, error2: PACErrorModel, operation: str) PACErrorModel[source]
Combine PAC learning error bounds for two results.
- Parameters:
error1 – PAC error models to combine
error2 – PAC error models to combine
operation – Type of operation (‘addition’, ‘multiplication’, etc.)
- Returns:
Combined PAC error model
- class boofun.core.errormodels.NoiseErrorModel(noise_rate: float = 0.01, random_seed: int | None = None)[source]
Noise error model for handling bit-flip and measurement errors.
Simulates realistic noise in Boolean function evaluation and analysis.
- __init__(noise_rate: float = 0.01, random_seed: int | None = None)[source]
Initialize noise error model.
- Parameters:
noise_rate – Probability of bit flip (0 <= noise_rate <= 0.5)
random_seed – Random seed for reproducible noise
- class boofun.core.errormodels.LinearErrorModel[source]
Linear error propagation model using uncertainties library.
Provides automatic differentiation-based error propagation.
- apply_error(result: Any, std_dev: float = 0.01) Any[source]
Apply linear error propagation.
- Parameters:
result – Computation result
std_dev – Standard deviation of error
- Returns:
Result with uncertainty information
- propagate_binary_op(left_error: Any, right_error: Any, operation: callable) Any[source]
Automatic error propagation for binary operations.
- Parameters:
left_error – Left operand with uncertainty
right_error – Right operand with uncertainty
operation – Operation function
- Returns:
Result with propagated uncertainty
- boofun.core.errormodels.create_error_model(model_type: str, **kwargs) ErrorModel[source]
Factory function to create error models.
- Parameters:
model_type – Type of error model (‘exact’, ‘pac’, ‘noise’, ‘linear’)
**kwargs – Model-specific parameters
- Returns:
Configured error model