style: apply ruff format to all files
This commit is contained in:
@@ -51,6 +51,7 @@ logger = logging.getLogger(__name__)
|
||||
@dataclass
|
||||
class RunComparison:
|
||||
"""Comparison result for multiple MLflow runs."""
|
||||
|
||||
run_ids: List[str]
|
||||
experiment_name: str
|
||||
|
||||
@@ -111,6 +112,7 @@ class RunComparison:
|
||||
@dataclass
|
||||
class PromotionRecommendation:
|
||||
"""Recommendation for model promotion."""
|
||||
|
||||
model_name: str
|
||||
version: Optional[int]
|
||||
recommended: bool
|
||||
@@ -262,13 +264,9 @@ class ExperimentAnalyzer:
|
||||
|
||||
# Metadata
|
||||
comparison.run_names[run_id] = run.info.run_name or run_id[:8]
|
||||
comparison.start_times[run_id] = datetime.fromtimestamp(
|
||||
run.info.start_time / 1000
|
||||
)
|
||||
comparison.start_times[run_id] = datetime.fromtimestamp(run.info.start_time / 1000)
|
||||
if run.info.end_time:
|
||||
comparison.durations[run_id] = (
|
||||
run.info.end_time - run.info.start_time
|
||||
) / 1000
|
||||
comparison.durations[run_id] = (run.info.end_time - run.info.start_time) / 1000
|
||||
|
||||
# Metrics
|
||||
for key, value in run.data.metrics.items():
|
||||
@@ -288,10 +286,7 @@ class ExperimentAnalyzer:
|
||||
continue
|
||||
|
||||
# Determine if lower is better based on metric name
|
||||
minimize = any(
|
||||
term in metric_name.lower()
|
||||
for term in ["latency", "error", "loss", "time"]
|
||||
)
|
||||
minimize = any(term in metric_name.lower() for term in ["latency", "error", "loss", "time"])
|
||||
|
||||
if minimize:
|
||||
best_id = min(values.keys(), key=lambda k: values[k])
|
||||
@@ -330,10 +325,7 @@ class ExperimentAnalyzer:
|
||||
)
|
||||
|
||||
# Filter to only runs that have the metric
|
||||
runs_with_metric = [
|
||||
r for r in runs
|
||||
if metric in r.data.metrics
|
||||
]
|
||||
runs_with_metric = [r for r in runs if metric in r.data.metrics]
|
||||
|
||||
return runs_with_metric[0] if runs_with_metric else None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user