Support custom events for metrics update
See original GitHub issueCurrently for ignite metrics, update
function is called per iteration. In scenarios like multitasking, there can be metrics for different tasks, and each iteration might only have outputs for a subset of tasks. In this situation, only the metrics associated with those tasks having outputs can/should be updated.
To make it work, I need to overwrite the attach
function like this:
class CustomRnningAverage(RunningAverage):
def attach(self, engine, name, custom_event=None):
if custom_event is None:
super().attach(engine, name)
else:
if self.epoch_bound:
# restart average every epoch
engine.add_event_handler(Events.EPOCH_STARTED, self.started)
# compute metric
engine.add_event_handler(custom_event, self.iteration_completed)
# apply running average
engine.add_event_handler(custom_event, self.completed, name)
This is doable, but would be nice to have it by default in ignite. Also, this manual overwrite doesn’t work with DDP. The cause is related to _internal_attach
in metrics_lambda.py
.
I would like to propose
- Have
update
every iteration by default - Support overwrite when to
update
by accepting custom events - Make it work with DDP
Multitasking is one case where this can be very helpful. But I am sure there will be other use cases.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:13 (5 by maintainers)
Top Results From Across the Web
Application Insights API for custom events and metrics
Use the Application Insights core telemetry API to send custom events and metrics and your own versions of standard telemetry. This API is...
Read more >Introduction to custom events and attributes
Two popular solutions for reporting custom data are reporting custom events and custom attributes. There are several ways to accomplish this, depending on...
Read more >Using Custom Metrics and Events
Custom events and metrics will appear in the Campaign UI. In the left navigation, click All Recent Activity. If any custom events or...
Read more >[GA4] Custom events - Analytics Help - Google Support
Before you create a custom event, review the list of automatically collected, enhanced measurement, and recommended events. These types of events automatically ...
Read more >Custom events | Adobe Analytics - Experience League
This help page describes how custom events work as a metric. For information on how custom events work as an implementation variable, see...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes,
MetricUsage
should be the way to configure your metric.Epoch-wise accuracy :
It means reset of metric at
Event.EPOCH_STARTED
, update atEvent.ITERATION_COMPLETED
and complete atEvent.EPOCH_COMPLETED
Batch-wise accuracy :
It means reset of metric at
Event.ITERATION_STARTED
, update atEvent.ITERATION_COMPLETED
and complete atEvent.ITERATION_COMPLETED
You can define a custom usage
Here,
YourCustomUsage
must inherit fromMetricUsage
and you customize when reset, update and complete of metric occur.HTH
@sdesrozis Would you mind showing an example of using the changes you made in sdesrozis:issue_874 to update on custom events? My understanding is that I can create a customized
MetricUsage
class to do that.