ArticleslgStudy

computer science

Affinity propagation

Affinity propagation is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Affinity propagation rather than just read about it. In short: In statistics and data mining, affinity propagation (AP) is a clustering algorithm based on the concept of "message passing" between data points. Unlike clustering algorithms such as k-means or k-medoids, affinity propagation does not require the number of clusters to be determined or estimated before running the algorithm.

Key takeaways

  • Affinity propagation belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Affinity propagation to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Affinity propagation from memory before moving on to harder problems.

Reference excerpt

In statistics and data mining, affinity propagation (AP) is a clustering algorithm based on the concept of "message passing" between data points. Unlike clustering algorithms such as k-means or k-medoids, affinity propagation does not require the number of clusters to be determined or estimated before running the algorithm. Similar to k-medoids, affinity propagation finds "exemplars," members of the input set that are representative of clusters.

Algorithm Let x1 through xn be a set of data points, with no assumptions made about their internal structure, and let s be a function that quantifies the similarity between any two points, such that s(i, j) > s(i, k) if and only if xi is more similar to xj than to xk. For this example, the negative squared distance of two data points was used i.e. for points xi and xk, s(i,k)=−‖xi−xk‖2. The diagonal of s (i.e. s(i,i)) is particularly important, as it represents the instance preference, meaning how likely a particular instance is to become an exemplar. When it is set to the same value for all inputs, it controls how many classes the algorithm produces. A value close to the minimum possible similarity produces fewer classes, while a value close to or larger than the maximum possible similarity produces many classes. It is typically initialized to the median similarity of all pairs of inputs. The algorithm proceeds by alternating between two message-passing steps, which update two matrices:

The "responsibility" matrix R has values r(i, k) that quantify how well-suited xk is to serve as the exemplar for xi, relative to other candidate exemplars for xi. The "availability" matrix A contains values a(i, k) that represent how "appropriate" it would be for xi to pick xk as its exemplar, taking into account other points' preference for xk as an exemplar. Both matrices are initialized to all zeroes, and can be viewed as log-probability tables. The algorithm then performs the following updates iteratively:

First, responsibility updates are sent around: r(i,k)←s(i,k)−maxk′≠k{a(i,k′)+s(i,k′)} Then, availability is updated per a(i,k)←min⁡(0,r(k,k)+∑i′∉{i,k}max⁡(0,r(i′,k))) for i≠k and a(k,k)←∑i′≠kmax⁡(0,r(i′,k)). Iterations are performed until either the cluster boundaries remain unchanged over a number of iterations, or some predetermined number (of iterations) is reached. The exemplars are extracted from the final matrices as those whose 'responsibility + availability' for themselves is positive (i.e. (r(i,i)+a(i,i))>0).

Applications The inventors of affinity propagation showed it is better for certain computer vision and computational biology tasks, e.g. clustering of pictures of human faces and identifying regulated transcripts, than k-means, even when k-means was allowed many random restarts and initialized using PCA. A study comparing affinity propagation and Markov clustering on protein interaction graph partitioning found Markov clustering to work better for that problem. A semi-supervised variant has been proposed for text mining applications. Another recent application was in economics, when the affinity propagation was used to find some temporal patterns in the output multipliers of the US economy between 1997 and 2017.

Software A Java implementation is included in the ELKI data mining framework. A Julia implementation of affinity propagation is contained in Julia Statistics's Clustering.jl package. A Python version is part of the scikit-learn library. An R implementation is available in the "apcluster" package.

References

Worked examples

Example 1 — a first encounter with Affinity propagation

Start with the simplest possible case. Write down what Affinity propagation claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Affinity propagation before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Affinity propagation ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Affinity propagation

In research
Affinity propagation appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Affinity propagation in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Affinity propagation is common in secondary-school and first-year university syllabi. It links to neighbouring topics Cluster analysis algorithms, so understanding it makes those chapters shorter.
In everyday life
Look for Affinity propagation outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Affinity propagation” →

How to study Affinity propagation in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Affinity propagation means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Affinity propagation out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Affinity propagation in simple terms?

In statistics and data mining, affinity propagation (AP) is a clustering algorithm based on the concept of "message passing" between data points. Unlike clustering algorithms such as k-means or k-medoids, affinity propagation does not require the number of clusters to be determined or estimated bef…

Why does Affinity propagation matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Affinity propagation?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Affinity propagation.

Tags

  • Cluster analysis algorithms

Keep exploring