Exercice 3 and exercice 4

Hi all first really many tx to all the participants in this forum who helped me fix issues and bugs myself so far . i m following those courses as part time/ evening interest and i m close to new to python overall.(with more C++/C experience and …yes python is amazing :slight_smile:

I managed to pass exercise 3 in NLP C3 w3 after trying a vocab_size = len(train_dataset) , tbh i really dont get why this worked …any hint would be highly appreciated.

right now im stuck in ex 4 ,could you kindly help provide advice .
i allocated pred[:,0] and pred [:,1] after using pred = model.predict(test_gen).
i m not convinced …

could i send my code to some of you to have a look ?

many thanks !

Hi @Chrisldn

You may passed the tests but it’s definitely wrong. Tests are not perfect and they do not catch all mistakes as it happened in this case. You will have problems down the road if you don’t fix this.

To get the vocab size you should use the parameter text_vectorizer: trained instance of TextVecotrization. This instance has a method called vocabulary_size() which “Gets the current size of the layer’s vocabulary.”

As for first part of Exercise 4 (which you are struggling with), remember what the model’s last layer does:
image
it concatenates the outputs.

So when you call model.predict(*) you get the concatenated output which you now need to split back into v1 and v2.

For how to do that, you have a clear hint with similar (but with different variable names) example right before Part 3:
image
This hint has a somewhat misleading name embedding_size which in my opinion should have been different (out_size, or n_feat as in your exercise). But in essence is what you’re looking for.

Cheers

Hi many thanks fro your help !
I spent another few hours and looked at exercise 5 and went back to 4.
I managed to pass all now and will move to the next course .
thanks for taking the time to respond !