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

[BUG][URGENT] Metrics dont work right in new release #110

Closed
1 of 2 tasks
chaithyagr opened this issue Apr 12, 2021 · 2 comments
Closed
1 of 2 tasks

[BUG][URGENT] Metrics dont work right in new release #110

chaithyagr opened this issue Apr 12, 2021 · 2 comments
Labels

Comments

@chaithyagr
Copy link
Contributor

System setup
OS: [e.g] macOS v10.14.1
Python version: v3.6.10
Python environment (if any): [e.g.] conda v4.5.11

Describe the bug
I was recently moving from old to new version of modopt for some of other packages that use modopt.
I see the error on metrics:

I believe the error is coming from here:

@metrics.setter
def metrics(self, metrics):
if isinstance(metrics, type(None)):
self._metrics = {}
elif not isinstance(metrics, dict):
raise TypeError(
'Metrics must be a dictionary, not {0}.'.format(type(metrics)),
)

We don't have any else! if metrics is dictionary but not None, then we dont set any metrics! ie. if metrics = {}, which is default.
I am quite surprised how testing missed this ! I might be missing something here surely.

I checked the reason for most of the codes to work in test is cause we dont test the metrics, and also the SetUp by default gives None as input to metrics.

So, effectively, modopt would fail for any algorithm with metrics defined as a dictionary (which is how it must be used)!!

To Repro

from modopt.opt.algorithms import SetUp
A = SetUp(metrics={})

Results in :
AttributeError: 'SetUp' object has no attribute '_metrics'

To fix
we just need to add an else self._metrics = metrics line. However, @sfarrens how did we miss this in the refactoring?

@sfarrens, In my opinion this needs to be fixed at highest priority and the current release on PyPi must be removed and updated
with this. Perhaps, adding a dummy test with metrics is also very much needed!

Are you planning to submit a Pull Request?

  • Yes
  • No
@chaithyagr chaithyagr added the bug label Apr 12, 2021
This was referenced Apr 12, 2021
@sfarrens
Copy link
Contributor

Good spot @chaithyagr!

@sfarrens, In my opinion this needs to be fixed at highest priority and the current release on PyPi must be removed and updated with this.

I can't remove the latest release as it is already used elsewhere, but we can simply release a new patch (1.5.1) with this bug fix. I can then use this patch in the PySAP release.

Perhaps, adding a dummy test with metrics is also very much needed!

Are you planning to add this to #111?

@chaithyagr
Copy link
Contributor Author

Didnt get at it... Maybe we repurpose this issue for it?

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

Successfully merging a pull request may close this issue.

2 participants