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

Function evaluate

deeplabcut/benchmark/__init__.py:45–98  ·  view source on GitHub ↗

Run evaluation for all benchmarks and methods. Note that in order for your custom benchmark to be included during evaluation, the following conditions need to be met: - The benchmark subclassed one of the benchmark definitions in in ``benchmark.benchmarks`` - The

(
    include_benchmarks: Container[str] = None,
    results: ResultCollection = None,
    on_error="return",
)

Source from the content-addressed store, hash-verified

43
44
45def evaluate(
46 include_benchmarks: Container[str] = None,
47 results: ResultCollection = None,
48 on_error="return",
49) -> ResultCollection:
50 """Run evaluation for all benchmarks and methods.
51
52 Note that in order for your custom benchmark to be included during
53 evaluation, the following conditions need to be met:
54
55 - The benchmark subclassed one of the benchmark definitions in
56 in ``benchmark.benchmarks``
57 - The benchmark is registered by applying the ``@benchmark.register``
58 decorator to the class
59 - The benchmark was imported. This is done automatically for all
60 benchmarks that are defined in submodules or subpackages of the
61 ``benchmark.submissions`` module. For all other locations, make
62 sure to manually import the packages **before** calling the
63 ``evaluate()`` function.
64
65 Args:
66 include_benchmarks:
67 If ``None``, run all benchmarks that were discovered. If a container
68 is passed, only include methods that were defined on benchmarks with
69 the specified names. E.g., ``include_benchmarks = ["trimouse"]`` would
70 only evaluate methods of the trimouse benchmark dataset.
71 on_error:
72 see documentation in ``benchmark.base.Benchmark.evaluate()``
73
74 Returns:
75 A collection of all results, which can be printed or exported to
76 ``pd.DataFrame`` or ``json`` file formats.
77 """
78 if results is None:
79 results = ResultCollection()
80 for benchmark_cls in __registry:
81 if include_benchmarks is not None:
82 if benchmark_cls.name not in include_benchmarks:
83 continue
84 benchmark = benchmark_cls()
85 for name in benchmark.names():
86 if (
87 Result(
88 code=benchmark.code,
89 method_name=name,
90 benchmark_name=benchmark_cls.name,
91 )
92 in results
93 ):
94 continue
95 else:
96 result = benchmark.evaluate(name, on_error=on_error)
97 results.add(result)
98 return results
99
100
101def get_filepath(basename: str):

Callers

nothing calls this directly

Calls 5

addMethod · 0.95
ResultCollectionClass · 0.90
ResultClass · 0.90
namesMethod · 0.80
evaluateMethod · 0.80

Tested by

no test coverage detected