C4W1 - Assignment 2 CNN appln Sequential API

Unable to figure out syntax error. I have finished up C1 to C3 and nowhere I came across this extensive use of Keras for CNN. So looking for someone to point out the rookie mistake

image

That means there is something missing on the previous line. Normally it would be a missing close paren, but here you are defining a list of layers. In a python list, the elements are delimited by commas, right? So did you include a comma after the previous layer entry?

Note that in the next part of this assignment you’ll be using the Functional API, so you definitely don’t want the commas between lines in that case.

They don’t give a very thorough introduction of Keras in the normal course materials. Here’s a thread that explains more about the Sequential and Functional APIs.

Forgot to mention, I am new to Python as well :grinning:. It was a missing comma (Rookie mistake). Wrote the keras correctly just forgot to add commas. Thank you!

Glad that the answer was easy. Note that these courses are not structured as beginning python programming courses. You need to have pretty solid competence in python as a “pre-existing condition” to succeed here. If you have a lot of experience in other languages, you can probably “wing it” and pick up what you need on the fly. But if this is your first real exposure to programming, it would be worth considering taking an “intro to python” course first.

1 Like

Note that you only need a comma in this exercise because the Sequential model is a list object. The elements of a list have to be separated by commas and enclosed in square brackets.

For most of the other assignments, including an extra comma will cause a syntax error - not fix one.

1 Like

Yes, I have experience in programming mainly in MATLAB so I am learning Pyth-on the fly. I finished up C1 to C3 in 1 week or so, basic prog stuff just got overwhelmed with Keras I guess plus I was tired EOD so…
appreciate the swift replies!

noted, thank you! Damn this post needs 20 charac min so typing it out lol

I agree that the 20 character limit seems a bit arbitrary. As in this case, there are some times when there is something meaningful that can be said in fewer characters. So I guess they are trying to push us just to use the “Like” button in that case?

looks like so – the one programmed it might be someone who despises “small talk” :smile:plus I get notifications like “earned first like” etc. some kind of reward system.

Thank you != like