Hi,
There are some inconsistencies in the notebook by the ‘Expected Output’.
After creating the train and validation datasets, the expected output is stated as
Images of train generator have shape: (None, 28, 28)
But it should have been:
Images of train generator have shape: (None, 28, 28, 1)
The dataset has 24 classes as is also mentioned in the notebook. Now, add an output layer with 24 units, it would pass one unit-test and fail another unit-test. If you change it to 26 units, it would fail the first unit-test and pass the second unit-test.
The only solution is a certain loss function, but there is no hint for that. It was not mentioned at all. The whole story with 24 or 26 classes is really confusing. It would be nice to somehow clarify it. I have to add that fitting the model works just fine with either of cases (24 classes+loss function1 or 26 classes+loss function2) and you would reach the same level of accuracy.
Thanks for bringing this up. The staff have been informed to fix this assignment. Please set the number of neurons in the output layer to the number expected by the grader for now.
The American Sign Language letter database of hand gestures represent a multi-class problem with 24 classes of letters (excluding J and Z which require motion).
The original dataset has a different mapping since J is missing. On the other hand, the dataset prepared for this assignment doesn’t have any blank folders. Since this could lead to some confusion, do wait for the staff to address your concern.
(i) first coding and running the whole notebook cnsidering a 24-classes problems,
*it allowed me to compile, fit and plot train and validation accuracy,
*returned errors on unittests which require a (none, 26) output
(ii) then modify the create model function for a 26-classes problem ,
*it didn’t help getting the grades, here is a sceenshot
After getting your grade, you see two items (as shown in your figure, too): train_val_datasets and create_model. Click on them to see why the grader was not happy with your solution.
As balaji suggested, use 26 as your output layer size. In order to pass the unittests, see ungraded lab that balaji mentioned. There you will fine a clue about the loss function.
I hope you will find the solution and pass the test.
Thanks very much for your help
If it is allowed, I think explaining how and why that works would be beneficial (something close to braodcasting by keras?), even though maybe a bit beyond the scope of this particular assignment
can you click on the two grade cell mentioned in your grader output, so it shows why you failed the grader. it provides information on why you didn’t clear the grader, so we can know where codes must have gone wrong @gtvid
Also because the course was recently updated so to know you are not which version, can you share screenshot of the grade cell codes by personal DM. Please don’t post codes here.
Actually the code would work just fine with the other loss function and the model would be trained. But for some reason the unittest expect to have this particular loss function.
The model gets trained just fine when the data label is ‘categorical’ and ‘cat…cross’ loss is used, but only if you use the precise number of output units in the model with regards to actual classes.
However, the other setup, with data label ‘int’ and the sparse loss function works even with more units in the output layer than actual classes. Trying to figure out why
Here is the screen the grader failed. The main reason is that the test data generation is incorrect. Each label data is a one-hot vector of 26 elements while the grader generates an integer in the range [0, 26]. (see unittests.py line 186)
In fact, the grader still has many bugs. When I fixed this bug, another test case appeared that required the loss function to be ‘spar…cat’ while in reality the loss function used to fit the model was ‘cat…’.
Another problem is the ambiguity between the data having only 24 classes but the grader in the next test cases requires output shape=(None, 26) (see unittests.py line 202)
@Community-Team I have seen a similar learner experience elsewhere recently. Seems like notebook code, in-notebook unit tests, and grader are maybe not sufficiently regression tested to ensure consistency before code changes are released. Perhaps unified regression testing could surface these self-inflicted issues, as well as code broken by third party python/tensorflow/keras etc package revisions that are not backwards compatible.
issue resolved as per staff. You will get the updated lab when you launch the lab. They you can copy your previous solution to the new one before submitting.