Skip to content

Commit

Permalink
eval: add func to get score for set of parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
abred committed Jun 8, 2022
1 parent a737cb0 commit 38bc250
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
4 changes: 3 additions & 1 deletion linajea/evaluation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
from .match import match_edges
from .match_nodes import match_nodes
from .evaluate_setup import evaluate_setup
from .evaluator import Evaluator
from .report import Report
from .validation_metric import validation_score
from .analyze_results import (
get_result, get_results, get_best_result,
get_results_sorted, get_best_result_with_config, get_result_id, get_results_sorted_db,
get_results_sorted, get_best_result_with_config,
get_result_id, get_result_params, get_results_sorted_db,
get_best_result_per_setup,
get_tgmm_results,
get_best_tgmm_result,
Expand Down
26 changes: 23 additions & 3 deletions linajea/evaluation/analyze_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,34 @@ def get_result_id(
config,
parameters_id):
''' Get the scores, statistics, and parameters for given
setup, region, and parameters.
config and parameters_id.
Returns a dictionary containing the keys and values of the score
object.
tracking_parameters can be a dict or a TrackingParameters object'''
'''
db_name = config.inference.data_source.db_name
candidate_db = CandidateDatabase(db_name, config.general.db_host, 'r')

result = candidate_db.get_score(parameters_id,
eval_params=config.evaluate.parameters)
return result


def get_result_params(
config,
parameters):
''' Get the scores and statistics for a given config and set of
parameters.
Returns a dictionary containing the keys and values of the score
object.
'''
db_name = config.inference.data_source.db_name
candidate_db = CandidateDatabase(db_name, config.general.db_host, 'r')
if config.evaluate.parameters.roi is None:
config.evaluate.parameters.roi = config.inference.data_source.roi

result = candidate_db.get_score(
candidate_db.get_parameters_id_round(
parameters,
fail_if_not_exists=True),
eval_params=config.evaluate.parameters)
return result

0 comments on commit 38bc250

Please sign in to comment.