Test cases fail due to ValueErrror
Opened this issue · 1 comments
kimusaku commented
Describe the bug
Currently, executing pytest
causes ValueError.
To Reproduce
run the following command on main
branch:
pytest -k test_classifier_category_binary_num_proba[target_category_binary_num-auc]
script
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/sapientml/test_generatedcode.py:107: in _execute
generator.generate_pipeline(dataset, task)
sapientml_core/generator.py:219: in generate_pipeline
dataset, sapientml_results = self.generate_code(dataset, task)
sapientml_core/generator.py:265: in generate_code
dataset_summary = summarize_dataset(df, task) # type: ignore
sapientml_core/params.py:403: in summarize_dataset
meta_features_m = generate_model_meta_features(df_train, task.target_columns, is_clf_task)
sapientml_core/meta_features.py:1178: in generate_model_meta_features
meta_feature_dict = _collect_model_meta_features(user_training, target_column_name)
sapientml_core/meta_features.py:275: in _collect_model_meta_features
feature_dict.update(_collect_csv_column_with_ttest(dataX, datay[catg_target_columns]))
sapientml_core/meta_features.py:495: in _collect_csv_column_with_ttest
p = _get_ttest_pvalue(column, yc)
sapientml_core/meta_features.py:455: in _get_ttest_pvalue
_, p = scipy.stats.ttest_ind(c1, c2, equal_var=False)
venv-split-before-transform/lib/python3.10/site-packages/scipy/stats/_axis_nan_policy.py:573: in axis_nan_policy_wrapper
res = hypotest_fun_out(*samples, **kwds)
venv-split-before-transform/lib/python3.10/site-packages/scipy/stats/_stats_py.py:7005: in ttest_ind
v1 = _var(a, axis, ddof=1)
venv-split-before-transform/lib/python3.10/site-packages/scipy/stats/_stats_py.py:1110: in _var
var = _moment(x, 2, axis, mean=mean, xp=xp)
venv-split-before-transform/lib/python3.10/site-packages/scipy/stats/_stats_py.py:1080: in _moment
eps = xp.finfo(dtype).eps * 10
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'numpy.finfo'>, dtype = <class 'numpy.bool_'>
def __new__(cls, dtype):
try:
obj = cls._finfo_cache.get(dtype) # most common path
if obj is not None:
return obj
except TypeError:
pass
if dtype is None:
# Deprecated in NumPy 1.25, 2023-01-16
warnings.warn(
"finfo() dtype cannot be None. This behavior will "
"raise an error in the future. (Deprecated in NumPy 1.25)",
DeprecationWarning,
stacklevel=2
)
try:
dtype = numeric.dtype(dtype)
except TypeError:
# In case a float instance was given
dtype = numeric.dtype(type(dtype))
obj = cls._finfo_cache.get(dtype)
if obj is not None:
return obj
dtypes = [dtype]
newdtype = numeric.obj2sctype(dtype)
if newdtype is not dtype:
dtypes.append(newdtype)
dtype = newdtype
if not issubclass(dtype, numeric.inexact):
> raise ValueError("data type %r not inexact" % (dtype))
E ValueError: data type <class 'numpy.bool_'> not inexact
venv-split-before-transform/lib/python3.10/site-packages/numpy/core/getlimits.py:516: ValueError
==================================================================== short test summary info =====================================================================
FAILED tests/sapientml/test_generatedcode.py::test_classifier_category_binary_num_proba[target_category_binary_num-auc] - ValueError: data type <class 'numpy.bool_'> not inexact
github-actions commented
🎉 Thanks for submitting the issue to SapientML!!
We have the Discord server. Please join the server!