MCPcopy Index your code
hub / github.com/DeepLabCut/DeepLabCut / Result

Class Result

deeplabcut/benchmark/base.py:132–178  ·  view source on GitHub ↗

Benchmark result.

Source from the content-addressed store, hash-verified

130
131@dataclasses.dataclass
132class Result:
133 """Benchmark result."""
134
135 code: str
136 method_name: str
137 benchmark_name: str
138 root_mean_squared_error: float = float("nan")
139 mean_avg_precision: float = float("nan")
140 benchmark_version: str = __version__
141
142 _export_mapping = dict(
143 code="code",
144 benchmark_name="benchmark",
145 method_name="method",
146 benchmark_version="version",
147 root_mean_squared_error="RMSE",
148 mean_avg_precision="mAP",
149 )
150
151 _primary_key = ("benchmark_name", "method_name", "benchmark_version")
152
153 @property
154 def primary_key(self) -> tuple[str]:
155 """The primary key to uniquely identify this result."""
156 return tuple(getattr(self, k) for k in self._primary_key)
157
158 @property
159 def primary_key_names(self) -> tuple[str]:
160 """Names of the primary keys."""
161 return tuple(self._export_mapping.get(k) for k in self._primary_key)
162
163 def __str__(self):
164 return (
165 f"{self.method_name}, {self.benchmark_name}: "
166 f"{self.mean_avg_precision} mAP, "
167 f"{self.root_mean_squared_error} RMSE"
168 )
169
170 @classmethod
171 def fromdict(cls, data: dict):
172 """Construct result object from dictionary."""
173 kwargs = {attr: data[key] for attr, key in cls._export_mapping.items()}
174 return cls(**kwargs)
175
176 def todict(self) -> dict:
177 """Export result object to dictionary, with less verbose key names."""
178 return {key: getattr(self, attr) for attr, key in self._export_mapping.items()}
179
180
181class ResultCollection:

Callers 2

evaluateFunction · 0.90
evaluateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected