boofun.families.tracker
Growth tracking for Boolean function families.
The GrowthTracker observes and records properties of a function family as n grows, enabling: - Visualization of asymptotic behavior - Comparison with theoretical predictions - Discovery of patterns and phase transitions
Classes
|
Track properties of a function family as n grows. |
|
A property to track as n grows. |
|
Types of properties that can be tracked. |
Factory for common property markers. |
|
|
Results of tracking a property across n values. |
- class boofun.families.tracker.MarkerType(value)[source]
Types of properties that can be tracked.
- SCALAR = 'scalar'
- VECTOR = 'vector'
- MATRIX = 'matrix'
- BOOLEAN = 'boolean'
- FOURIER = 'fourier'
- COMPLEXITY = 'complexity'
- class boofun.families.tracker.Marker(name: str, compute_fn: ~typing.Callable[[BooleanFunction], ~typing.Any], marker_type: ~boofun.families.tracker.MarkerType = MarkerType.SCALAR, description: str = '', theoretical_fn: ~typing.Callable[[int], ~typing.Any] | None = None, params: ~typing.Dict[str, ~typing.Any] = <factory>)[source]
A property to track as n grows.
- compute_fn
Function(BooleanFunction) -> value
- Type:
Callable[[BooleanFunction], Any]
- marker_type
Type of the value
- compute_fn: Callable[[BooleanFunction], Any]
- marker_type: MarkerType = 'scalar'
- compute(f: BooleanFunction) Any[source]
Compute the marked value for a function.
- __init__(name: str, compute_fn: ~typing.Callable[[BooleanFunction], ~typing.Any], marker_type: ~boofun.families.tracker.MarkerType = MarkerType.SCALAR, description: str = '', theoretical_fn: ~typing.Callable[[int], ~typing.Any] | None = None, params: ~typing.Dict[str, ~typing.Any] = <factory>) None
- class boofun.families.tracker.PropertyMarker[source]
Factory for common property markers.
- static total_influence(theoretical: Callable[[int], float] | None = None) Marker[source]
Track total influence I[f].
- class boofun.families.tracker.TrackingResult(marker: Marker, n_values: List[int], computed_values: List[Any], theoretical_values: List[Any] | None = None, computation_times: List[float] | None = None)[source]
Results of tracking a property across n values.
- class boofun.families.tracker.GrowthTracker(family: FunctionFamily)[source]
Track properties of a function family as n grows.
- Usage:
tracker = GrowthTracker(MajorityFamily()) tracker.mark(“total_influence”) tracker.mark(“noise_stability”, rho=0.5)
results = tracker.observe([5, 7, 9, 11, 13, 15]) tracker.plot(“total_influence”, show_theory=True)
- __init__(family: FunctionFamily)[source]
Initialize tracker for a function family.
- Parameters:
family – The function family to track
- results: Dict[str, TrackingResult]
- mark(property_name: str, **kwargs) GrowthTracker[source]
Add a property to track.
- Parameters:
property_name – Built-in property name or “custom”
**kwargs – Parameters for the marker
- Returns:
self (for chaining)
- Built-in properties:
“total_influence”
“influences” or “influence_i” (with variable=i)
“noise_stability” (with rho=0.5)
“fourier_degree”
“spectral_concentration” (with k=degree)
“expectation”
“variance”
“is_<property>” (e.g., “is_monotone”, “is_balanced”)
“sensitivity”
“block_sensitivity”
- observe(n_values: List[int] | None = None, n_range: range | None = None, n_min: int = 3, n_max: int = 15, step: int = 2, verbose: bool = False) Dict[str, TrackingResult][source]
Observe the family over a range of n values.
- Parameters:
n_values – Explicit list of n values
n_range – Range object for n values
n_min – Parameters for default range
n_max – Parameters for default range
step – Parameters for default range
verbose – Print progress
- Returns:
Dictionary mapping marker name -> TrackingResult
- get_result(marker_name: str) TrackingResult | None[source]
Get tracking result for a specific marker.
- plot(marker_name: str, show_theory: bool = True, log_scale: bool = False, ax=None, **plot_kwargs)[source]
Plot a tracked property vs n.
- Parameters:
marker_name – Which marker to plot
show_theory – Show theoretical prediction line
log_scale – Use log scale for y-axis
ax – Matplotlib axes (creates new figure if None)
**plot_kwargs – Additional arguments for plt.plot
- Returns:
Matplotlib axes