Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escaping: Escape characters +-&|!(){}[]^"~*?:\ with \, e.g. \+
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Answered
Hi, Is There A Way To Query Some Tasks Ordered By A Scalar Metric? I Tried With:

Hi, is there a way to query some tasks ordered by a scalar metric? I tried with:

Task.get_tasks(
    project_name='project',
    task_name='task',
    task_filter={'order_by': ['-last_metrics.f1_score.train']},
)

the tasks are returned correctly but they are not sorted

  
  
Posted 11 months ago
Votes Newest

Answers 4


Makes sense 🙂

  
  
Posted 11 months ago

Hi @<1570220858075516928:profile|SlipperySheep79> , the reason it's not sorting for you is that the last metrics are not stored by the title/series name itself (as it might contain characters unsupported by the database). Instead, you need to use the format last_metrics.<md5-encoded-title>.<md5-endoed-series>.<item>
Where:

  • md5 encoding is (in python): hashlib.md5(str("thestring").encode("utf-8")).hexdigest()
  • and <item> can be either value , min_value or max_value
  
  
Posted 11 months ago

Hi @<1523701087100473344:profile|SuccessfulKoala55> , thanks for the answer, I'll try that. Would you suggest any other simpler way to achieve the same result? I just want to get the best model according to a logged metric.

  
  
Posted 11 months ago

So in your case:

title = hashlib.md5(str("f1_score").encode("utf-8")).hexdigest()
series = hashlib.md5(str("train").encode("utf-8")).hexdigest()
Task.get_tasks(
    project_name='project',
    task_name='task',
    task_filter={'order_by': [f'-last_metrics.{title}.{series}']},
)
  
  
Posted 11 months ago
535 Views
4 Answers
11 months ago
11 months ago
Tags