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

Issue when running auto_forecast() or tune_test_forecast() with rf #4

Closed
jroy12345 opened this issue Jul 12, 2022 · 2 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@jroy12345
Copy link

Here is the error. Typically I can rerun the codeblock in my notebook and after 1-2 tries it will fix itself.

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_3112\911625238.py in <module>
      3     j.ingest_grid(model)
      4     j.cross_validate(dynamic_tuning=26)
----> 5     j.auto_forecast()
      6     j.save_summary_stats()
      7     print(model)

~\AppData\Roaming\Python\Python37\site-packages\scalecast\Forecaster.py in auto_forecast(self, call_me, dynamic_testing, test_only)

~\AppData\Roaming\Python\Python37\site-packages\scalecast\Forecaster.py in manual_forecast(self, call_me, dynamic_testing, test_only, **kwargs)

~\AppData\Roaming\Python\Python37\site-packages\scalecast\Forecaster.py in _forecast_sklearn(self, fcster, dynamic_testing, tune, Xvars, normalizer, test_only, **kwargs)

~\AppData\Roaming\Python\Python37\site-packages\scalecast\Forecaster.py in evaluate_model(scaler, regr, X, y, Xvars, fcst_horizon, future_xreg, dynamic_testing, true_forecast)

~\Anaconda3\envs\time\lib\site-packages\sklearn\ensemble\_forest.py in fit(self, X, y, sample_weight)
    465                     n_samples_bootstrap=n_samples_bootstrap,
    466                 )
--> 467                 for i, t in enumerate(trees)
    468             )
    469 

~\Anaconda3\envs\time\lib\site-packages\joblib\parallel.py in __call__(self, iterable)
   1041             # remaining jobs.
   1042             self._iterating = False
-> 1043             if self.dispatch_one_batch(iterator):
   1044                 self._iterating = self._original_iterator is not None
   1045 

~\Anaconda3\envs\time\lib\site-packages\joblib\parallel.py in dispatch_one_batch(self, iterator)
    859                 return False
    860             else:
--> 861                 self._dispatch(tasks)
    862                 return True
    863 

~\Anaconda3\envs\time\lib\site-packages\joblib\parallel.py in _dispatch(self, batch)
    777         with self._lock:
    778             job_idx = len(self._jobs)
--> 779             job = self._backend.apply_async(batch, callback=cb)
    780             # A job can complete so quickly than its callback is
    781             # called before we get here, causing self._jobs to

~\Anaconda3\envs\time\lib\site-packages\joblib\_parallel_backends.py in apply_async(self, func, callback)
    206     def apply_async(self, func, callback=None):
    207         """Schedule a func to be run"""
--> 208         result = ImmediateResult(func)
    209         if callback:
    210             callback(result)

~\Anaconda3\envs\time\lib\site-packages\joblib\_parallel_backends.py in __init__(self, batch)
    570         # Don't delay the application, to avoid keeping the input
    571         # arguments in memory
--> 572         self.results = batch()
    573 
    574     def get(self):

~\Anaconda3\envs\time\lib\site-packages\joblib\parallel.py in __call__(self)
    261         with parallel_backend(self._backend, n_jobs=self._n_jobs):
    262             return [func(*args, **kwargs)
--> 263                     for func, args, kwargs in self.items]
    264 
    265     def __reduce__(self):

~\Anaconda3\envs\time\lib\site-packages\joblib\parallel.py in <listcomp>(.0)
    261         with parallel_backend(self._backend, n_jobs=self._n_jobs):
    262             return [func(*args, **kwargs)
--> 263                     for func, args, kwargs in self.items]
    264 
    265     def __reduce__(self):

~\Anaconda3\envs\time\lib\site-packages\sklearn\utils\fixes.py in __call__(self, *args, **kwargs)
    214     def __call__(self, *args, **kwargs):
    215         with config_context(**self.config):
--> 216             return self.function(*args, **kwargs)
    217 
    218 

~\Anaconda3\envs\time\lib\site-packages\sklearn\ensemble\_forest.py in _parallel_build_trees(tree, forest, X, y, sample_weight, tree_idx, n_trees, verbose, class_weight, n_samples_bootstrap)
    171 
    172         indices = _generate_sample_indices(
--> 173             tree.random_state, n_samples, n_samples_bootstrap
    174         )
    175         sample_counts = np.bincount(indices, minlength=n_samples)

~\Anaconda3\envs\time\lib\site-packages\sklearn\ensemble\_forest.py in _generate_sample_indices(random_state, n_samples, n_samples_bootstrap)
    127 
    128     random_instance = check_random_state(random_state)
--> 129     sample_indices = random_instance.randint(0, n_samples, n_samples_bootstrap)
    130 
    131     return sample_indices

mtrand.pyx in numpy.random.mtrand.RandomState.randint()

_bounded_integers.pyx in numpy.random._bounded_integers._rand_int32()

TypeError: 'numpy.float64' object cannot be interpreted as an integer
@mikekeith52 mikekeith52 self-assigned this Jul 12, 2022
@mikekeith52 mikekeith52 added the bug Something isn't working label Jul 12, 2022
@mikekeith52
Copy link
Owner

Could you please attach the grid you are using for the random forest model (or if it is the default grid, let me know), as well as the scikit-learn version you have installed?

@jroy12345
Copy link
Author

rf default grid from GridGenerator.get_example_grids()

sklearn version '1.0.2'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants