AI-powered behavioural profiling

A behavioural profiling system turns posts into measurable features: the times of posting, the topics that recur, the vocabulary, the rhythm and the apparent emotional register. A model trained on those features can learn statistical regularities in what somebody produces and assign them a category on that basis.

How much that category reveals about the person depends partly on how it was originally defined.

Scored, clustered, labelled

There are several ways of constructing a behavioural profile. Sentiment analysis assigns scores to language associated with positive or negative expressions. Topic analysis examines recurring subjects. Clustering groups observations with similar characteristics.

A system can combine these techniques to construct a description of somebody’s activities over time.

for post in account_history:
    features = {
        "time": post.timestamp,
        "sentiment": analyse_sentiment(post.text),
        "terms": extract_text_features(post.text)
    }

    store(account_id, features)

vectors = TF_IDF_transform(all_posts)
clusters = K_means(vectors)

profile = {
    "dominant_topics": summarise_clusters(account_id),
    "sentiment_over_time": aggregate_sentiment(account_id),
    "activity_patterns": summarise_timestamps(account_id)
}

The resulting description might associate an account with recurring discussions of work, outdoor activities and social engagements at weekends.

Interpreting those observations as evidence of professional stress or satisfaction with somebody’s personal life introduces further assumptions. Sentiment analysis can mistake irony for enthusiasm, while the subjects somebody discusses publicly may represent only a narrow part of their interests.

Clustering provides groups of similar observations. Giving those groups meaningful names requires an additional interpretation.

Reading parliament

The greenhouse-attacks profiling experiment asks a narrower question. It uses supervised classification to examine how successfully a model can predict a recorded political category from speech.

The material comes from ParlaMint 5.0, a multilingual parliamentary corpus published through CLARIN under CC BY 4.0.

The experiment uses the Latvian portion, selecting 23,038 speeches of at least forty words from 195 parliamentarians, across 603 parliamentary sessions.

Each speech is accompanied by metadata identifying its speaker, party affiliation and the political orientation recorded for that party. The classification comes from external sources used by the corpus maintainers, including Wikipedia and the Chapel Hill Expert Survey.

The label describes the party. It is not a measurement of the speaker’s personal convictions.

The model learns associations between word patterns and six recorded orientation categories.

# Parliamentary speech and corpus metadata

text = speech.words
label = speech.party_orientation

# Learn relationships from training speeches

vectors = vectoriser.fit_transform(training_texts)
classifier.fit(vectors, training_labels)

# Evaluate on separate speeches

test_vectors = vectoriser.transform(test_texts)
predictions = classifier.predict(test_vectors)

compare(predictions, test_labels)

The sentiment analysis and clustering described earlier are absent from this experiment. Its purpose is to examine what a supervised text classifier can recover from a particular corpus.

The interesting part begins with deciding which speeches belong in the training material.

Four ways of testing

A random division of speeches places much of the work of the same parliamentarians on both sides of the experiment.

The model might encounter twenty speeches by a particular politician during training, followed by another five during evaluation. Familiar vocabulary, recurring expressions and subjects associated with that politician could all help it recover the recorded party orientation.

Holding out entire speakers removes that particular opportunity. Holding out parliamentary sessions examines performance on proceedings absent from the training material. A chronological division examines whether relationships learned from earlier speeches remain useful when predicting later ones.

Each arrangement asks a somewhat different question.

Evaluation

Accuracy

Training majority baseline

Random speeches

68.9%

22.3%

Unfamiliar speakers

34.6%

14.9%

Unfamiliar sessions

67.4%

23.2%

Later speeches

60.7%

20.0%

The training majority baseline ignores the speech altogether and always predicts the most common label in the training material.

Its accuracy varies because the distribution of political categories differs between the training and evaluation populations. In the unfamiliar speaker evaluation, the most common category among the held out speeches accounts for 25.8% of them. The category selected from the training material accounts for only 14.9%.

The lower baseline therefore reflects a change in the population as well as the difficulty of the task.

Performance drops sharply when the model encounters unfamiliar speakers. Removing familiar parliamentary sessions has much less effect, partly because 185 speakers still appear in both parts of that evaluation.

The chronological evaluation also retains ninety familiar speakers.

These results suggest that familiarity with the people producing the speeches contributes substantially to predictive performance. The experiment cannot establish how much of that contribution comes from individual writing habits, party vocabulary, recurring subjects or other characteristics.

A rather good shortcut

There is another way of predicting the label.

The corpus records the party to which each politician belongs. Its orientation categories are derived from those party affiliations.

