liveBook · Manning

False negative

As explained in Natural Language Processing in Action, Second Edition

A false negative classification error occurs when a system fails to identify an instance that belongs to the target class.

A false negative is a missed positive: the system fails to identify an instance that belongs to the target class. In a chatbot, search engine, or classifier, the result looks like no match even though a human would recognize one. section 1.5.2 section 10.3.2

False negatives matter because they:

  • Reduce recall by omitting appropriate documents, classifications, or generated matches. section 10.3.2
  • Reveal overly strict matching, especially when wording, spelling, slang, or meaning differs from the expected pattern. section 1.5.2 section 10.3.2
  • Occur alongside false positives when a matching rule is simultaneously too exclusive and too inclusive. section 1.5.2

A greeting pattern misses a valid case

A regular expression matches “Good morning Rosa” but returns no match for “Good Manning Rosa.” If the latter represents a misspelled greeting that should be recognized, the failed match is a false negative. Refining the pattern can improve behavior, but hand-written rules remain vulnerable to slang and misspellings. section 1.5.2

>>> r = r"[^a-z]*([y]o|[h']?ello|ok|hey|(good[ ])(morn[gin']{0,3}|"
>>> r += r"afternoon|even[gin']{0,3}))[\s,;:]{1,3}([a-z]{1,20})"
>>> re_greeting = re.compile(r, flags=re.IGNORECASE)    #1
>>> re_greeting.match('Hello Rosa')
<re.Match object; span=(0, 10), match='Hello Rosa'>
>>> re_greeting.match('Hello Rosa').groups()
('Hello', None, None, 'Rosa')
>>> re_greeting.match("Good morning Rosa")
<re.Match object; span=(0, 17), match="Good morning Rosa">
>>> re_greeting.match("Good Manning Rosa")                  #2
>>> re_greeting.match('Good evening Rosa Parks').groups()    #3
('Good evening', 'Good ', 'evening', 'Rosa')
>>> re_greeting.match("Good Morn'n Rosa")
<re.Match object; span=(0, 16), match="Good Morn'n Rosa">
>>> re_greeting.match("yo Rosa")
<re.Match object; span=(0, 7), match='yo Rosa'>

Inspect the greeting pattern's contrasting matches: accepted greetings return match objects, while “Good Manning Rosa” returns no match. section 1.5.2

How Natural Language Processing in Action, Second Edition covers it

How deep it goes
Defines missed positives and connects them to recall, but stops short of a general metric formula or threshold procedure.
Examples
Uses greeting-pattern misses, a Manning typo, big-cat searches, and queries whose token order changes their meaning.
What you can do after
Diagnose missed matches by inspecting regex behavior and relating search omissions to recall.
How it connects
Connects false negatives with false positives, recall, regular expressions, semantic search, and classification.

Also explained in

Compare how 16 books explain false negative →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Natural Language Processing in Action, Second Edition. The section links point to the parts of the book it draws on.