Everything was fine until I submit the assignment.
‘data_size’ was defined previously and passed to “train_minist” as a parameter.
Everything was fine until I submit the assignment.
ok, but the error message says data_shape
. Is that really the issue, or just a mistype here in the forum?
you should check to see whether data_shape
has a global context in your notebook that allows you to use it inside a function, when what you should be doing is using a parameter that was passed in. here’s what I mean…
data_shape = #some shape
#graded function
def my_func(shape_to_use_in_graded_function):
print(data_shape)
that code will run in a notebook, but fail the grader. the reason is that the grader is loading the notebook cell for the graded function in an isolated context so the previous definition of data_shape
is not available. does this make sense?
Sorry for mistype’data_shape’ as ‘data_size’; ‘data_shape’ is what I mean.
I understand that global varible is not available while grading,so I rewrite my code:
So that nothing global will be passed in,but the problem is still there.
The only suspicious part where might cause the problem is:
I took this class a very long time ago and don’t have access to a current version, but in my old code the function looks like this:
def train_mnist():
...
NOTE: no parameters
if you added parameters yourself, regardless of what you name them, that will cause problems with the grader. If what you show in the fragment above is really how the graded function code template looks now, then one of the ‘real’ mentors will have to step in.
i also note that you are using the string ‘accuracy’ as the key lookup in the logs. as a general rule, it is safest to match what you use there as the key with what was used when the metrics were initially defined. that is, if you used
model.compile(...
metrics=['acc'])
then use ‘acc’ in the Callback function, too. It turns out that ‘acc’ and ‘accuracy’ are synonyms and should be interchangeable in some situations, but in others it causes issues. safest to keep them symmetric. HTH
Seems like the default notebooks are posted on github now, so I took a quick look. The method signature does include the x_train
and y_train
parameters, so that problem goes away. Wondering now if you have something stale being submitted? Try forcing a save and checkpoint, then restart the kernel, then submit. If that doesn’t solve the issue, then I’m out of ideas. Sorry.
@ai_curious I really appreciate the way you try to solve and majorly solve problems of majority of learners without being an actual mentor. You should really apply for one sir.
The explanations you give are really great and useful.
@Jeavan can you share the code you are submitting for grading so that I can have a look at it and also push the issue to the team if it is a glitch in the grader.
Thanks for your support
I am sorry that I didn’t see the reply!Probelm is solved now.It turned out that it did arose from external parameters.I can’t thank enough for your warmhearted and pacient reply!I don’t know who you are but I do wish you to be happy and blessed in your real life!
(I never met such an active and warm community before )
All thanks to @ai_curious
I too really appreciate and respect the efforts put by @ai_curious to reply to almost all the issues so aptly and accurately
Great work buddy!