I am using Tensorflow version 2.9.1. In running a NN training program I get an error class_weight
is only supported for Models with a single output. I noticed online that this is due to a bug in tensorflow. Has this been corrected?
The code:
{NN code} self._adv.fit(x.values, np.hsplit(z.values, z.shape[1]), class_weight=class_weight_adv, epochs=epochs, verbose=verbose)
Error:
Traceback (most recent call last):
File “C:\Users\Sayan Ray\PycharmProjects\pythonProject1\venv\lib\site-packages\IPython\core\interactiveshell.py”, line 3398, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File “”, line 142, in <cell line: 142>
clf.pretrain(X_train, y_train, Z_train, verbose=0, epochs=5)
File “”, line 95, in pretrain
self._adv.fit(x.values, np.hsplit(z.values, z.shape[1]), class_weight=class_weight_adv,
File “C:\Users\Sayan Ray\PycharmProjects\pythonProject1\venv\lib\site-packages\keras\utils\traceback_utils.py”, line 67, in error_handler
raise e.with_traceback(filtered_tb) from None
File “C:\Users\Sayan Ray\PycharmProjects\pythonProject1\venv\lib\site-packages\keras\engine\data_adapter.py”, line 1434, in _class_weights_map_fn
raise ValueError(
ValueError: class_weight
is only supported for Models with a single output.