Skip to content

Commit

Permalink
style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
priyakasimbeg committed Nov 9, 2023
1 parent c668c1c commit 11e70c0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
3 changes: 1 addition & 2 deletions scoring/performance_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scoring_utils
from scoring import scoring_utils

import algorithmic_efficiency.workloads.workloads as workloads_registry

Expand Down Expand Up @@ -180,7 +180,6 @@ def get_times_for_submission(submission,
logging.warning(f'Expecting {NUM_TRIALS} trials for workload '
f'{workload} but found {num_trials} trials.')
validation_metric, validation_target = scoring_utils.get_workload_validation_target(workload)
validation_target = validation_target

trial_idx, time_idx = get_index_that_reaches_target(
group, validation_metric, validation_target)
Expand Down
5 changes: 2 additions & 3 deletions scoring/score_submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from tabulate import tabulate

from scoring import performance_profile
from scoring.performance_profile import check_if_minimized

flags.DEFINE_string(
'experiment_path',
Expand All @@ -28,7 +27,7 @@

def get_summary_df(workload, workload_df):
validation_metric, validation_target = scoring_utils.get_workload_validation_target(workload)
is_minimized = check_if_minimized(validation_metric)
is_minimized = performance_profile.check_if_minimized(validation_metric)
target_op = operator.le if is_minimized else operator.ge
best_op = min if is_minimized else max
idx_op = np.argmin if is_minimized else np.argmax
Expand Down Expand Up @@ -65,7 +64,7 @@ def main(_):
dfs.append(summary_df)

df = pd.concat(dfs)
print(tabulate(df, headers='keys', tablefmt='psql'))
logging.info(tabulate(df, headers='keys', tablefmt='psql'))

if FLAGS.compute_performance_profiles:
performance_profile_df = performance_profile.compute_performance_profiles(
Expand Down
6 changes: 2 additions & 4 deletions scoring/scoring_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def get_trials_df(logfile):
def get_experiment_df(experiment_dir):
"""Gets a df of per trial results from an experiment dir.
The output df can be provided as input to
score_profilecompute_performance_profiles.
performance_profile.compute_performance_profiles.
Args:
experiment_dir: path to experiment directory containing
results for workloads.
Expand Down Expand Up @@ -196,8 +196,7 @@ def get_experiment_df(experiment_dir):

## Get workload properties
def get_workload_validation_target(workload):
"""Returns workload target metric name and value.
"""
"""Returns workload target metric name and value."""
workload_name = re.match(WORKLOAD_NAME_PATTERN, workload).group(1)
framework = re.match(WORKLOAD_NAME_PATTERN, workload).group(2)
workload_metadata = copy.copy(WORKLOADS[workload_name])
Expand All @@ -208,7 +207,6 @@ def get_workload_validation_target(workload):
workload_metadata['workload_path'] + f'{framework}',
'workload.py')
workload_init_kwargs = {}
print(workload_metadata['workload_path'])
workload_obj = workloads_registry.import_workload(
workload_path=workload_metadata['workload_path'],
workload_class_name=workload_metadata['workload_class_name'],
Expand Down

0 comments on commit 11e70c0

Please sign in to comment.