Traceback (most recent call last)
Input In [34], in <cell line: 1>()
1 with tf.device(device):
----> 2 history = model.fit(
3 x_train[:100, :1], y_train[:100, :1],
4 validation_data = (x_val[:100, :1], y_val[:100]),
5 callbacks=[monitor, lr_schedule],
6 verbose=1,
7 epochs=10000,
8 batch_size=16,
9 shuffle=False,
10 class_weight={
11 0: y_train.mean(),
12 1: 1 - y_train.mean(),
13 }
14 )
File ~\Anaconda3\lib\site-packages\keras\utils\traceback_utils.py:67, in filter_traceback.<locals>.error_handler(*args, **kwargs)
65 except Exception as e: # pylint: disable=broad-except
66 filtered_tb = _process_traceback_frames(e.__traceback__)
---> 67 raise e.with_traceback(filtered_tb) from None
68 finally:
69 del filtered_tb
File ~\Anaconda3\lib\site-packages\keras\engine\training.py:3160, in Model._assert_compile_was_called(self)
3154 def _assert_compile_was_called(self):
3155 # Checks whether compile has been called. If it has been called,
3156 # then the optimizer is set. This is different from whether the
3157 # model is compiled
3158 # (i.e. whether the model is built and its inputs/outputs are set).
3159 if not self._is_compiled:
-> 3160 raise RuntimeError('You must compile your model before '
3161 'training/testing. '
3162 'Use model.compile(optimizer, loss).')
RuntimeError: You must compile your model before training/testing. Use model.compile(optimizer, loss).
You must compile your model before training/testing. Use model.compile(optimizer, loss).
Обсуждают сегодня