Exceptions and warnings#

Catch CleverlyError subclasses when an application can recover from invalid data, configuration, or lifecycle use. Treat warnings as requests to inspect convergence, overlap, or weighting.

cleverly.CleverlyError

Base class for every error raised by cleverly.

cleverly.CapabilityError

A request the package refuses for a reason other than the data alone.

cleverly.DataError

The supplied data violates an assumption the estimator relies on.

cleverly.MethodConfigurationError

An estimation-method declaration is invalid or cannot take effect.

cleverly.NotFittedError

A result was requested from an estimator that has not been fitted.

cleverly.ConvergenceWarning

The targeting step stopped before reaching the requested tolerance.

cleverly.MonteCarloWarning

The simulation error is a large share of a parametric g-formula interval.

cleverly.ParameterSpaceWarning

An estimate left the range of the parameter it estimates.

cleverly.PositivityWarning

Estimated treatment (or missingness) probabilities are near 0 or 1.

cleverly.SparseInfluenceWarning

A few rows carry the influence curve, so the Wald interval may under-cover.

cleverly.VersionMismatchWarning

A saved result was written by a different cleverly version than the one loading it.

cleverly.WeightingWarning

The supplied observation weights may not mean what the estimator assumes.

cleverly.exceptions.RefusalReason

Why the package refuses a request.

cleverly.exceptions.Refusal

One refusal: its reason code, the failed condition, and what to do instead.

Each CleverlyError carries its refusal in error.refusal. A Refusal holds a RefusalReason code, the failed condition, an alternative, and a roadmap id.

Package version#

The installed version is available as cleverly.__version__.