statsmodels.tools.sm_exceptions のソースコード

"""
Contains custom errors and warnings.

Errors should derive from Exception or another custom error. Custom errors are
only needed it standard errors, for example ValueError or TypeError, are not
accurate descriptions of the reason for the error.

Warnings should derive from either an existing warning or another custom
warning, and should usually be accompanied by a sting using the format
warning_name_doc that services as a generic message to use when the warning is
raised.
"""

import warnings


# Errors
[ドキュメント] class PerfectSeparationError(Exception): """ Error due to perfect prediction in discrete models """ pass
class MissingDataError(Exception): """ Error raised if variables contain missing values when forbidden """ pass
[ドキュメント] class X13NotFoundError(Exception): """ Error locating the X13 binary """ pass
[ドキュメント] class X13Error(Exception): """ Error when running modes using X13 """ pass
[ドキュメント] class ParseError(Exception): """ Error when parsing a docstring. """ def __str__(self): message = self.args[0] if hasattr(self, "docstring"): message = f"{message} in {self.docstring}" return message
# Warning
[ドキュメント] class X13Warning(Warning): """ Unexpected conditions when using X13 """ pass
[ドキュメント] class IOWarning(RuntimeWarning): """ Resource not deleted """ pass
[ドキュメント] class ModuleUnavailableWarning(Warning): """ Non-fatal import error """ pass
module_unavailable_doc = """ The module {0} is not available. Cannot run in parallel. """
[ドキュメント] class ModelWarning(UserWarning): """ Base internal Warning class to simplify end-user filtering """ pass
[ドキュメント] class ConvergenceWarning(ModelWarning): """ Nonlinear optimizer failed to converge to a unique solution """ pass
convergence_doc = """ Failed to converge on a solution. """
[ドキュメント] class CacheWriteWarning(ModelWarning): """ Attempting to write to a read-only cached value """ pass
[ドキュメント] class IterationLimitWarning(ModelWarning): """ Iteration limit reached without convergence """ pass
iteration_limit_doc = """ Maximum iteration reached. """
[ドキュメント] class InvalidTestWarning(ModelWarning): """ Test not applicable to model """ pass
[ドキュメント] class NotImplementedWarning(ModelWarning): """ Non-fatal function non-implementation """ pass
[ドキュメント] class OutputWarning(ModelWarning): """ Function output contains atypical values """ pass
[ドキュメント] class DomainWarning(ModelWarning): """ Variables are not compliant with required domain constraints """ pass
[ドキュメント] class ValueWarning(ModelWarning): """ Non-fatal out-of-range value given """ pass
[ドキュメント] class EstimationWarning(ModelWarning): """ Unexpected condition encountered during estimation """ pass
[ドキュメント] class SingularMatrixWarning(ModelWarning): """ Non-fatal matrix inversion affects output results """ pass
[ドキュメント] class HypothesisTestWarning(ModelWarning): """ Issue occurred when performing hypothesis test """ pass
[ドキュメント] class InterpolationWarning(ModelWarning): """ Table granularity and limits restrict interpolation """ pass
[ドキュメント] class PrecisionWarning(ModelWarning): """ Numerical implementation affects precision """ pass
[ドキュメント] class SpecificationWarning(ModelWarning): """ Non-fatal model specification issue """ pass
[ドキュメント] class HessianInversionWarning(ModelWarning): """ Hessian noninvertible and standard errors unavailable """ pass
[ドキュメント] class CollinearityWarning(ModelWarning): """ Variables are highly collinear """ pass
class PerfectSeparationWarning(ModelWarning): """ Perfect separation or prediction """ pass class InfeasibleTestError(RuntimeError): """ Test statistic cannot be computed """ pass recarray_exception = """ recarray support has been removed from statsmodels. Use pandas DataFrames for structured data. """ warnings.simplefilter("always", ModelWarning) warnings.simplefilter("always", ConvergenceWarning) warnings.simplefilter("always", CacheWriteWarning) warnings.simplefilter("always", IterationLimitWarning) warnings.simplefilter("always", InvalidTestWarning)

最終更新日: 2025年01月28日