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.

how to set tracking_metric_names dynamically

See original GitHub issue

I have a function y=objective(x) which returns a dictionary of metrics y, one of which is the metric to optimize and the others are metadata. I understand I need to tell the experiment class to track those using tracking_metric_names. However, now every time I update objective(x) I need to update the variable tracking_metric_names. Is there a way to use the output of the first call to y=objective(x) to see the output keys and set the tracking_metric_names=[y.keys()] accordingly (after experiment was created)? I tried to read the source code but it seems not very accessible to do so, it’s not as simple as setting the class property.

Moreover, it’s not clear what metric_definitions param does, the documentation is very limited.

Thanks.

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
danielcohenlivecommented, Nov 30, 2022

I’ve added the ability to do tracking metrics directly on the client. So now you can do

for i in range(25):
    parameters, trial_index = ax_client.get_next_trial()
    # Local evaluation here can be replaced with deployment to external system.
    result = evaluate(parameters)
    ax_client.complete_trial(trial_index=trial_index, raw_data=result)
    ax_client.add_tracking_metrics([k for k in result if k not in ax_client.metric_names])

I’m going to close this now, but feel free to ask further questions if you have them

0reactions
chananshcommented, Dec 21, 2022

@danielcohenlive unfortunately it does not work:

AttributeError: ‘AxClient’ object has no attribute ‘metric_names’

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to change the metric name dynamically - Agents
Hi , I am doing the process of changing metric name dynamically ... How many metrics you expect to create and how you...
Read more >
Set up tracking for Dynamic Search Ads - Google Ads Help
Tracking your Dynamic Search Ads work similar to the tracking with ValueTrack parameters, but with one key difference - the Dynamic Search Ads...
Read more >
Is there a way to set the attribute name dynamically via sld ...
In the WMS request, i send an env parameter, specifing the property and the value1 parameters for dynamic sld substitution. The property ...
Read more >
How to Track Dynamic Referral Traffic in Google Tag Manager
Configure GTM to Dynamically Capture the utm_source Parameter · 1. Create Variables for Each UTM Parameter · 2. Replace Dynamic UTM Source ...
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