gugarosa / opytimizer

🐦 Opytimizer is a Python library consisting of meta-heuristic optimization algorithms.
https://opytimizer.readthedocs.io
Apache License 2.0
604 stars 41 forks source link

[BUG] AttributeError: 'History' object has no attribute 'show' #9

Closed justinTM closed 4 years ago

justinTM commented 4 years ago

Describe the bug A clear and concise description of what the bug is.

It looks like there is no show() method for the returned opytimizer history.

To Reproduce Steps to reproduce the behavior:

  1. Follow the steps from the wiki Tutorial: Your first optimization
    1. Run the optimizer with o.start(): o = Opytimizer(space=s, optimizer=p, function=f) history = o.start()
    2. Show the history: history.how()

Expected behavior Not sure what I expected, just curious :)

Screenshots

2020-01-02 13:26:28,270 - opytimizer.optimizers.fa — INFO — Iteration 1000/1000
2020-01-02 13:26:28,278 - opytimizer.optimizers.fa — INFO — Fitness: 4.077875713322641e-14
2020-01-02 13:26:28,279 - opytimizer.optimizers.fa — INFO — Position: [[-1.42791381e-07]
 [-1.42791381e-07]]
2020-01-02 13:26:28,279 - opytimizer.opytimizer — INFO — Optimization task ended.
2020-01-02 13:26:28,279 - opytimizer.opytimizer — INFO — It took 7.672951936721802 seconds.
>>> history.show()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'History' object has no attribute 'show'
>>> history
<opytimizer.utils.history.History object at 0x113b75be0>
>>> history.show()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'History' object has no attribute 'show'

Desktop (please complete the following information):

(base) justinmai$ python3
Python 3.7.3 (default, Mar 27 2019, 16:54:48) 
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin

Additional context Add any other context about the problem here.

justinTM commented 4 years ago

Does print(history) serve the same purpose maybe as the older history.show()?

gugarosa commented 4 years ago

Hello @justinTM! I hope everything is all right with you.

Definitily, print(history) is serving as the same purpose to the older history.show(). If you look up into the History class implementation, there is a def __str__() which implements the same funcionality as the old show().

If you have any problems or concerns, please let me know!

Best regards, Gustavo.

gugarosa commented 4 years ago

I have also corrected it into the Wiki. Thank you for pointing this out!

justinTM commented 4 years ago

Thank you, Gustavo, for your work on this and for the helpful code comments and general friendliness! Cheers :)

On Fri, Jan 3, 2020 at 1:06 PM Gustavo Rosa notifications@github.com wrote:

I have also corrected it into the Wiki. Thank you for pointing this out!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gugarosa/opytimizer/issues/9?email_source=notifications&email_token=ACFTOUP3SP5Q33M5NU2DKPTQ36SHDA5CNFSM4KCHAQG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEICCU4I#issuecomment-570698353, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACFTOULAPWDCWDCZNQTHQC3Q36SHDANCNFSM4KCHAQGQ .

gugarosa commented 4 years ago

No problems Justin! I appreciate the help on finding any concerns or issues with the library. I will be closing down this issue and will be updating the wiki with more reliable information in the next few weeks.

If there is anything else, at any time, please let me know!

Best regards, Gustavo.