Skip to main content

databricks.labs.dqx.anomaly.scoring_strategies

Scoring strategy interface and implementations for row anomaly models.

AnomalyScoringStrategy Objects

class AnomalyScoringStrategy(ABC)

Scoring strategy interface for row anomaly models.

supports

@abstractmethod
def supports(algorithm: str) -> bool

Return True if the strategy supports the given algorithm.

score_global

@abstractmethod
def score_global(df: DataFrame, record: AnomalyModelRecord,
config: ScoringConfig) -> DataFrame

Score a global model.

score_segmented

@abstractmethod
def score_segmented(df: DataFrame, config: ScoringConfig,
registry_client: AnomalyModelRegistry,
all_segments: list[AnomalyModelRecord]) -> DataFrame

Score a segmented model.

IsolationForestScoringStrategy Objects

class IsolationForestScoringStrategy(AnomalyScoringStrategy)

IsolationForest scoring strategy (default).

resolve_scoring_strategy

def resolve_scoring_strategy(algorithm: str) -> AnomalyScoringStrategy

Return the first strategy that supports the given algorithm.