Challenge - 5 Problems
NER spaCy Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of Named Entity Recognition with spaCy
What is the output of the following code snippet that uses spaCy to detect named entities in a sentence?
NLP
import spacy nlp = spacy.load('en_core_web_sm') doc = nlp('Apple is looking at buying U.K. startup for $1 billion') entities = [(ent.text, ent.label_) for ent in doc.ents] print(entities)
Attempts:
2 left
💡 Hint
Look at common entity labels spaCy uses for organizations, geopolitical entities, and money.
✗ Incorrect
spaCy labels 'Apple' as an organization (ORG), 'U.K.' as a geopolitical entity (GPE), and '$1 billion' as money (MONEY).
❓ Model Choice
intermediate1:30remaining
Choosing the Correct spaCy Model for NER
Which spaCy model is best suited for performing Named Entity Recognition on English text with a balance of speed and accuracy?
Attempts:
2 left
💡 Hint
Consider models that include trained pipelines for NER and balance size and speed.
✗ Incorrect
en_core_web_md provides a good balance of speed and accuracy with medium-sized vectors and trained NER pipeline.
❓ Hyperparameter
advanced2:00remaining
Effect of Batch Size in spaCy NER Training
During training a spaCy NER model, what is the effect of increasing the batch size parameter?
Attempts:
2 left
💡 Hint
Think about how batch size affects gradient updates and training speed.
✗ Incorrect
Larger batch sizes process more examples before updating weights, speeding training but possibly reducing accuracy due to less frequent updates.
❓ Metrics
advanced1:30remaining
Evaluating spaCy NER Model Performance
Which metric is most appropriate to evaluate the quality of a spaCy Named Entity Recognition model on a test dataset?
Attempts:
2 left
💡 Hint
NER is a sequence labeling task with imbalanced classes; consider precision and recall.
✗ Incorrect
F1-score balances precision and recall, making it ideal for evaluating NER models where both false positives and false negatives matter.
🔧 Debug
expert2:30remaining
Debugging spaCy NER Model Training Error
You run spaCy NER training code but get this error: 'ValueError: [E088] The component 'ner' is not initialized. Call 'nlp.begin_training()' first.' Which code snippet fixes this error?
Attempts:
2 left
💡 Hint
The error means the 'ner' component is missing or not initialized properly.
✗ Incorrect
When creating a blank model, you must add the 'ner' pipe before calling begin_training(). Option B does this correctly.