Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash at end of regression runs #57

Open
mszulcz-mitre opened this issue Jul 5, 2023 · 1 comment
Open

Crash at end of regression runs #57

mszulcz-mitre opened this issue Jul 5, 2023 · 1 comment

Comments

@mszulcz-mitre
Copy link

When I make a run with cfg.dataset.task_type = 'regression', the code crashes at the end of the run. The error message is:

Traceback (most recent call last):
 File "main_pyg.py", line 55, in <module>
   agg_runs(cfg.out_dir, cfg.metric_best)
 File "~/Code/GraphGym/graphgym/utils/agg_runs.py", line 100, in agg_runs
   [stats[metric] for stats in stats_list])
 File "~/Code/GraphGym/graphgym/utils/agg_runs.py", line 100, in <listcomp>
   [stats[metric] for stats in stats_list])
KeyError: 'accuracy'

The problem seems to be that accuracy is not a metric logged for regression tasks. Here are the relevant lines in agg_runs.py:

                if metric_best == 'auto':
                    metric = 'auc' if 'auc' in stats_list[0] else 'accuracy'

Here's a fix:

                if metric_best == 'auto':
                    if cfg.dataset.task_type == 'classification':
                        metric = 'auc' if 'auc' in stats_list[0] else 'accuracy'
                    elif cfg.dataset.task_type == 'regression':
                        metric = 'mse'
@gogowinner
Copy link

In order to perform the regression, it will also be necessary to add metric_agg: argmin inside the yaml file in order to get the desired results with MSE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants