In the Predictions code for neural network I am getting an error for the following code:
pred = model.predict_classes(test_scale)
pred
AttributeError Traceback (most recent call last)
Input In [78], in <cell line: 1>()
----> 1 pred = model.predict_classes(test_scale)
2 pred
AttributeError: 'Sequential' object has no attribute 'predict_classes'
I tried replacing the first line of code with
pred = model.predict(test_scale)
but then I get the following error:
ValueError Traceback (most recent call last)
Input In [79], in <cell line: 1>()
----> 1 pred = model.predict(test_scale)
2 pred
File ~\anaconda3\lib\site-packages\keras\utils\traceback_utils.py:70, in filter_traceback..error_handler(*args, **kwargs)
67 filtered_tb = _process_traceback_frames(e.traceback)
68 # To get the full stack trace, call:
69 # tf.debugging.disable_traceback_filtering()
---> 70 raise e.with_traceback(filtered_tb) from None
71 finally:
72 del filtered_tb
File ~\AppData\Local\Temp_autograph_generated_filew1kbawns.py:15, in outer_factory..inner_factory..tf__predict_function(iterator)
13 try:
14 do_return = True
---> 15 retval = ag__.converted_call(ag__.ld(step_function), (ag__.ld(self), ag__.ld(iterator)), None, fscope)
16 except:
17 do_return = False
ValueError: in user code:
File "C:\Users\Aditi\anaconda3\lib\site-packages\keras\engine\training.py", line 2041, in predict_function *
return step_function(self, iterator)
File "C:\Users\Aditi\anaconda3\lib\site-packages\keras\engine\training.py", line 2027, in step_function **
outputs = model.distribute_strategy.run(run_step, args=(data,))
File "C:\Users\Aditi\anaconda3\lib\site-packages\keras\engine\training.py", line 2015, in run_step **
outputs = model.predict_step(data)
File "C:\Users\Aditi\anaconda3\lib\site-packages\keras\engine\training.py", line 1983, in predict_step
return self(x, training=False)
File "C:\Users\Aditi\anaconda3\lib\site-packages\keras\utils\traceback_utils.py", line 70, in error_handler
raise e.with_traceback(filtered_tb) from None
File "C:\Users\Aditi\anaconda3\lib\site-packages\keras\engine\input_spec.py", line 295, in assert_input_compatibility
raise ValueError(
ValueError: Input 0 of layer "sequential" is incompatible with the layer: expected shape=(None, 254750, 20), found shape=(None, 20)
Please help me
In the Predictions code for neural network I am getting an error for the following code:
pred = model.predict_classes(test_scale)
pred
AttributeError Traceback (most recent call last)
Input In [78], in <cell line: 1>()
----> 1 pred = model.predict_classes(test_scale)
2 pred
AttributeError: 'Sequential' object has no attribute 'predict_classes'
I tried replacing the first line of code with
pred = model.predict(test_scale)
but then I get the following error:
ValueError Traceback (most recent call last)
Input In [79], in <cell line: 1>()
----> 1 pred = model.predict(test_scale)
2 pred
File ~\anaconda3\lib\site-packages\keras\utils\traceback_utils.py:70, in filter_traceback..error_handler(*args, **kwargs)
67 filtered_tb = _process_traceback_frames(e.traceback)
68 # To get the full stack trace, call:
69 #
tf.debugging.disable_traceback_filtering()---> 70 raise e.with_traceback(filtered_tb) from None
71 finally:
72 del filtered_tb
File ~\AppData\Local\Temp_autograph_generated_filew1kbawns.py:15, in outer_factory..inner_factory..tf__predict_function(iterator)
13 try:
14 do_return = True
---> 15 retval = ag__.converted_call(ag__.ld(step_function), (ag__.ld(self), ag__.ld(iterator)), None, fscope)
16 except:
17 do_return = False
ValueError: in user code:
Please help me