- Introduced by
- Mosteller & Wallace; Stamatatos
- Year
- 2009
- Type
- Supervised stylometric classification
- Family
- Stylometry
What does it do?
Authorship attribution is the task of identifying the most likely author of an anonymous or disputed text from its stylistic features.
The task has a long history, beginning with the statistical work of Mosteller and Wallace (1964) on the disputed Federalist Papers. Stamatatos (2009) surveys the automated approaches that followed, covering both text representation and text classification.
The intuition behind the method
Writers tend to show stable habits in word choice, function-word use, sentence structure and punctuation, often without noticing them. These habits can persist even when the subject changes, which is why they can serve as a stylistic signature. Attribution measures such habits in an unknown text and compares them with profiles built from each candidate's known writing. The approach works only to the extent that these habits are consistent within one author and differ between authors, and deliberate imitation weakens that assumption.
History
The landmark early application is the analysis by Mosteller and Wallace (1964) of the disputed Federalist Papers. Stamatatos (2009) reports that the field developed substantially over the preceding decade through advances in machine learning, information retrieval and natural language processing. The survey focuses on computational requirements and evaluation methodology rather than on literary questions.
When to use it
Use authorship attribution when you have labelled writing samples from each candidate author and must assign an anonymous or disputed text to one of them. The approach assumes that an author's style is consistent across texts and that different authors differ enough to be distinguished. Choose it only when the query text is long enough to give stable feature values, since very short texts such as single messages or short posts give unreliable features. If the true author may be absent from the candidate list, the closed-set argmax rule is not suitable, and an open-set method with a rejection option should be considered. If the question is whether two texts share an author without a candidate pool, authorship verification or clustering is more appropriate.
Limitations and considerations
- Each candidate needs enough known text for its centroid to reflect a stable style; with little training text, the centroid mostly reflects the particular documents chosen.
- Accuracy falls on very short texts, where feature values are estimated from too few tokens to be stable.
- Deliberate imitation or obfuscation of another author's style can move a text toward the wrong centroid, and similarity over stylistic features offers no built-in protection against this.
- The argmax rule always returns a candidate, so on its own it cannot signal that the true author is absent from the candidate pool.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Each candidate is summarised by one centroid vector, so scoring a query requires only one similarity computation per candidate.
- Character n-gram and function-word features depend less on subject matter than content vocabulary, which is why they are widely used when topics differ between texts.
- Shared benchmark tasks such as PAN allow different feature sets and classifiers to be compared on common data.
- Because the score is a cosine over named features, the contribution of particular stylistic markers can be examined after the fact.
Applications
- Forensic linguistics: comparing anonymous threatening letters or messages with writing samples from suspects.
- Literary and historical scholarship: resolving disputed authorship of manuscripts, pamphlets or editorials when the candidate writers are known.
- Analysis of electronic text such as e-mail, forum posts and blogs, where a pool of candidate authors is available.
- Plagiarism and ghostwriting investigations, in which a suspect's known writing is compared with the disputed text.
- Attribution of source code, which the survey lists among the electronic text types studied.
How it works
How it works
Each document d is converted into a numeric vector f(d) of n stylistic features. Typical choices include character n-gram frequencies and function-word rates, which depend less on subject matter than content vocabulary does. Feature values should be comparable across documents of different lengths, which matters for the pitfalls discussed below. Features should also be normalised or standardised (for example, z-scored using the training documents) before cosine scoring. With unscaled relative frequencies, the few most frequent features dominate the vector and the score reflects them more than the rest. The normalisation used should be reported with the results.
Formula
\mathbf{f}(d) = [f_1(d), f_2(d), \ldots, f_n(d)]^\topFor each candidate author a, the feature vectors of that author's training documents are averaged to give a centroid profile mu_a. This is one simple profile-based variant; other approaches treat each training document separately. The centroid summarises the author's known writing as a single vector, so each candidate is represented once regardless of how many training documents it has.
Formula
\mu_a = \frac{1}{|D_a|} \sum_{d \in D_a} \mathbf{f}(d)The cosine of the angle between the query vector f(d) and each centroid mu_a is computed. Cosine compares the direction of the two vectors rather than their magnitude, so a uniform scaling of the feature vector does not change the score. It does not correct for feature types that change with text length, and it does not remove the dominance of high-frequency features unless the features were standardised beforehand.
Formula
\text{sim}(d, a) = \cos(\mathbf{f}(d),\, \mu_a) = \frac{\mathbf{f}(d) \cdot \mu_a}{\|\mathbf{f}(d)\|\,\|\mu_a\|}The formula selects the candidate with the highest similarity score and returns a single predicted label. The scores can also be sorted to list alternative candidates. The formulation on this page does not produce calibrated probabilities; turning scores into probabilities or confidence values needs an additional step that is not specified here.
Formula
\hat{a} = \arg\max_{a \in A}\; \text{sim}(d, a)Common pitfalls
- Content-word features mix topical similarity with stylistic similarity, which can inflate accuracy on test sets that share subject matter with the training data.
- Mixing features that scale with text length, such as raw counts, with rate features, such as per-token frequencies or average sentence length, makes the cosine depend on document length even though cosine ignores overall scale. Expressing features as rates where possible avoids this.
- Evaluating on texts from the same topic as the training data can reward topical overlap; cross-topic evaluation is needed to test stylistic attribution.
- Presenting a single predicted author as proof overstates certainty. Without error rates measured on held-out texts of comparable type and length, the output does not show how often such predictions are wrong.
Frequently asked questions
How much training text is needed per author?
No fixed minimum applies across tasks. The amount needed depends on the feature set, the number of candidates and how similar their styles are. Larger known samples generally give more stable centroids. Cross-validation on the training texts shows whether estimated accuracy stays stable as sample size changes; if the estimates vary widely, the profiles are probably too thin for reliable attribution.
Can the method handle completely unknown authors (open-set attribution)?
Standard closed-set attribution assumes the true author is among the candidates, so it always assigns a label. Open-set attribution adds a rejection threshold: if no candidate scores above the threshold, the document is flagged as coming from an unknown author. Setting the threshold requires held-out documents from authors outside the candidate pool; without them, the threshold cannot be checked.
Are neural language model embeddings better than traditional stylometric features?
Pretrained transformer embeddings can encode stylistic cues, but they also encode topical content and usually need more labelled data. Whether they outperform handcrafted features depends on the task and the data. Character n-gram and function-word features remain common baselines, particularly when training data are limited, when genres differ, or when results must be explained in a forensic report. The choice should be tested on data resembling the case at hand.
Related methods
Sources
Stamatatos, E. (2009). A survey of modern authorship attribution methods. Journal of the American Society for Information Science and Technology, 60(3), 538–556.
Open DOI reference