Query and Prediction by Committee
Committee regressor for active learning with uncertainty estimation.
- class openadmet.models.active_learning.committee.CommitteeRegressor(*, models: list = [])[source]
Bases:
EnsembleBaseCommittee Regressor.
- Variables:
type (ClassVar[str]) – The type of the ensemble model.
_calibration_model (Any) – The calibration model used for uncertainty calibration.
_calibration_methods (dict) – A dictionary mapping calibration method names to their corresponding functions.
- calibrate_uncertainty(X, y, method='isotonic-regression', **kwargs)[source]
Configure uncertainty calibration using selected method.
- Parameters:
X (array-like of shape (n_samples, n_features)) – The input validation set samples to calibrate.
y (array-like of shape (n_samples, n_features)) – The target validation set values.
method (str) – The calibration method to use. Options are “isotonic-regression” or “scaling-factor”.
**kwargs (dict) – Additional keyword arguments to be passed to the committee’s predict method.
- property calibrated
Check if the committee regressor has a calibration model.
- Returns:
True if the committee regressor has a calibration model, False otherwise.
- Return type:
bool
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context: Any, /) None
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Args:
self: The BaseModel instance. context: The context.
- plot_uncertainty_calibration(X, y, **kwargs)[source]
Plot uncertainty calibration for the committee model.
- Parameters:
X (array-like of shape (n_samples, n_features)) – The input test set samples to calibrate.
y (array-like of shape (n_samples, n_features)) – The target test set values.
**kwargs (dict) – Additional keyword arguments to be passed to the committee’s predict method.
- Returns:
A list of plots for each target dimension.
- Return type:
list
- predict(X, return_std=False, return_all=False, **kwargs)[source]
Make predictions using the committee model.
- Parameters:
X (array-like of shape (n_samples, n_features)) – The input samples to predict.
return_std (bool, optional) – Whether to return the standard deviation of the predictions. Mutually exclusive with
return_all.return_all (bool, optional) – Whether to return the raw per-member predictions of shape (n_samples, n_tasks, n_members) instead of the mean (and std). Mutually exclusive with
return_std.**kwargs (dict) – Additional keyword arguments to pass to the committee’s predict method.
- Returns:
mean, or (mean, std), or ndarray of shape (n_samples, n_tasks, n_members) depending on the values of return_std and return_all.
- Return type:
array-like or tuple
- query(X, query_strategy: str = None, **kwargs)[source]
Query the committee to select instances for labeling.
- Parameters:
X (array-like) – The input data from which instances are to be queried.
query_strategy (str, optional) – The query strategy to use for selecting instances.
**kwargs (dict) – Additional keyword arguments to be passed to the committee’s query method.
- Returns:
Values of the query strategy applied to the input data X.
- Return type:
np.array
- save(paths: list[os.PathLike], calibration_path: PathLike = 'calibration_model.pkl')[source]
Save the committee model to the provided paths.
- Parameters:
paths (list of PathLike) – The file paths to save the model weights.
calibration_path (PathLike) – Path to save calibration model.
- serialize(param_paths: list[os.PathLike], serial_paths: list[os.PathLike], calibration_path: PathLike = 'calibration_model.pkl')[source]
Save the model to json files and pickled files.
- Parameters:
param_paths (list of PathLike) – The file paths to save the model weights.
serial_paths (list of PathLike) – The file paths to save the model architecture.
calibration_path (PathLike) – The file path to save the calibration model.