0

I'm a beginner in python. I'm not able to understand what the problem is?

I tried this syntax

Malware_model.fit(X_train, y_train, validation_data = (X_test, y_test), epochs=10,  class_weight=class_weights)

The error I'm getting is:

ValueError                                Traceback (most recent call last)
<ipython-input-114-d1528325f5ea> in <module>
----> 1 Malware_model.fit(X_train, y_train, validation_data = (X_test, y_test), epochs=10,  class_weight=class_weights)

1 frames
/usr/local/lib/python3.8/dist-packages/keras/engine/data_adapter.py in _configure_dataset_and_inferred_steps(***failed resolving arguments***)
   1177     del x
   1178     dataset = self._adapter.get_dataset()
-> 1179     if class_weight:
   1180       dataset = dataset.map(_make_class_weight_map_fn(class_weight))
   1181     self._inferred_steps = self._infer_steps(steps_per_epoch, dataset)

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
  • I think your y_train or y_test data returns an array not boolean single value. You check the train and test data and look at similar error solutions like this: https://stackoverflow.com/questions/10062954/valueerror-the-truth-value-of-an-array-with-more-than-one-element-is-ambiguous – uozcan12 Dec 09 '22 at 11:01

0 Answers0