BaseEstimator¶
The abstract base class defining the estimator interface.
Overview¶
All estimators in Falcon must implement this interface. The base class defines methods for:
- Training (
train) - Sampling (
sample_prior,sample_posterior,sample_proposal) - Persistence (
save,load) - Control flow (
pause,resume,interrupt)
Class Reference¶
BaseEstimator
¶
Bases: ABC
Fully abstract base class defining the estimator interface.
All methods are abstract - no implementation details. Concrete implementations must provide all functionality.
Conditions are passed as Dict[str, Tensor] mapping node names to values. Sampling methods return dicts with 'value' (ndarray) and optionally 'log_prob' (ndarray).
train
abstractmethod
async
¶
Train the estimator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
buffer
|
BufferView providing access to training/validation data |
required |
sample_prior
abstractmethod
¶
Sample from the prior distribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_samples
|
int
|
Number of samples to generate |
required |
conditions
|
Optional[Conditions]
|
Conditioning values from parent nodes (usually None for prior) |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Dict with 'value' (ndarray) and optionally 'log_prob' (ndarray) |
Source code in falcon/core/base_estimator.py
sample_posterior
abstractmethod
¶
Sample from the posterior distribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_samples
|
int
|
Number of samples to generate |
required |
conditions
|
Optional[Conditions]
|
Dict mapping node names to condition tensors |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Dict with 'value' (ndarray) and optionally 'log_prob' (ndarray) |
Source code in falcon/core/base_estimator.py
sample_proposal
abstractmethod
¶
Sample from the proposal distribution for adaptive resampling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_samples
|
int
|
Number of samples to generate |
required |
conditions
|
Optional[Conditions]
|
Dict mapping node names to condition tensors |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Dict with 'value' (ndarray) and optionally 'log_prob' (ndarray) |
Source code in falcon/core/base_estimator.py
save
abstractmethod
¶
Save estimator state to directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_dir
|
Path
|
Directory to save state to |
required |
load
abstractmethod
¶
Load estimator state from directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_dir
|
Path
|
Directory to load state from |
required |