liveBook · Manning

Derivative

As explained in Advanced Algorithms and Data Structures

A derivative measures the instantaneous rate at which a function changes with respect to its input.

A derivative measures how a function changes as its input changes. In Bloom-filter design, derivatives help find the global minimum of the false-positive-rate function by optimizing k, the number of hash functions. section 4.10.1

Use derivatives to optimize the Bloom-filter parameter k:

  • Treat the number of elements n and available storage m as constants. section 4.10.1
  • Rewrite the false-positive function with logarithms and exponentiation to obtain an easier function g. section 4.10.1
  • Set the first derivative of g(k) to zero, producing k = ln(2)m/n. section 4.10.1
  • Use a second-order derivative check, round k to an integer, and weigh accuracy against insertion and lookup performance. section 4.10.1

Choosing the number of hash functions

Given fixed storage and an expected number of elements, differentiate the transformed false-positive function, solve for the stationary value of k, then round it and possibly choose a slightly smaller value to reduce computation. section 4.10.1

How Advanced Algorithms and Data Structures covers it

How deep it goes
Develops first- and second-order derivative use, but skips the second-order calculation details.
Examples
Uses the false-positive-rate function and the optimal hash-function count k as its worked application.
What it assumes
Assumes some calculus, while explaining logarithm and exponentiation inverses and allowing readers to skip the derivation.
What you can do after
Apply it via calculus to choose an approximately optimal Bloom-filter hash-function count.
How it connects
Connects calculus with optimization, natural logarithms, Bloom filters, false positives, and hash functions.

Also explained in

Compare how 6 books explain derivative →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Advanced Algorithms and Data Structures. The section links point to the parts of the book it draws on.