nannyml.io.db.entities module¶
Contains the definitions of the database entities that map directly to the underlying table definitions.
Every Result class has a matching Entity class, which implies that each calculator/estimator will export its results into a specific table.
- class nannyml.io.db.entities.CBPEPerformanceMetric(*, id: int | None = None, model_id: int | None = None, run_id: int = None, start_timestamp: datetime, end_timestamp: datetime, timestamp: datetime, metric_name: str, value: float, alert: bool, upper_threshold: float | None = None, lower_threshold: float | None = None)[source]¶
Bases:
Metric
Represents results of the CBPE estimator.
Stored in the
cbpe_performance_metrics
table.Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- alert: bool¶
Indicates if the method raised an alert for this Chunk
- end_timestamp: datetime¶
The end datetime of the Chunk
- id: int | None¶
The technical identifier for this database row
- lower_threshold: float | None¶
The lower alerting threshold value
- metric_name: str¶
The name of the method being calculated, e.g. ‘jensen_shannon’ or ‘chi2’
- model_id: int | None¶
Foreign key pointing to a record in the
model
table
- run_id: int¶
Foreign key pointing to a record in the
run
table
- start_timestamp: datetime¶
The start datetime of the Chunk
- timestamp: datetime¶
The ‘center’ timestamp of the Chunk, i.e. the mean of the start and end timestamps
- upper_threshold: float | None¶
The upper alerting threshold value
- value: float¶
The value returned by the method
- class nannyml.io.db.entities.DLEPerformanceMetric(*, id: int | None = None, model_id: int | None = None, run_id: int = None, start_timestamp: datetime, end_timestamp: datetime, timestamp: datetime, metric_name: str, value: float, alert: bool, upper_threshold: float | None = None, lower_threshold: float | None = None)[source]¶
Bases:
Metric
Represents results of the DLE estimator.
Stored in the
dle_performance_metrics
table.Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- alert: bool¶
Indicates if the method raised an alert for this Chunk
- end_timestamp: datetime¶
The end datetime of the Chunk
- id: int | None¶
The technical identifier for this database row
- lower_threshold: float | None¶
The lower alerting threshold value
- metric_name: str¶
The name of the method being calculated, e.g. ‘jensen_shannon’ or ‘chi2’
- model_id: int | None¶
Foreign key pointing to a record in the
model
table
- run_id: int¶
Foreign key pointing to a record in the
run
table
- start_timestamp: datetime¶
The start datetime of the Chunk
- timestamp: datetime¶
The ‘center’ timestamp of the Chunk, i.e. the mean of the start and end timestamps
- upper_threshold: float | None¶
The upper alerting threshold value
- value: float¶
The value returned by the method
- class nannyml.io.db.entities.DataReconstructionFeatureDriftMetric(*, id: int | None = None, model_id: int | None = None, run_id: int = None, start_timestamp: datetime, end_timestamp: datetime, timestamp: datetime, metric_name: str, value: float, alert: bool, upper_threshold: float | None = None, lower_threshold: float | None = None)[source]¶
Bases:
Metric
Represents results of the DataReconstructionDriftCalculator.
Stored in the
data_reconstruction_feature_drift_metrics
table.Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- alert: bool¶
Indicates if the method raised an alert for this Chunk
- end_timestamp: datetime¶
The end datetime of the Chunk
- id: int | None¶
The technical identifier for this database row
- lower_threshold: float | None¶
The lower alerting threshold value
- metric_name: str¶
The name of the method being calculated, e.g. ‘jensen_shannon’ or ‘chi2’
- model_id: int | None¶
Foreign key pointing to a record in the
model
table
- run_id: int¶
Foreign key pointing to a record in the
run
table
- start_timestamp: datetime¶
The start datetime of the Chunk
- timestamp: datetime¶
The ‘center’ timestamp of the Chunk, i.e. the mean of the start and end timestamps
- upper_threshold: float | None¶
The upper alerting threshold value
- value: float¶
The value returned by the method
- class nannyml.io.db.entities.Metric(*, id: int | None = None, model_id: int | None = None, run_id: int = None, start_timestamp: datetime, end_timestamp: datetime, timestamp: datetime, metric_name: str, value: float, alert: bool)[source]¶
Bases:
SQLModel
Base Metric definition
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- alert: bool¶
Indicates if the method raised an alert for this Chunk
- end_timestamp: datetime¶
The end datetime of the Chunk
- id: int | None¶
The technical identifier for this database row
- metric_name: str¶
The name of the method being calculated, e.g. ‘jensen_shannon’ or ‘chi2’
- model_id: int | None¶
Foreign key pointing to a record in the
model
table
- run_id: int¶
Foreign key pointing to a record in the
run
table
- start_timestamp: datetime¶
The start datetime of the Chunk
- timestamp: datetime¶
The ‘center’ timestamp of the Chunk, i.e. the mean of the start and end timestamps
- value: float¶
The value returned by the method
- class nannyml.io.db.entities.Model(*, id: int | None = None, name: str)[source]¶
Bases:
SQLModel
Represents a Model.
Only created when the
model_name
property of the DatabaseWriter was given. Theid
field here will act as a foreign key in therun
table and allmetric
tables.Stored in the
model
table.Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- id: int | None¶
- name: str¶
- class nannyml.io.db.entities.RealizedPerformanceMetric(*, id: int | None = None, model_id: int | None = None, run_id: int = None, start_timestamp: datetime, end_timestamp: datetime, timestamp: datetime, metric_name: str, value: float, alert: bool, upper_threshold: float | None = None, lower_threshold: float | None = None)[source]¶
Bases:
Metric
Represents results of the RealizedPerformanceCalculator.
Stored in the
realized_performance_metrics
table.Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- alert: bool¶
Indicates if the method raised an alert for this Chunk
- end_timestamp: datetime¶
The end datetime of the Chunk
- id: int | None¶
The technical identifier for this database row
- lower_threshold: float | None¶
The lower alerting threshold value
- metric_name: str¶
The name of the method being calculated, e.g. ‘jensen_shannon’ or ‘chi2’
- model_id: int | None¶
Foreign key pointing to a record in the
model
table
- run_id: int¶
Foreign key pointing to a record in the
run
table
- start_timestamp: datetime¶
The start datetime of the Chunk
- timestamp: datetime¶
The ‘center’ timestamp of the Chunk, i.e. the mean of the start and end timestamps
- upper_threshold: float | None¶
The upper alerting threshold value
- value: float¶
The value returned by the method
- class nannyml.io.db.entities.Run(*, id: int | None = None, model_id: int | None = None, execution_timestamp: datetime = datetime.datetime(2023, 1, 24, 10, 59, 3, 217755))[source]¶
Bases:
SQLModel
Represents a NannyML run, allowing to filter results based on what run generated them.
The
id
field here will act as a foreign key in allmetric
tables.Stored in the
run
table.Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- execution_timestamp: datetime¶
- id: int | None¶
- model_id: int | None¶
- class nannyml.io.db.entities.UnivariateDriftMetric(*, id: int | None = None, model_id: int | None = None, run_id: int = None, start_timestamp: datetime, end_timestamp: datetime, timestamp: datetime, metric_name: str, value: float, alert: bool, column_name: str)[source]¶
Bases:
Metric
Represents results of the UnivariateDriftCalculator.
Stored in the
univariate_drift_metrics
table.Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- alert: bool¶
Indicates if the method raised an alert for this Chunk
- column_name: str¶
The name of the column this metric belongs to
- end_timestamp: datetime¶
The end datetime of the Chunk
- id: int | None¶
The technical identifier for this database row
- metric_name: str¶
The name of the method being calculated, e.g. ‘jensen_shannon’ or ‘chi2’
- model_id: int | None¶
Foreign key pointing to a record in the
model
table
- run_id: int¶
Foreign key pointing to a record in the
run
table
- start_timestamp: datetime¶
The start datetime of the Chunk
- timestamp: datetime¶
The ‘center’ timestamp of the Chunk, i.e. the mean of the start and end timestamps
- value: float¶
The value returned by the method