gpridge.errors¶
Exception hierarchy for GPRidge.
Every error the library raises on purpose derives from
GPRidgeError. The subclasses mirror the GPR_ERR_* status
codes of the C API (gpr/capi/gpridge_c.h) and carry the code as
GPRidgeError.status, so one classification serves C, C++ and
Python callers.
Each subclass also derives from the built-in exception that the same
failure raised before this hierarchy existed (ValueError for a bad
argument, RuntimeError for a failed computation, MemoryError for
an allocation failure), so an except ValueError or except
RuntimeError written against older releases keeps catching it.
The compiled _core extension translates C++ exceptions with the
same rules as status_from_exception in gpridge_c.cpp:
C++ exception |
Python exception |
|---|---|
|
|
|
|
|
|
|
|
any other |
The ctypes bridge to libgpr_engine (gpridge.engine) speaks
the rgpot engine ABI, whose status codes are not the GPR_ERR_* set;
its failures raise EngineError with the engine’s return code.
This module imports nothing compiled, so it is available even when the
_core extension is not.
Exceptions¶
Base class of every error GPRidge raises on purpose. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
A failure reported by |
Functions¶
|
The exception class for a |
|
Short static name of a |
Module Contents¶
- exception gpridge.errors.GPRidgeError¶
Bases:
ExceptionBase class of every error GPRidge raises on purpose.
statusis the matchingGPR_ERR_*code (0when the error has no C counterpart) andstatus_nameits symbolic name.
- exception gpridge.errors.NullHandleError¶
Bases:
GPRidgeError,ValueErrorGPR_ERR_NULL_HANDLE: a required handle or object was absent.- status = -1¶
- status_name = 'GPR_ERR_NULL_HANDLE'¶
- exception gpridge.errors.InvalidArgumentError¶
Bases:
GPRidgeError,ValueErrorGPR_ERR_INVALID_ARG: a size, shape, key or value out of range.- status = -2¶
- status_name = 'GPR_ERR_INVALID_ARG'¶
- exception gpridge.errors.NotTrainedError¶
Bases:
GPRidgeError,ValueErrorGPR_ERR_NOT_TRAINED: the model has no training data.A
ValueError, asget_alphaon an untrained model raised before.- status = -3¶
- status_name = 'GPR_ERR_NOT_TRAINED'¶
- exception gpridge.errors.AllocationError¶
Bases:
GPRidgeError,MemoryErrorGPR_ERR_ALLOC: a memory allocation failed.- status = -4¶
- status_name = 'GPR_ERR_ALLOC'¶
- exception gpridge.errors.CholeskyError¶
Bases:
GPRidgeError,RuntimeErrorGPR_ERR_CHOLESKY: the covariance matrix is not positive definite.- status = -5¶
- status_name = 'GPR_ERR_CHOLESKY'¶
- exception gpridge.errors.OptimizerError¶
Bases:
GPRidgeError,RuntimeErrorGPR_ERR_OPTIMIZER: the hyperparameter optimizer failed.- status = -6¶
- status_name = 'GPR_ERR_OPTIMIZER'¶
- exception gpridge.errors.NotConvergedError¶
Bases:
GPRidgeError,RuntimeErrorGPR_ERR_NOT_CONVERGED: a search ended without converging.- status = -7¶
- status_name = 'GPR_ERR_NOT_CONVERGED'¶
- exception gpridge.errors.SizeLimitError¶
Bases:
GPRidgeError,ValueErrorGPR_ERR_SIZE_LIMIT: the problem exceeds an index limit.- status = -8¶
- status_name = 'GPR_ERR_SIZE_LIMIT'¶
- exception gpridge.errors.OracleError¶
Bases:
GPRidgeError,RuntimeErrorGPR_ERR_ORACLE: the oracle failed past the search’s bound.- status = -9¶
- status_name = 'GPR_ERR_ORACLE'¶
- exception gpridge.errors.UnsupportedError¶
Bases:
GPRidgeError,NotImplementedErrorGPR_ERR_UNSUPPORTED: the feature is absent from this build.- status = -10¶
- status_name = 'GPR_ERR_UNSUPPORTED'¶
- exception gpridge.errors.ABIError¶
Bases:
GPRidgeError,RuntimeErrorGPR_ERR_ABI: header and library disagree.- status = -11¶
- status_name = 'GPR_ERR_ABI'¶
- exception gpridge.errors.OutOfSupportError¶
Bases:
GPRidgeError,ValueErrorGPR_ERR_OUT_OF_SUPPORT: a query’s posterior energy standard deviation exceeds the caller’smax_energy_std.- status = -12¶
- status_name = 'GPR_ERR_OUT_OF_SUPPORT'¶
- exception gpridge.errors.UnitMismatchError¶
Bases:
GPRidgeError,ValueErrorGPR_ERR_UNIT_MISMATCH: inputs that must share a unit were computed in different ones, such as prefactor halves with differentomega_scale.- status = -13¶
- status_name = 'GPR_ERR_UNIT_MISMATCH'¶
- exception gpridge.errors.InternalError¶
Bases:
GPRidgeError,RuntimeErrorGPR_ERR_INTERNAL: any other failure inside the library.- status = -99¶
- status_name = 'GPR_ERR_INTERNAL'¶
- exception gpridge.errors.EngineError(message: str, code: int | None = None)¶
Bases:
GPRidgeError,RuntimeErrorA failure reported by
libgpr_engineover the rgpot engine ABI.codeis the engine’s return value (Nonewhen the call returned a null handle instead of a code).- status_name = 'RGPOT_ENGINE_ERROR'¶
- code = None¶
- gpridge.errors.error_for_status(status: int) type[GPRidgeError]¶
The exception class for a
GPR_ERR_*code.Unknown codes map to
InternalError, as the C API reports them.