tpot2 icon indicating copy to clipboard operation
tpot2 copied to clipboard

Misleading docstrings for `TPOTEstimator.max_eval_time_mins` & `max_time_mins`

Open chimaerase opened this issue 1 year ago • 1 comments

In 0.1.9a0, and by inspection, also in master, the docstring for TPOTEstimator.max_eval_time_mins indicates that a float, including float("inf") is accepted, and also documents a default value that doesn't match the default set in the __init__() signature. Defaults should be ideally be auto-detected via mkdocs or similar infrastructure, not entered / maintained by busy & distractible humans. It also appears that the default is masking an internal problem in how this value is processed.

I've verified on the LOC just prior to creating a TPOTEstimator (first line of output below) that my max_eval_time_mins is float("inf"), but I still get an error. It appears that the default parameter value in __init__() is likely masking an internal inconsistency in how this is treated. There's a similarly misleading docstring re: default value for max_time_mins though I haven't explicitly tested that.

It seems likely that similar documentation maintenance issues are pervasive within the codebase, though I haven't taken the time to explicitly verify.

Creating TPOTEstimator.  max_eval_time_mins = inf, max_time_mins = inf
Generation:   0%|                                                                                                                                                                                         | 0/100 [00:00<?, ?it/s]Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  [censored lines from my private code]
    estimator.fit(X, y)  # Use genetic algorithm to explore hyperparameter space
    ^^^^^^^^^^^^^^^^^^^
  File "/home/user/.venv/lib/python3.11/site-packages/tpot2/tpot_estimator/estimator.py", line 763, in fit
    self._evolver_instance.optimize()
  File "/home/user/.venv/lib/python3.11/site-packages/tpot2/evolvers/base_evolver.py", line 499, in optimize
    self.evaluate_population()
  File "/home/user/.venv/lib/python3.11/site-packages/tpot2/evolvers/base_evolver.py", line 685, in evaluate_population
    self.evaluate_population_full(budget=self.budget)
  File "/home/user/.venv/lib/python3.11/site-packages/tpot2/evolvers/base_evolver.py", line 717, in evaluate_population_full
    scores, start_times, end_times, eval_errors = tpot2.utils.eval_utils.parallel_eval_objective_list(individuals_to_evaluate, self.objective_functions, verbose=self.verbose, max_eval_time_mins=self.max_eval_time_mins, budget=budget, n_expected_columns=len(self.objective_names), client=self._client, scheduled_timeout_time=self.scheduled_timeout_time, **self.objective_kwargs)
                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.venv/lib/python3.11/site-packages/tpot2/utils/eval_utils.py", line 133, in parallel_eval_objective_list
    future = client.submit(eval_objective_list, individual,  objective_list, verbose=verbose, timeout=max_eval_time_mins*60,**objective_kwargs)
                                                                                                      ~~~~~~~~~~~~~~~~~~^~~
TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'

chimaerase avatar Feb 12 '25 00:02 chimaerase

Thanks for catching this. I submitted a PR to correct it here: https://github.com/EpistasisLab/tpot/pull/1375

perib avatar Apr 17 '25 22:04 perib

Fixed by https://github.com/EpistasisLab/tpot/pull/1375

jay-m-dev avatar Jul 03 '25 21:07 jay-m-dev