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

tpot does not create memory dir and gives spurious error #837

Closed
cottrell opened this issue Feb 20, 2019 · 5 comments
Closed

tpot does not create memory dir and gives spurious error #837

cottrell opened this issue Feb 20, 2019 · 5 comments
Labels

Comments

@cottrell
Copy link
Contributor

I get this error: RuntimeError: A pipeline has not yet been optimized. Please call fit() first.

if I don't create the memory dir first. I think fix is easy in base.py but probably needs an opinion on correct behaviour.

@weixuanfu
Copy link
Contributor

Hmm, TPOT should raise a ValueError when the memory folder does not exist. Was the error raised in this case? Could you please provide more details about this issue, like codes for reproducing it?

@cottrell
Copy link
Contributor Author

Here is code

In [22]: t = tpot.TPOTClassifier(memory='asdf')                                                                                                                                                                    

In [23]: t.fit(np.random.randn(100, 5), np.random.rand(100) > 0.5)                                                                                                                                                 
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
~/dev/tpot/tpot/base.py in fit(self, features, target, sample_weight, groups)
    647             with warnings.catch_warnings():
--> 648                 self._setup_memory()
    649                 warnings.simplefilter('ignore')

~/dev/tpot/tpot/base.py in _setup_memory(self)
    708                     raise ValueError(
--> 709                         'Could not find directory for memory caching: {}'.format(self.memory)
    710                     )

ValueError: Could not find directory for memory caching: asdf

During handling of the above exception, another exception occurred:

RuntimeError                              Traceback (most recent call last)
<ipython-input-23-1844720facf9> in <module>
----> 1 t.fit(np.random.randn(100, 5), np.random.rand(100) > 0.5)

~/dev/tpot/tpot/base.py in fit(self, features, target, sample_weight, groups)
    691                     # raise the exception if it's our last attempt
    692                     if attempt == (attempts - 1):
--> 693                         raise e
    694             return self
    695 

~/dev/tpot/tpot/base.py in fit(self, features, target, sample_weight, groups)
    682                         self._pbar.close()
    683 
--> 684                     self._update_top_pipeline()
    685                     self._summary_of_best_pipeline(features, target)
    686                     # Delete the temporary cache before exiting

~/dev/tpot/tpot/base.py in _update_top_pipeline(self)
    756             # If user passes CTRL+C in initial generation, self._pareto_front (halloffame) shoule be not updated yet.
    757             # need raise RuntimeError because no pipeline has been optimized
--> 758             raise RuntimeError('A pipeline has not yet been optimized. Please call fit() first.')
    759 
    760     def _summary_of_best_pipeline(self, features, target):

RuntimeError: A pipeline has not yet been optimized. Please call fit() first.

@weixuanfu
Copy link
Contributor

ValueError: Could not find directory for memory caching: asdf

Besed on the error message above, the issue is caused by the wrong memory parameter. It should be a valid path of directory.

@cottrell
Copy link
Contributor Author

Yes, that is the bug. It should create the dir I think not error.

weixuanfu added a commit to weixuanfu/tpot that referenced this issue Apr 11, 2019
@weixuanfu
Copy link
Contributor

I close this issue because it is fixed in master branch. Please feel free to reopen it if there is other related issues.

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

No branches or pull requests

2 participants