A simple comparison using party metadata produces the following results:

Evaluation

Speech model

Party metadata alone

Random speeches

68.9%

100%

Unfamiliar speakers

34.6%

100%

Unfamiliar sessions

67.4%

100%

Later speeches

60.7%

100%

No speech needs to be examined.

The perfect result follows from the construction of the dataset. Party membership supplies the information from which the orientation label was assigned in the first place.

This changes the interpretation of the text classifier. The model may learn expressions associated with particular parties and thereby recover their orientation labels. It may recognise familiar speakers and indirectly recover the same information. It may also learn language genuinely associated with political positions.

The present experiment cannot reliably separate those possibilities.

A separate comparison using topic metadata produced accuracies between 18.5% and 28.9%, depending on the evaluation arrangement. Topic information alone performs much less successfully than party membership, although that does not exclude more complicated relationships between subjects, language and political affiliation.

An evaluation holding out entire parties would help investigate whether the model can recognise orientations independently of familiar party vocabulary. That evaluation has not yet been performed.

Even a successful result would still concern the orientation labels assigned to political parties. Establishing what individual speakers privately believe would require a different source of evidence.

How certain?

A single accuracy figure conceals variation between political categories and between speakers.

The corrected experiment estimates uncertainty by repeatedly resampling whole speakers from the evaluation material. Resampling individual speeches would treat several observations of the same person as though they were entirely independent.

Evaluation

Accuracy

95% bootstrap interval

Random speeches

68.9%

63.3% to 73.5%

Unfamiliar speakers

34.6%

27.1% to 41.7%

Unfamiliar sessions

67.4%

61.3% to 72.8%

Later speeches

60.7%

50.3% to 69.7%

The intervals reflect variation within the evaluated groups of speakers. They do not account for all the uncertainty introduced by selecting a different training population, model or parliamentary corpus.

Performance also differs between orientation categories. Among unfamiliar speakers, the classifier correctly recognises approximately 44% of speeches carrying the centre to centre-right label, compared with 18% of those carrying the centre-right to right label.

The overall result provides little indication of that difference.

For a commercial system selecting audiences, variation of this kind can mean that some categories are considerably less reliable than others. An assessment of the consequences would need to examine who receives an incorrect label, what that label is used for and whether the people concerned have any opportunity to challenge it.

A label nobody sees

Commercial profiling systems encounter a related problem when they learn from categories produced by other systems.

A supplier may construct an audience described as financially vulnerable, politically disengaged or interested in particular health subjects. A subsequent model may learn to reproduce those categories from other observations.

Its evaluation can establish how successfully it reproduces the supplier’s classifications. Establishing whether the original classifications accurately describe people’s circumstances is a different undertaking.

The distinction becomes particularly difficult to examine when the provenance of the training labels is unavailable.

An advertiser purchasing an audience may receive information about campaign responses while knowing very little about how its members were originally classified. The people receiving the advertisements may have no access to the classifications at all.

The commercial categories examined elsewhere in this collection demonstrate that such classifications are available for purchase. The parliamentary experiment illustrates one difficulty in evaluating predictions made from labelled behavioural records.

European law also addresses classifications whose accuracy has never been established.

Recital 79 of the Regulation on political advertising explicitly includes the use of ordinary personal information to categorise people according to sensitive characteristics, irrespective of whether the resulting categorisation is correct.

The regulation prohibits the use of profiling based on special categories of personal information for targeting online political advertisements.

The parliamentary experiment does not itself constitute such targeting. Its relevance lies in demonstrating why an uncertain or incorrectly attributed political category can still deserve protection when attached to a person and used in a commercial or political system.

Separate accounts

Reducing the amount of information available to a profiling system can limit some opportunities for constructing connections. Using separate accounts for different activities removes one direct association that a shared login would otherwise provide.

Language may supply another connection. The stylometry experiment examines how recurring patterns of word use can contribute to recognising authors. Its generated texts illustrate the mechanism under controlled assumptions rather than establishing reliable identification of real writers.

The parliamentary experiment is consistent with the possibility that familiar speakers leave recognisable patterns in their language. It does not isolate those patterns or measure their effectiveness in connecting separate accounts.

The appropriate interpretation depends on the question being asked. Predicting a party label, recognising an author, connecting accounts and inferring a private political belief are distinct tasks. They require different evaluation populations and different forms of evidence.

For commercial profiling, the provenance of the labels deserves at least as much attention as the sophistication of the model. A classifier can reproduce an existing categorisation with impressive accuracy while providing little independent evidence that the categorisation describes the people to whom it has been applied.