ValueError: All the 5 fits failed. It is very likely that your model is misconfigured. You can try to debug the error by setting error_score='raise'. #9
ValueError:
All the 5 fits failed.
It is very likely that your model is misconfigured.
You can try to debug the error by setting error_score='raise'.
Below are more details about the failures:
Observed Results
My code looks like this:
model = LCERegressor(random_state=123)
param_distributions = {"n_estimators": range(5, 20),
"max_depth": range(2, 20),
"criterion":["squared_error", "friedman_mse", "absolute_error", "poisson"]
}
model = HalvingRandomSearchCV(model, param_distributions,
random_state=123).fit(mean_data, y_data.ravel())
But here's the problem:
Traceback (most recent call last):
File "D:\Software\anaconda\lib\site-packages\multiprocess\pool.py", line 125, in worker
result = (True, func(*args, kwds))
File "D:\Software\anaconda\lib\site-packages\multiprocess\pool.py", line 48, in mapstar
return list(map(args))
File "D:\Software\anaconda\lib\site-packages\pathos\helpers\mp_helper.py", line 15, in
func = lambda args: f(args)
File "D:\WareHouse\integrated_analysis\Integrated_analysis\Main_Prosessing_temp.py", line 545, in LCE_R_P
model = HalvingRandomSearchCV(model, param_distributions,
File "D:\Software\anaconda\lib\site-packages\sklearn\model_selection_search_successive_halving.py", line 261, in fit
super().fit(X, y=y, groups=groups, fit_params)
File "D:\Software\anaconda\lib\site-packages\sklearn\model_selection_search.py", line 875, in fit
self._run_search(evaluate_candidates)
File "D:\Software\anaconda\lib\site-packages\sklearn\model_selection_search_successive_halving.py", line 366, in _run_search
results = evaluate_candidates(
File "D:\Software\anaconda\lib\site-packages\sklearn\model_selection_search.py", line 852, in evaluate_candidates
_warn_or_raise_about_fit_failures(out, self.error_score)
File "D:\Software\anaconda\lib\site-packages\sklearn\model_selection_validation.py", line 367, in _warn_or_raise_about_fit_failures
raise ValueError(all_fits_failed_message)
ValueError:
All the 5 fits failed.
It is very likely that your model is misconfigured.
You can try to debug the error by setting error_score='raise'.
Below are more details about the failures:
5 fits failed with the following error:
Traceback (most recent call last):
File "D:\Software\anaconda\lib\site-packages\sklearn\model_selection_validation.py", line 686, in _fit_and_score
estimator.fit(X_train, y_train, fitparams)
File "D:\Software\anaconda\lib\site-packages\lce_lce.py", line 934, in fit
self.estimators.fit(X, y)
File "D:\Software\anaconda\lib\site-packages\sklearn\ensemble_bagging.py", line 297, in fit
return self._fit(X, y, self.max_samples, sample_weight=sample_weight)
File "D:\Software\anaconda\lib\site-packages\sklearn\ensemble_bagging.py", line 434, in _fit
all_results = Parallel(
File "D:\Software\anaconda\lib\site-packages\joblib\parallel.py", line 1043, in call
if self.dispatch_one_batch(iterator):
File "D:\Software\anaconda\lib\site-packages\joblib\parallel.py", line 861, in dispatch_one_batch
self._dispatch(tasks)
File "D:\Software\anaconda\lib\site-packages\joblib\parallel.py", line 779, in _dispatch
job = self._backend.apply_async(batch, callback=cb)
File "D:\Software\anaconda\lib\site-packages\joblib_parallel_backends.py", line 208, in apply_async
result = ImmediateResult(func)
File "D:\Software\anaconda\lib\site-packages\joblib_parallel_backends.py", line 572, in init
self.results = batch()
File "D:\Software\anaconda\lib\site-packages\joblib\parallel.py", line 262, in call
return [func(*args, *kwargs)
File "D:\Software\anaconda\lib\site-packages\joblib\parallel.py", line 262, in
return [func(args, kwargs)
File "D:\Software\anaconda\lib\site-packages\sklearn\utils\fixes.py", line 117, in call
return self.function(*args, **kwargs)
File "D:\Software\anaconda\lib\site-packages\sklearn\ensemble_bagging.py", line 141, in _parallel_build_estimators
estimator_fit(X[indices][:, features], y[indices])
File "D:\Software\anaconda\lib\site-packages\lce_lcetree.py", line 1136, in fit
self.tree = _build_tree(X, y)
File "D:\Software\anaconda\lib\site-packages\lce_lcetree.py", line 1132, in _build_tree
root = _create_node(X, y, 0, container)
File "D:\Software\anaconda\lib\site-packages\lce_lcetree.py", line 974, in _create_node
split.fit(X, y)
File "D:\Software\anaconda\lib\site-packages\sklearn\tree_classes.py", line 1342, in fit
super().fit(
File "D:\Software\anaconda\lib\site-packages\sklearn\tree_classes.py", line 190, in fit
raise ValueError(
ValueError: Sum of y is not positive which is necessary for Poisson regression.
"""
The above exception was the direct cause of the following exception:
Hope to get help, thank you very much !!!!
Hope to get help, thank you very much !!!!
Hope to get help, thank you very much !!!!
Describe the bug
ValueError: All the 5 fits failed. It is very likely that your model is misconfigured. You can try to debug the error by setting error_score='raise'.
Below are more details about the failures:
Observed Results
My code looks like this: model = LCERegressor(random_state=123) param_distributions = {"n_estimators": range(5, 20), "max_depth": range(2, 20), "criterion":["squared_error", "friedman_mse", "absolute_error", "poisson"] } model = HalvingRandomSearchCV(model, param_distributions, random_state=123).fit(mean_data, y_data.ravel()) But here's the problem: Traceback (most recent call last): File "D:\Software\anaconda\lib\site-packages\multiprocess\pool.py", line 125, in worker result = (True, func(*args, kwds)) File "D:\Software\anaconda\lib\site-packages\multiprocess\pool.py", line 48, in mapstar return list(map(args)) File "D:\Software\anaconda\lib\site-packages\pathos\helpers\mp_helper.py", line 15, in
func = lambda args: f( args)
File "D:\WareHouse\integrated_analysis\Integrated_analysis\Main_Prosessing_temp.py", line 545, in LCE_R_P
model = HalvingRandomSearchCV(model, param_distributions,
File "D:\Software\anaconda\lib\site-packages\sklearn\model_selection_search_successive_halving.py", line 261, in fit
super().fit(X, y=y, groups=groups, fit_params)
File "D:\Software\anaconda\lib\site-packages\sklearn\model_selection_search.py", line 875, in fit
self._run_search(evaluate_candidates)
File "D:\Software\anaconda\lib\site-packages\sklearn\model_selection_search_successive_halving.py", line 366, in _run_search
results = evaluate_candidates(
File "D:\Software\anaconda\lib\site-packages\sklearn\model_selection_search.py", line 852, in evaluate_candidates
_warn_or_raise_about_fit_failures(out, self.error_score)
File "D:\Software\anaconda\lib\site-packages\sklearn\model_selection_validation.py", line 367, in _warn_or_raise_about_fit_failures
raise ValueError(all_fits_failed_message)
ValueError:
All the 5 fits failed.
It is very likely that your model is misconfigured.
You can try to debug the error by setting error_score='raise'.
Below are more details about the failures:
5 fits failed with the following error: Traceback (most recent call last): File "D:\Software\anaconda\lib\site-packages\sklearn\model_selection_validation.py", line 686, in _fit_and_score estimator.fit(X_train, y_train, fitparams) File "D:\Software\anaconda\lib\site-packages\lce_lce.py", line 934, in fit self.estimators.fit(X, y) File "D:\Software\anaconda\lib\site-packages\sklearn\ensemble_bagging.py", line 297, in fit return self._fit(X, y, self.max_samples, sample_weight=sample_weight) File "D:\Software\anaconda\lib\site-packages\sklearn\ensemble_bagging.py", line 434, in _fit all_results = Parallel( File "D:\Software\anaconda\lib\site-packages\joblib\parallel.py", line 1043, in call if self.dispatch_one_batch(iterator): File "D:\Software\anaconda\lib\site-packages\joblib\parallel.py", line 861, in dispatch_one_batch self._dispatch(tasks) File "D:\Software\anaconda\lib\site-packages\joblib\parallel.py", line 779, in _dispatch job = self._backend.apply_async(batch, callback=cb) File "D:\Software\anaconda\lib\site-packages\joblib_parallel_backends.py", line 208, in apply_async result = ImmediateResult(func) File "D:\Software\anaconda\lib\site-packages\joblib_parallel_backends.py", line 572, in init self.results = batch() File "D:\Software\anaconda\lib\site-packages\joblib\parallel.py", line 262, in call return [func(*args, *kwargs) File "D:\Software\anaconda\lib\site-packages\joblib\parallel.py", line 262, in
return [func( args, kwargs)
File "D:\Software\anaconda\lib\site-packages\sklearn\utils\fixes.py", line 117, in call
return self.function(*args, **kwargs)
File "D:\Software\anaconda\lib\site-packages\sklearn\ensemble_bagging.py", line 141, in _parallel_build_estimators
estimator_fit(X[indices][:, features], y[indices])
File "D:\Software\anaconda\lib\site-packages\lce_lcetree.py", line 1136, in fit
self.tree = _build_tree(X, y)
File "D:\Software\anaconda\lib\site-packages\lce_lcetree.py", line 1132, in _build_tree
root = _create_node(X, y, 0, container)
File "D:\Software\anaconda\lib\site-packages\lce_lcetree.py", line 974, in _create_node
split.fit(X, y)
File "D:\Software\anaconda\lib\site-packages\sklearn\tree_classes.py", line 1342, in fit
super().fit(
File "D:\Software\anaconda\lib\site-packages\sklearn\tree_classes.py", line 190, in fit
raise ValueError(
ValueError: Sum of y is not positive which is necessary for Poisson regression.
"""
The above exception was the direct cause of the following exception: Hope to get help, thank you very much !!!! Hope to get help, thank you very much !!!! Hope to get help, thank you very much !!!!
Code to Reproduce
None
Expected Results
Do not throw an error
Version