You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I'm trying to use causal-learn (pc and fci at the moment) but I'm stuck with input data errors.
My dataframe has no nans nor infs, as checked with both pandas and numpy, but running either algorithm reports error
TypeError: ufunc 'isnan' (or 'isinf') not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
The full stack trace is as follows (where data types can also be seen):
reading csv...
df.dtypes=cpu_utilization Float64
memory_usage Float64
pixel Int64
fps Int64
consumption Int64
dtype: object
df.isnull().values.any()=np.False_
np.isinf(df).values.any()=np.False_
learning structure...
df.shape=(12748, 5)
0it [00:00, ?it/s]
Traceback (most recent call last):
File "/home/stefano/PyCharm-projects/Playground-causal-learn/scripts/tu_wien_stuff.py", line 126, in <module>
process_file(f"{args.filepath}/{file}", columns, args)
File "/home/stefano/PyCharm-projects/Playground-causal-learn/scripts/tu_wien_stuff.py", line 81, in process_file
model = learn_structure(np_data, args.nrows, filepath)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/stefano/PyCharm-projects/Playground-causal-learn/scripts/tu_wien_stuff.py", line 46, in learn_structure
model_graph, model_edges = fci(df, mvpc=True, indep_test="mv_fisherz") # TODO ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/stefano/.pyenv/versions/3.11.3/lib/python3.11/site-packages/causallearn/search/ConstraintBased/FCI.py", line 738, in fci
independence_test_method = CIT(dataset, method=independence_test_method, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/stefano/.pyenv/versions/3.11.3/lib/python3.11/site-packages/causallearn/utils/cit.py", line 32, in CIT
return FisherZ(data, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/stefano/.pyenv/versions/3.11.3/lib/python3.11/site-packages/causallearn/utils/cit.py", line 142, in __init__
self.assert_input_data_is_valid()
File "/home/stefano/.pyenv/versions/3.11.3/lib/python3.11/site-packages/causallearn/utils/cit.py", line 81, in assert_input_data_is_valid
assert allow_nan or not np.isnan(self.data).any(), "Input data contains NaN. Please check."
^^^^^^^^^^^^^^^^^^^
TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
The text was updated successfully, but these errors were encountered:
FYI, in the MWE I'm using causallearn.search.ConstraintBased.PC, but the same error happens with fci.
As an aside, the same MWE but using ges or lingam gives a different error: AttributeError: np.matwas removed in the NumPy 2.0 release. Usenp.asmatrix instead. (I have numpy 2.1.1 installed)
Hello,
I'm trying to use causal-learn (pc and fci at the moment) but I'm stuck with input data errors.
My dataframe has no nans nor infs, as checked with both pandas and numpy, but running either algorithm reports error
TypeError: ufunc 'isnan' (or 'isinf') not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
The full stack trace is as follows (where data types can also be seen):
The text was updated successfully, but these errors were encountered: