there seems to be an issue at the step where the processed data are converted to tensorflow datasets
I am getting this error
2024-04-11 17:16:47.846398: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: SSE SSE2 SSE3 SSE4.1 SSE4.2 AVX AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
Traceback (most recent call last):
File “C:\Users\elean\anaconda3\envs\dps_classifier_env\lib\site-packages\tensorflow\python\data\util\structure.py”, line 104, in normalize_element
spec = type_spec_from_value(t, use_fallback=False)
File “C:\Users\elean\anaconda3\envs\dps_classifier_env\lib\site-packages\tensorflow\python\data\util\structure.py”, line 507, in type_spec_from_value
raise TypeError(“Could not build a TypeSpec for {} with type {}“.format(
TypeError: Could not build a TypeSpec for (0, 0) 0.2448084672077168
(0, 1) -0.4212868767579319
(0, 2) -0.030373456741237377
(0, 3) -0.144803531037397
(0, 4) -0.21712709919583073
(0, 5) -0.03408696347500956
(0, 10) 1.0
(0, 30) 1.0
(0, 33) 1.0
(0, 45) 1.0
(0, 53) 1.0
(0, 63) 1.0
(0, 65) 1.0
(0, 105) 1.0
(1, 0) 0.9741834080594799
(1, 1) -0.13858642567965296
(1, 2) -1.5862207290595516
(1, 3) -0.144803531037397
(1, 4) -0.21712709919583073
(1, 5) -0.43759531782460204
(1, 12) 1.0
(1, 15) 1.0
(1, 33) 1.0
(1, 41) 1.0
(1, 53) 1.0
: :
(39071, 3) -0.144803531037397
(39071, 4) -0.21712709919583073
(39071, 5) -0.03408696347500956
(39071, 13) 1.0
(39071, 23) 1.0
(39071, 36) 1.0
(39071, 39) 1.0
(39071, 57) 1.0
(39071, 61) 1.0
(39071, 64) 1.0
(39071, 105) 1.0
(39072, 0) 1.484745866655714
(39072, 1) -0.12827421320480048
(39072, 2) 1.5254738155770768
(39072, 3) -0.144803531037397
(39072, 4) -0.21712709919583073
(39072, 5) -2.6972421021823196
(39072, 10) 1.0
(39072, 27) 1.0
(39072, 33) 1.0
(39072, 48) 1.0
(39072, 53) 1.0
(39072, 63) 1.0
(39072, 65) 1.0
(39072, 105) 1.0 with type csr_matrix
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “D:/TEACHING/Github/ual-dps-inclass/classifier/adult_classifier_nn.py”, line 89, in
train_dataset = tf.data.Dataset.from_tensor_slices((X_train, y_train)).batch(32)
File “C:\Users\elean\anaconda3\envs\dps_classifier_env\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py”, line 831, in from_tensor_slices
return from_tensor_slices_op._from_tensor_slices(tensors, name)
File “C:\Users\elean\anaconda3\envs\dps_classifier_env\lib\site-packages\tensorflow\python\data\ops\from_tensor_slices_op.py”, line 25, in _from_tensor_slices
return TensorSliceDataset(tensors, name=name)
File “C:\Users\elean\anaconda3\envs\dps_classifier_env\lib\site-packages\tensorflow\python\data\ops\from_tensor_slices_op.py”, line 33, in init
element = structure.normalize_element(element)
File “C:\Users\elean\anaconda3\envs\dps_classifier_env\lib\site-packages\tensorflow\python\data\util\structure.py”, line 109, in normalize_element
ops.convert_to_tensor(t, name=“component%d” % i))
File “C:\Users\elean\anaconda3\envs\dps_classifier_env\lib\site-packages\tensorflow\python\profiler\trace.py”, line 183, in wrapped
return func(*args, **kwargs)
File “C:\Users\elean\anaconda3\envs\dps_classifier_env\lib\site-packages\tensorflow\python\framework\ops.py”, line 1443, in convert_to_tensor
return tensor_conversion_registry.convert(
File “C:\Users\elean\anaconda3\envs\dps_classifier_env\lib\site-packages\tensorflow\python\framework\tensor_conversion_registry.py”, line 234, in convert
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File “C:\Users\elean\anaconda3\envs\dps_classifier_env\lib\site-packages\tensorflow\python\framework\constant_op.py”, line 324, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File “C:\Users\elean\anaconda3\envs\dps_classifier_env\lib\site-packages\tensorflow\python\framework\constant_op.py”, line 263, in constant
return _constant_impl(value, dtype, shape, name, verify_shape=False,
File “C:\Users\elean\anaconda3\envs\dps_classifier_env\lib\site-packages\tensorflow\python\framework\constant_op.py”, line 275, in _constant_impl
return _constant_eager_impl(ctx, value, dtype, shape, verify_shape)
File “C:\Users\elean\anaconda3\envs\dps_classifier_env\lib\site-packages\tensorflow\python\framework\constant_op.py”, line 285, in _constant_eager_impl
t = convert_to_eager_tensor(value, ctx, dtype)
File “C:\Users\elean\anaconda3\envs\dps_classifier_env\lib\site-packages\tensorflow\python\framework\constant_op.py”, line 98, in convert_to_eager_tensor
return ops.EagerTensor(value, ctx.device_name, dtype)
ValueError: TypeError: sparse matrix length is ambiguous; use getnnz() or shape[0]
Traceback (most recent call last):
File “C:\Users\elean\anaconda3\envs\dps_classifier_env\lib\site-packages\tensorflow\python\data\util\structure.py”, line 104, in normalize_element
spec = type_spec_from_value(t, use_fallback=False)
File “C:\Users\elean\anaconda3\envs\dps_classifier_env\lib\site-packages\tensorflow\python\data\util\structure.py”, line 507, in type_spec_from_value
raise TypeError(“Could not build a TypeSpec for {} with type {}“.format(
TypeError: Could not build a TypeSpec for (0, 0) 0.2448084672077168
(0, 1) -0.4212868767579319
(0, 2) -0.030373456741237377
(0, 3) -0.144803531037397
(0, 4) -0.21712709919583073
(0, 5) -0.03408696347500956
(0, 10) 1.0
(0, 30) 1.0
(0, 33) 1.0
(0, 45) 1.0
(0, 53) 1.0
(0, 63) 1.0
(0, 65) 1.0
(0, 105) 1.0
(1, 0) 0.9741834080594799
(1, 1) -0.13858642567965296
(1, 2) -1.5862207290595516
(1, 3) -0.144803531037397
(1, 4) -0.21712709919583073
(1, 5) -0.43759531782460204
(1, 12) 1.0
(1, 15) 1.0
(1, 33) 1.0
(1, 41) 1.0
(1, 53) 1.0
: :
(39071, 3) -0.144803531037397
(39071, 4) -0.21712709919583073
(39071, 5) -0.03408696347500956
(39071, 13) 1.0
(39071, 23) 1.0
(39071, 36) 1.0
(39071, 39) 1.0
(39071, 57) 1.0
(39071, 61) 1.0
(39071, 64) 1.0
(39071, 105) 1.0
(39072, 0) 1.484745866655714
(39072, 1) -0.12827421320480048
(39072, 2) 1.5254738155770768
(39072, 3) -0.144803531037397
(39072, 4) -0.21712709919583073
(39072, 5) -2.6972421021823196
(39072, 10) 1.0
(39072, 27) 1.0
(39072, 33) 1.0
(39072, 48) 1.0
(39072, 53) 1.0
(39072, 63) 1.0
(39072, 65) 1.0
(39072, 105) 1.0 with type csr_matrix
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “C:\Users\elean\anaconda3\envs\dps_classifier_env\lib\site-packages\scipy\sparse_base.py”, line 345, in len
raise TypeError(“sparse matrix length is ambiguous; use getnnz()”
TypeError: sparse matrix length is ambiguous; use getnnz() or shape[0]