hots.evaluation.evaluator

Evaluation utilities for HOTS.

class hots.evaluation.evaluator.EvalSnapshot(labels: ndarray, placement: dict[Any, Any], tick: int)[source]

Bases: object

All the info we need to compare two consecutive evaluations.

labels: ndarray
placement: dict[Any, Any]
tick: int
hots.evaluation.evaluator.eval_solutions(instance, clustering, clust_opt, problem_opt, problem, working_df, *, prev_snapshot: EvalSnapshot | None = None, tick: int | None = None) dict[str, Any][source]

Run the evaluation pipeline and collect evaluation metrics.

hots.evaluation.evaluator.eval_step_kpis(instance, labels, placement, prev_snapshot: EvalSnapshot | None, tick: int, *, working_df: DataFrame | None = None) tuple[EvalSnapshot, dict[str, Any]][source]

Evaluate the two-stage result at this tick, comparing to previous snapshot.

Returns:

(snapshot, metrics_dict)

hots.evaluation.evaluator.get_conflict_graph(cur_duals: dict[Any, float], prev_duals: dict[Any, float], tol: float) Graph[source]

Build conflict graph where edges represent dual increases above tolerance.

hots.evaluation.evaluator.get_container_tomove(instance, c1, c2, working_df: DataFrame)[source]

Pick between two containers by variance on c1’s placement node.

Chooses the container whose removal makes the node’s time series smoother (i.e., smaller variance of node_ts - container_ts).

hots.evaluation.evaluator.get_moving_containers_clust(cur_duals: dict[Any, float], prev_duals: dict[Any, float], tol: float, tol_move: float, df_clust: DataFrame, profiles: ndarray) tuple[list[Any], int, int, int, float][source]

Select containers to move from clustering conflict graph.

hots.evaluation.evaluator.get_moving_containers_place(instance, cur_duals, prev_duals: dict[Any, float], tol: float, tol_move: float, working_df: DataFrame) tuple[list[Any], int, int, int, float][source]

Select containers to move from placement conflict graph.