Skip to main content

databricks.labs.dqx.anomaly.model_loader

Load and validate sklearn anomaly models from MLflow.

load_sklearn_model_with_error_handling

def load_sklearn_model_with_error_handling(
model_uri: str, model_record: AnomalyModelRecord) -> Any

Load sklearn model from MLflow with graceful error handling.

Arguments:

  • model_uri - MLflow model URI
  • model_record - Model record with metadata for error messages

Returns:

Loaded sklearn model

Raises:

ModelLoadError with actionable error message if loading fails

load_and_validate_model

def load_and_validate_model(model_uri: str,
model_record: AnomalyModelRecord) -> Any

Load model with validation and error handling.

Arguments:

  • model_uri - MLflow model URI
  • model_record - Model record for version validation

Returns:

Loaded sklearn model

check_model_staleness

def check_model_staleness(record: AnomalyModelRecord, model_name: str) -> None

Check model training age and issue warning if stale (>30 days).