question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve Frequency

See original GitHub issue

🚀 Feature

If we would like to log datapoints/second every 100 iterations, we most probably do like this

wps_metric = Frequency(output_transformer=lambda x: x['ntokens'])
wps_metric.attach(trainer, name='wps', event_name=Events.ITERATION_COMPLETED(every=100))

however, seems like this wont take into account all other iterations while computing the total number of tokens.

class Frequency(Metric):
    ....
    def attach(self, engine, name, event_name=Events.ITERATION_COMPLETED):
        engine.add_event_handler(Events.EPOCH_STARTED, self.started)
        engine.add_event_handler(event_name, self.iteration_completed)
        engine.add_event_handler(event_name, self.completed, name)

IMO, should be

class Frequency(Metric):
    ....
    def attach(self, engine, name, event_name=Events.ITERATION_COMPLETED):
        engine.add_event_handler(Events.EPOCH_STARTED, self.started)
        engine.add_event_handler(Events.ITERATION_COMPLETED, self.iteration_completed)
        engine.add_event_handler(event_name, self.completed, name)

cc @erip

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
eripcommented, Apr 23, 2020

Not sure how I missed the cc here - sorry about that! Let me reacquaint myself quickly and I’ll try to submit a PR.

0reactions
vfdev-5commented, Apr 24, 2020

@erip I’m on Mac too, the following test passes on master on my computer.

Anyway, please send the PR and we can see what happens. I think we also need to improve the docs and explain better the purpose of event_name argument.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Raise Your Emotional & Spiritual Vibration
Learn how to raise your emotional vibration frequency with these tips from Chopra. Raise your vibrations and support positivity in your life.
Read more >
20 Ways To Increase Your Vibrational Frequency | ITN Blog
5. PARTICIPATE IN JOYFUL MOVEMENT. Joyful movement stimulates the release of endorphins, which help to increase your vibrational frequency.
Read more >
Studying frequency processing of the brain to enhance long ...
It is envisaged that the brain could be stimulated through binaural beats (sound frequency) at 40 Hz (gamma) to enhance long-term memory capacity....
Read more >
Increase frequency definition and meaning - Collins Dictionary
Increase frequency definition: The frequency of an event is the number of times it happens during a particular period.... | Meaning, pronunciation ...
Read more >
365 Ways to Raise Your Frequency: Simple Tools to Increase ...
365 Ways to Raise Your Frequency: Simple Tools to Increase Your Spiritual Energy for Balance, Purpose, and Joy [Alvarez, Melissa] on Amazon.com.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found