MétaCan
Menu
Back to cohort
Record W4402391085 · doi:10.23889/ijpds.v9i5.2801

Using Polars to Improve String Similarity Performance in Python

2024· article· en· W4402391085 on OpenAlexaff
Jeremy Foxcroft, Luiza Antonie

Bibliographic record

VenueInternational Journal for Population Data Science · 2024
Typearticle
Languageen
FieldComputer Science
TopicAlgorithms and Data Compression
Canadian institutionsUniversity of Guelph
Fundersnot available
KeywordsPython (programming language)Computer scienceString (physics)Similarity (geometry)Programming languagePhysicsArtificial intelligenceTheoretical physics

Abstract

fetched live from OpenAlex

IntroductionString similarity is central to textual record linkage, and is often calculated with Levenshtein distance or Jaro-Winkler distance. In polars-strsim, we leverage the Polars DataFrame interface to surpass all existing Python libraries in computing these distances. Polars-strsim is especially useful for larger-than-memory datasets. Objectives and ApproachPolars is a library built to analyse and manipulate tabular data. It is written in Rust, but can be called from Python for ease of use. Polars-strsim implements the Levenshtein and Jaro-Winkler algorithms as a Polars extension. We compare performance against nine other Python libraries on three million pairs of first names. ResultsWhen computing Levenshtein/Jaro-Winkler distance for this benchmark, polars-strsim is respectively 5x/4x faster than the current fastest Python alternative and 47x/35x faster than the median. The Polars streaming engine can be seamlessly used to manipulate larger than memory datasets. One practical application of this in record linkage is to find all pairs of records in a dataset where the Levenshtein distance computed across one (or more) fields is below a certain threshold (e.g., during blocking). With polars-strsim, this calculation can be performed in Python with CPU parallelism even if the input and/or output doesn’t fit in memory. Conclusions/ImplicationsThis work introduces a powerful library for record linkage practitioners. Polars-strsim provides the convenience of Python, the performance of a strongly/statically typed compiled language, and the full power of the Polars streaming engine when computing string similarity, and can be updated to implement additional similarity algorithms.

Fetched live from OpenAlex and de-inverted. Abstracts are not stored in this database: the inverted indexes are 8.6 GB of the frame’s 9.3 GB of text, and the host has 13 GB free.

How this classification was reachedexpand

Full frame machine prediction

Teacher imitation

Not calibrated prevalence, not ground truth. Human validation pending. The Gemma side is a direct model label for every work in the frame, read from the title-only record. The Codex side is a classifier learned from the 10,348 direct Codex labels and calibrated to design-weighted sample rates; fields without enough sample support carry no Codex call. Candidate is the union of the two sides; consensus is their intersection. These outputs are machine_predicted_unvalidated and are not human labels.

metaresearch head score (Codex)0.005
metaresearch head score (Gemma)0.024
Version: metacan-v3-hybrid-931329e0061cValidation status: machine_predicted_unvalidated
Candidate categoriesnone
Consensus categoriesnone
DomainCandidate signal: none · Consensus signal: none
Study designCandidate signal: Bench or experimental · Consensus signal: none
GenreCandidate signal: Methods · Consensus signal: none
Teacher disagreement score0.040
Threshold uncertainty score0.135

Distilled classifier scores by category (both heads)

CategoryCodexGemma
Metaresearch0.0050.024
Meta-epidemiology (narrow)0.0030.002
Meta-epidemiology (broad)0.0010.003
Bibliometrics0.0030.006
Science and technology studies0.0020.001
Scholarly communication0.0050.008
Open science0.0050.007
Research integrity0.0010.003
Insufficient payload (model declined to judge)0.0400.031

Machine scores (provisional)

The two teacher heads of the student model, read on this work. A score orders the frame for review; it never asserts a category, and the validation status ships verbatim with every row.

Baseline scores from an immature model (maturity gate not passed, 7 training rounds). Scores rank; they never assert a category.

Opus teacher head0.101
GPT teacher head0.416
Teacher spread0.315 · how far apart the two teachers sit on this one work
Validation statusscore_only:v0-immature-baseline · verbatim from the scoring run: score_only means the number may rank works, and no category label ships from it

Classification

machine, unvalidated

Machine predicted; a candidate call from one source (direct Gemma or distilled Codex), not a consensus.

The models applied no category: nothing in the taxonomy fit this work.
Study designBench or experimental
Domainnot available
GenreMethods

How this classification was reached, model by model and score by score, is at the end of the page under "How this classification was reached".

Quick stats

Citations1
Published2024
Admission routes1
Has abstractyes

Explore more

Same venueInternational Journal for Population Data ScienceSame topicAlgorithms and Data CompressionFrench-language works237,207