clustering

package
v0.8.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertCluster

type AlertCluster struct {
	ID            string
	CenterAlertID types.AlertID   // ID of the alert closest to the cluster center
	AlertIDs      []types.AlertID // IDs of all alerts in the cluster
	Size          int
	Keywords      []string // Common keywords (optional)
}

AlertCluster represents a cluster of alerts

type ClusteringResult

type ClusteringResult struct {
	Clusters      []*AlertCluster
	NoiseAlertIDs []types.AlertID // IDs of alerts that don't belong to any cluster
	Parameters    DBSCANParams
}

ClusteringResult represents the result of clustering

type DBSCANParams

type DBSCANParams struct {
	Eps        float64 // Maximum distance between two samples for one to be considered as in the neighborhood
	MinSamples int     // Minimum number of samples in a neighborhood for a point to be considered as a core point
}

DBSCANParams represents parameters for DBSCAN clustering algorithm

type Service

type Service interface {
	// ClusterAlerts performs DBSCAN clustering on alerts using their embedding vectors
	// Note: Only unbound alerts (TicketID == nil) should be included
	ClusterAlerts(ctx context.Context, alerts []*alert.Alert, params DBSCANParams) (*ClusteringResult, error)

	// FindCenterAlert finds the alert closest to the cluster center
	FindCenterAlert(ctx context.Context, alerts []*alert.Alert) (*alert.Alert, error)

	// ExtractKeywords extracts common keywords from alerts (optional)
	ExtractKeywords(ctx context.Context, alerts []*alert.Alert, limit int) ([]string, error)
}

Service defines the interface for clustering service

func NewService

func NewService() Service

NewService creates a new clustering service instance

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL