# Natural Language Processing

**URL:** https://community.deeplearning.ai/c/course-q-a/natural-language-processing/37.md?page=1

[Latest](https://community.deeplearning.ai/latest.md) · [Categories](https://community.deeplearning.ai/categories.md) · [Tags](https://community.deeplearning.ai/tags.md)

**Page:** 2

---

## [C3W1 Assignment - perplexity](https://community.deeplearning.ai/t/c3w1-assignment-perplexity/883806)

<div class="topic-metadata">

**Author:** [@dsong99](https://community.deeplearning.ai/u/dsong99)\
**Replies:** 4\
**Last updated:** [November 23, 2025, 3:30am UTC](https://community.deeplearning.ai/t/c3w1-assignment-perplexity/883806 "2025-11-23T03:30:05Z")

</div>

I am having trouble in C3W1 Assignment - perplexity calculation. I passed unit test first 8 examples, but fail 9-th example. I see the preds dimension is 4 while tartget is 3: preds.shape (2, 1, 7, 3) target.shape (2, 7…

---

## [C3W3 Assignment: TripletLoss - Getting exactly half/quarter of expected values](https://community.deeplearning.ai/t/c3w3-assignment-tripletloss-getting-exactly-half-quarter-of-expected-values/883519)

<div class="topic-metadata">

**Author:** [@ziad\_agamy](https://community.deeplearning.ai/u/ziad_agamy)\
**Replies:** 1\
**Last updated:** [November 17, 2025, 3:42pm UTC](https://community.deeplearning.ai/t/c3w3-assignment-tripletloss-getting-exactly-half-quarter-of-expected-values/883519 "2025-11-17T15:42:09Z")

</div>

Hi everyone, I’m stuck on the TripletLoss implementation for C3W3 (Siamese Networks) My implementation follows the assignment exactly: \*\*codes removed as it is part of the grade function codes and which assess your su…

---

## [Natural Language Processing with Attention Models Error](https://community.deeplearning.ai/t/natural-language-processing-with-attention-models-error/883404)

<div class="topic-metadata">

**Author:** [@supehero001](https://community.deeplearning.ai/u/supehero001)\
**Replies:** 1\
**Last updated:** [November 15, 2025, 11:04am UTC](https://community.deeplearning.ai/t/natural-language-processing-with-attention-models-error/883404 "2025-11-15T11:04:45Z")

</div>

I’m practicing a lab on Coursera (NLP), but it’s not working. I waited for about 30 minutes, but nothing happened. Can you check and fix it?

---

## [Understanding Sentinels in C4W3\_Assignment](https://community.deeplearning.ai/t/understanding-sentinels-in-c4w3-assignment/883088)

<div class="topic-metadata">

**Author:** [@chartechaccountant](https://community.deeplearning.ai/u/chartechaccountant)\
**Replies:** 3\
**Last updated:** [November 11, 2025, 9:00pm UTC](https://community.deeplearning.ai/t/understanding-sentinels-in-c4w3-assignment/883088 "2025-11-11T21:00:39Z")

</div>

/notebooks/C4W3\_Assignment.ipynb From what I understand, sentinels are used in the decoder of the T5 as targets. They are like placeholders. Lets assume vocab size is 32,000. Lets assume I=2, Love =3, learning=4, and …

---

## [C3W1 - Confused with Embedding and Mean Layers](https://community.deeplearning.ai/t/c3w1-confused-with-embedding-and-mean-layers/882986)

<div class="topic-metadata">

**Author:** [@dsong99](https://community.deeplearning.ai/u/dsong99)\
**Replies:** 3\
**Last updated:** [November 10, 2025, 4:39am UTC](https://community.deeplearning.ai/t/c3w1-confused-with-embedding-and-mean-layers/882986 "2025-11-10T04:39:19Z")

</div>

I am confused with NLP C3W1 introduction, I don’t understand how embedding for each word has multiple dimensions and needs to take a mean on them (Per discussion on https://community.deeplearning.ai/t/trax-mean-layer/230…

---

## [Assignment 4 (UNQ\_C21) approximate\_knn - Inconsistent data type for new\_id (int vs. ndarray)](https://community.deeplearning.ai/t/assignment-4-unq-c21-approximate-knn-inconsistent-data-type-for-new-id-int-vs-ndarray/882735)

<div class="topic-metadata">

**Author:** [@Rares22](https://community.deeplearning.ai/u/Rares22)\
**Replies:** 4\
**Last updated:** [November 5, 2025, 8:41pm UTC](https://community.deeplearning.ai/t/assignment-4-unq-c21-approximate-knn-inconsistent-data-type-for-new-id-int-vs-ndarray/882735 "2025-11-05T20:41:43Z")

</div>

I’ve encountered an issue in the Week 4 assignment notebook within the approximate\_knn function (Cell 126, UNQ\_C21) that appears to stem from inconsistent test data. When running the test cell (Cell 128, UNQ\_C22), the a…

---

## [POS tagging: should words with capital letters be treated as lower case?](https://community.deeplearning.ai/t/pos-tagging-should-words-with-capital-letters-be-treated-as-lower-case/882572)

<div class="topic-metadata">

**Author:** [@Zhenwe](https://community.deeplearning.ai/u/Zhenwe)\
**Replies:** 1\
**Last updated:** [November 4, 2025, 5:51am UTC](https://community.deeplearning.ai/t/pos-tagging-should-words-with-capital-letters-be-treated-as-lower-case/882572 "2025-11-04T05:51:18Z")

</div>

We extracting the word list, we didn’t convert words into lower case. therefore the word ‘The’ is different from ‘the’. But shouldn’t they be treated as the same as "The“ and ‘the’ should probably have same POS tag?

---

## [Kamal Hinduja : What’s the role of embeddings in NLP models?](https://community.deeplearning.ai/t/kamal-hinduja-what-s-the-role-of-embeddings-in-nlp-models/882227)

<div class="topic-metadata">

**Author:** [@kamalhinduja](https://community.deeplearning.ai/u/kamalhinduja)\
**Replies:** 3\
**Last updated:** [December 4, 2025, 2:57pm UTC](https://community.deeplearning.ai/t/kamal-hinduja-what-s-the-role-of-embeddings-in-nlp-models/882227 "2025-12-04T14:57:54Z")

</div>

Hi, I am Kamal Hinduja based Geneva, Switzerland(Swiss). Can anyone explain What is the role of embeddings in NLP models? Thanks, Regards Kamal Hinduja Geneva, Switzerland

---

## [Running Labs and Assignments locally](https://community.deeplearning.ai/t/running-labs-and-assignments-locally/882192)

<div class="topic-metadata">

**Author:** [@Muhammad-Kalim-Ullah](https://community.deeplearning.ai/u/Muhammad-Kalim-Ullah)\
**Replies:** 8\
**Last updated:** [November 4, 2025, 11:08pm UTC](https://community.deeplearning.ai/t/running-labs-and-assignments-locally/882192 "2025-11-04T23:08:24Z")

</div>

Hi dl.ai team and learners, I completed several specialisations from deeplearning.ai more than 6 months ago, for which I earned certificates, but I cannot access their labs and assignments on the platform. While I had d…

---

## [C1\_W4\_ASSIGNMENT\_errors](https://community.deeplearning.ai/t/c1-w4-assignment-errors/881946)

<div class="topic-metadata">

**Author:** [@Mahek8](https://community.deeplearning.ai/u/Mahek8)\
**Replies:** 4\
**Last updated:** [October 23, 2025, 6:02am UTC](https://community.deeplearning.ai/t/c1-w4-assignment-errors/881946 "2025-10-23T06:02:45Z")

</div>

coursera is not letting me pass assignment 4 submitted the assignment got 81% edited it second time it doesn’t grade my assignment the cells doesnt run. shows this when the output is correct and all test are passed. …

---

## [Deleted the programming assignment workbook by mistake](https://community.deeplearning.ai/t/deleted-the-programming-assignment-workbook-by-mistake/881862)

<div class="topic-metadata">

**Author:** [@chartechaccountant](https://community.deeplearning.ai/u/chartechaccountant)\
**Replies:** 4\
**Last updated:** [October 21, 2025, 3:48pm UTC](https://community.deeplearning.ai/t/deleted-the-programming-assignment-workbook-by-mistake/881862 "2025-10-21T15:48:06Z")

</div>

When creating a post, please add: Week # must be added in the tags option of the post. Link to the classroom item you are referring to: Description (include relevant info but please do not post solution code or your en…

---

## [NLP C3\_W2: Section 4.3 Wrong values comparison](https://community.deeplearning.ai/t/nlp-c3-w2-section-4-3-wrong-values-comparison/881609)

<div class="topic-metadata">

**Author:** [@khteh](https://community.deeplearning.ai/u/khteh)\
**Replies:** 1\
**Last updated:** [October 17, 2025, 12:54pm UTC](https://community.deeplearning.ai/t/nlp-c3-w2-section-4-3-wrong-values-comparison/881609 "2025-10-17T12:54:03Z")

</div>

It should be np.allclose(pred\_x, pred\_x\_padded\[:,:3,:\])

---

## [\`log\_softmax\` in Dense layer + \`from\_logits=True\` in cross-entropy loss](https://community.deeplearning.ai/t/log-softmax-in-dense-layer-from-logits-true-in-cross-entropy-loss/881558)

<div class="topic-metadata">

**Author:** [@khteh](https://community.deeplearning.ai/u/khteh)\
**Replies:** 2\
**Last updated:** [October 16, 2025, 4:05pm UTC](https://community.deeplearning.ai/t/log-softmax-in-dense-layer-from-logits-true-in-cross-entropy-loss/881558 "2025-10-16T16:05:52Z")

</div>

I see NLP course uses for quite a number of times the combination of log\_softmax in the Dense layer with from\_logits=True in the cross-entropy loss function in order to have a stable computation of the softmax. How does …

---

## [NLP C4\_W1: Encoder output\_dim](https://community.deeplearning.ai/t/nlp-c4-w1-encoder-output-dim/881481)

<div class="topic-metadata">

**Author:** [@khteh](https://community.deeplearning.ai/u/khteh)\
**Replies:** 3\
**Last updated:** [October 16, 2025, 10:55am UTC](https://community.deeplearning.ai/t/nlp-c4-w1-encoder-output-dim/881481 "2025-10-16T10:55:14Z")

</div>

There is no mention about the output\_dim of Embedding layer in both Encoder and Decoder and I just randomly use the units parameter available at the constructor of the classes. Although it passes the Encoder unit tests, …

---

## [NLP C4\_W1: Decoder pre\_attention\_rnn input dimension mismatch with embeddings output x](https://community.deeplearning.ai/t/nlp-c4-w1-decoder-pre-attention-rnn-input-dimension-mismatch-with-embeddings-output-x/881480)

<div class="topic-metadata">

**Author:** [@khteh](https://community.deeplearning.ai/u/khteh)\
**Replies:** 5\
**Last updated:** [October 16, 2025, 12:31pm UTC](https://community.deeplearning.ai/t/nlp-c4-w1-decoder-pre-attention-rnn-input-dimension-mismatch-with-embeddings-output-x/881480 "2025-10-16T12:31:28Z")

</div>

The embedding layer output has dimension 4 but pre\_attention\_rnn expects 3: What do I miss?

---

## [NLP C4\_W1: Embedding mask\_zero=True but the input\_dim in unittest is wrong?](https://community.deeplearning.ai/t/nlp-c4-w1-embedding-mask-zero-true-but-the-input-dim-in-unittest-is-wrong/881477)

<div class="topic-metadata">

**Author:** [@khteh](https://community.deeplearning.ai/u/khteh)\
**Replies:** 8\
**Last updated:** [October 16, 2025, 12:33pm UTC](https://community.deeplearning.ai/t/nlp-c4-w1-embedding-mask-zero-true-but-the-input-dim-in-unittest-is-wrong/881477 "2025-10-16T12:33:03Z")

</div>

Exercise 1 text mentions using ‘0’ as padding and therefore mask\_zero should be set to True and according to https://www.tensorflow.org/api\_docs/python/tf/keras/layers/Embedding the input\_dim should be vocab\_size + 1. Ho…

---

## [NLP C3\_W3: classify() hits shape error by the grader](https://community.deeplearning.ai/t/nlp-c3-w3-classify-hits-shape-error-by-the-grader/881461)

<div class="topic-metadata">

**Author:** [@khteh](https://community.deeplearning.ai/u/khteh)\
**Replies:** 7\
**Last updated:** [October 16, 2025, 12:29pm UTC](https://community.deeplearning.ai/t/nlp-c3-w3-classify-hits-shape-error-by-the-grader/881461 "2025-10-16T12:29:55Z")

</div>

The classify() function in the assignment notebook of this course has the following snippet of code: \_, n\_feat = ?? What’s that and how to make use of it? I comment it out and it passes w3\_unittest.test\_classify(classi…

---

## [NLP C3\_W2: model.fit crashes](https://community.deeplearning.ai/t/nlp-c3-w2-model-fit-crashes/881399)

<div class="topic-metadata">

**Author:** [@khteh](https://community.deeplearning.ai/u/khteh)\
**Replies:** 4\
**Last updated:** [October 15, 2025, 3:28am UTC](https://community.deeplearning.ai/t/nlp-c3-w2-model-fit-crashes/881399 "2025-10-15T03:28:11Z")

</div>

model.fit(train\_dataset.batch(BATCH\_SIZE), validation\_data = val\_dataset.batch(BATCH\_SIZE), shuffle=True, epochs = 2) crashes. restarting the kernel doesn’t help.

---

## [NLP C2\_W4: Backpropagation formula notation](https://community.deeplearning.ai/t/nlp-c2-w4-backpropagation-formula-notation/881291)

<div class="topic-metadata">

**Author:** [@khteh](https://community.deeplearning.ai/u/khteh)\
**Replies:** 2\
**Last updated:** [October 14, 2025, 5:40am UTC](https://community.deeplearning.ai/t/nlp-c2-w4-backpropagation-formula-notation/881291 "2025-10-14T05:40:44Z")

</div>

I am trying to understand what does the notation of .step(Z1) mean in the backpropagation calculation of partial derivatives of W1 and b1. It’s not explained in the video, the .pdf file as well as in the assignment noteb…

---

## [NLP C2\_W3: \`test\_calculate\_perplexity\` fails although it seems very straight-forward and simple implementation](https://community.deeplearning.ai/t/nlp-c2-w3-test-calculate-perplexity-fails-although-it-seems-very-straight-forward-and-simple-implementation/881283)

<div class="topic-metadata">

**Author:** [@khteh](https://community.deeplearning.ai/u/khteh)\
**Replies:** 9\
**Last updated:** [October 14, 2025, 2:59am UTC](https://community.deeplearning.ai/t/nlp-c2-w3-test-calculate-perplexity-fails-although-it-seems-very-straight-forward-and-simple-implementation/881283 "2025-10-14T02:59:06Z")

</div>

def calculate\_perplexity(sentence, n\_gram\_counts, n\_plus1\_gram\_counts, vocabulary\_size, start\_token='\<s\>', end\_token = '\<e\>', k=1.0): seems simple and straight-forward. However, unit tests fail… Any idea what I might be …

---

## [NLP C2\_W2: Part-of-Speech tagging compute\_accuracy misses by 0.0003](https://community.deeplearning.ai/t/nlp-c2-w2-part-of-speech-tagging-compute-accuracy-misses-by-0-0003/881225)

<div class="topic-metadata">

**Author:** [@khteh](https://community.deeplearning.ai/u/khteh)\
**Replies:** 2\
**Last updated:** [October 12, 2025, 12:04pm UTC](https://community.deeplearning.ai/t/nlp-c2-w2-part-of-speech-tagging-compute-accuracy-misses-by-0-0003/881225 "2025-10-12T12:04:13Z")

</div>

The final compute\_accuracy in NLP Part-of-Speech tagging assignment misses by 0.0003. Still pass the course but not 100%. First time encountering this… puzzled. Any thought on this?

---

## [C2\_W1\_Assigment. Autocorrect ! The input './data/shakespeare.txt' is empty](https://community.deeplearning.ai/t/c2-w1-assigment-autocorrect-the-input-data-shakespeare-txt-is-empty/879919)

<div class="topic-metadata">

**Author:** [@soumen2025](https://community.deeplearning.ai/u/soumen2025)\
**Replies:** 18\
**Last updated:** [September 25, 2025, 10:30am UTC](https://community.deeplearning.ai/t/c2-w1-assigment-autocorrect-the-input-data-shakespeare-txt-is-empty/879919 "2025-09-25T10:30:32Z")

</div>

the input of the function process\_data(file\_name) ‘./data/shakespeare.txt’ is empty. so output is empty list. I downloaded the file and opened it to confirm that it is empty. Can anyone help me here please?

---

## [Error in week 3](https://community.deeplearning.ai/t/error-in-week-3/879635)

<div class="topic-metadata">

**Author:** [@Joselyne16](https://community.deeplearning.ai/u/Joselyne16)\
**Replies:** 3\
**Last updated:** [September 19, 2025, 2:37pm UTC](https://community.deeplearning.ai/t/error-in-week-3/879635 "2025-09-19T14:37:47Z")

</div>

does someone can help me whith this error?

---

## [Edit minimum distance replace cost](https://community.deeplearning.ai/t/edit-minimum-distance-replace-cost/879339)

<div class="topic-metadata">

**Author:** [@dsong99](https://community.deeplearning.ai/u/dsong99)\
**Replies:** 1\
**Last updated:** [September 15, 2025, 5:55am UTC](https://community.deeplearning.ai/t/edit-minimum-distance-replace-cost/879339 "2025-09-15T05:55:32Z")

</div>

I have a question on the replace cost of Minimum edit distance, in NLP course 2, it says the replace cost is 2, which needs 1 delete and 1 insert. My understanding is replace cost should be 1, many materials on the inter…

---

## [Problems with the rating of the first submission C2W1](https://community.deeplearning.ai/t/problems-with-the-rating-of-the-first-submission-c2w1/878652)

<div class="topic-metadata">

**Author:** [@Ely0203](https://community.deeplearning.ai/u/Ely0203)\
**Replies:** 6\
**Last updated:** [September 8, 2025, 5:32am UTC](https://community.deeplearning.ai/t/problems-with-the-rating-of-the-first-submission-c2w1/878652 "2025-09-08T05:32:33Z")

</div>

I’m taking this course on Coursera and I’m very interested in the entire specialization.I’ve duly reported them, but I haven’t received any feedback or anything. It doesn’t make sense to me to continue because it’s very …

---

## [NLP C2W3 EX10 Perplexity Tests](https://community.deeplearning.ai/t/nlp-c2w3-ex10-perplexity-tests/877959)

<div class="topic-metadata">

**Author:** [@smirkmkd](https://community.deeplearning.ai/u/smirkmkd)\
**Replies:** 2\
**Last updated:** [August 29, 2025, 7:43pm UTC](https://community.deeplearning.ai/t/nlp-c2w3-ex10-perplexity-tests/877959 "2025-08-29T19:43:29Z")

</div>

I have read all the previous topics opened regarding this exercise and I couldn’t find a similar one to my case. My solution gives the correct perplexity for the training data Perplexity for first train sample: 2.8040 …

---

## [NLP C3W1 Assignment about log perplexity](https://community.deeplearning.ai/t/nlp-c3w1-assignment-about-log-perplexity/870190)

<div class="topic-metadata">

**Author:** [@mejiroalbon](https://community.deeplearning.ai/u/mejiroalbon)\
**Replies:** 1\
**Last updated:** [August 10, 2025, 4:32am UTC](https://community.deeplearning.ai/t/nlp-c3w1-assignment-about-log-perplexity/870190 "2025-08-10T04:32:52Z")

</div>

Function failed in example 1. Review the axis variable you are passing. It must be set to the last axis, but must be generalizable. What is the index that represents the last axis in general? The testing code block gave…

---

## [Why modify each value of the diagonal of the matrix in lab-2](https://community.deeplearning.ai/t/why-modify-each-value-of-the-diagonal-of-the-matrix-in-lab-2/870133)

<div class="topic-metadata">

**Author:** [@dugujian1984](https://community.deeplearning.ai/u/dugujian1984)\
**Replies:** 3\
**Last updated:** [August 16, 2025, 5:05pm UTC](https://community.deeplearning.ai/t/why-modify-each-value-of-the-diagonal-of-the-matrix-in-lab-2/870133 "2025-08-16T17:05:17Z")

</div>

For C2W2-lab2(Parts-of-Speech Tagging - Working with tags and Numpy), it mentions at the last part that “For a final example you are asked to modify each value of the diagonal of the matrix so that they are equal to the l…

---

## [C2W4 Assignment gradient\_descent](https://community.deeplearning.ai/t/c2w4-assignment-gradient-descent/869732)

<div class="topic-metadata">

**Author:** [@mejiroalbon](https://community.deeplearning.ai/u/mejiroalbon)\
**Replies:** 5\
**Last updated:** [August 10, 2025, 3:47am UTC](https://community.deeplearning.ai/t/c2w4-assignment-gradient-descent/869732 "2025-08-10T03:47:04Z")

</div>

Hello. When testing the last gradient\_descent function, I found my returning values like this: Call gradient\_descent iters: 10 cost: 10.868077 iters: 20 cost: 12.380256 iters: 30 cost: 27.418218 iters: 40 cost: 66.0…

---

## [Question on PCA](https://community.deeplearning.ai/t/question-on-pca/869691)

<div class="topic-metadata">

**Author:** [@dugujian1984](https://community.deeplearning.ai/u/dugujian1984)\
**Replies:** 2\
**Last updated:** [August 9, 2025, 2:56am UTC](https://community.deeplearning.ai/t/question-on-pca/869691 "2025-08-09T02:56:31Z")

</div>

For the PCA lab, the last piece of code (below). It says this is the original data and the projection using axes as principal components. Shouldn’t it be the projection on the original axes? If we want to the projection …

[Previous page](https://community.deeplearning.ai/c/course-q-a/natural-language-processing/37.md)

[Next page](https://community.deeplearning.ai/c/course-q-a/natural-language-processing/37.md?page=2)
