I am Menelaos Gkikas from Greece. I faced 1 last problem in Week’s 3 assignment and that is the last exercise where we are quested to program the neural network with kernel regularization and then compile it with Adam.
Even though pieces from class materials were very exact, here the model is entitled None - how can that happen with a model? - and when I simply type what I know there’s the error message invalid syntax.
I have also attached a screenshot. Should the lambda after the regularization be typed “l” or “L”?
I would appreciate a response from someone who knows the problem.
syntaxError usually associated with mismatch of brackets, so you need to check the line of code just before the pointing arrow marked here.
After you have amended the error, do remember to rerun the code from start. It is always helpful to do a clean run by clicking the kernel tab at the top of the menu bar, and select ‘Restart & Clear all output’ from the dropdown menu.
I just tried to reposition the position of brackets and nothing happens.
I have attached the code, you will probably delete it cos it’s part of the solution, but please tell me what’s wrong for I run similar pieces earlier in this lab and it was OK.
As I wait for your reply, I have to say I am a decent and reliable student, but should I pose this question at ChatGPT to find out where we might both be mistaken?
I figured out the solution. In demand for the alchemist…!
I have to report advices were somewhat misleading.
Putting the case in ChatGPT, it states, wrongly put by all sample codes inspired by the mentor - that since there is kernel we need double parentheses and not aligning the brackets. There have been many more examples not aligned and still function. Finally, the next parentheses are put next to None and not below.
The corrected commands are portrayed in the screenshot.
Now in terms of the keras website, the docs there and the advice, these are some on the inexplicable mysteries of life…! English poetry!
It is good that you have resolved the issue on your own power. I am not checking message constantly, so there are times I do not see your message until I log on to the system again.
The regularizers.l2() is a API function call, that is why there has to be a (). the same with, tf.keras.layers.Dense(). But in your original code, the call to rf.keras.layers.Dense has only the open bracket, without the closing bracket. That is what trigger the syntax error.
The link to the reference doc is to show various options on what the sequential model looks like. If your dense layer involves call to the regularizer, then you have to go further into the doc.
Brackets is the general term. I used that term ‘brackets’ in my earlier reply as we only have the ‘syntaxError’ message to work on without seeing your actual code.