ValueError: Input contains NaN. #28990
amalislam675
started this conversation in
General
Replies: 1 comment
-
This error indicates that your input data contains Null values. You need to check your input data for NaN values. You can use the isna() function in pandas to do that. then you need to decide how to want handle the null values, either by dropping or imputing the data. sometimes this error occurs during evaluation appear in third fold, sometimes it appears in second fold. I think this is because of the random split of the data into the folds. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am facing this error when I train my model with five folds. If I individually train my data which is separated in third fold, my model training goes smoothly. When I train my model with five folds, sometimes this error occurs during evaluation appear in third fold, sometimes it appears in second fold. Could anyone help to resolve this issue.
Traceback (most recent call last):
File “/home/exp/src/main.py”, line 273, in
train(model, optimizer, train_data, fold)
File “/home/exp/src/main.py”, line 97, in train
tst_auc, tst_aupr = test_epoch()
File “/home/exp/src/main.py”, line 76, in test_epoch
test_auc = roc_auc_score(y_true, y_score_test, average=‘macro’)
File “/home/.conda/envs/fo/lib/python3.10/site-packages/sklearn/utils/_param_validation.py”, line 211, in wrapper
return func(*args, **kwargs)
File “/home/.conda/envs/fo/lib/python3.10/site-packages/sklearn/metrics/_ranking.py”, line 605, in roc_auc_score
y_score = check_array(y_score, ensure_2d=False)
File “/home/.conda/envs/fo/lib/python3.10/site-packages/sklearn/utils/validation.py”, line 959, in check_array
_assert_all_finite(
File “/home/.conda/envs/fo/lib/python3.10/site-packages/sklearn/utils/validation.py”, line 124, in _assert_all_finite
_assert_all_finite_element_wise(
File “/home/.conda/envs/fo/lib/python3.10/site-packages/sklearn/utils/validation.py”, line 173, in _assert_all_finite_element_wise
raise ValueError(msg_err)
ValueError: Input contains NaN.
Beta Was this translation helpful? Give feedback.
All reactions