-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8432263
commit 0381d61
Showing
2 changed files
with
35 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from dataclasses import dataclass | ||
from pathlib import Path | ||
from typing import TYPE_CHECKING, Any, Optional | ||
|
||
from typing_extensions import Protocol | ||
|
||
from syftbox.lib.client_config import SyftClientConfig | ||
|
||
|
||
@dataclass | ||
class BaseMetric: | ||
"""Base class for all metrics with common fields.""" | ||
|
||
num_runs: int | ||
|
||
|
||
class MetricCollector(Protocol): | ||
""" | ||
Protocol for classes that collect performance metrics. | ||
""" | ||
|
||
client_config: SyftClientConfig | ||
|
||
def collect_metrics(self, num_runs: int) -> BaseMetric: | ||
"""Calculate performance metrics.""" | ||
... | ||
|
||
|
||
class BenchmarkReporter(Protocol): | ||
"""Protocol defining the interface for benchmark result reporters.""" | ||
|
||
def generate(self, metrics: dict[str, BaseMetric], report_path: Optional[Path] = None) -> Any: | ||
"""Generate the benchmark report.""" | ||
... |