Skip to content

Similarity and Methodology

ao3575911 edited this page Oct 30, 2026 · 1 revision

Similarity and Methodology

Every number names its method and version, so results can be compared and reproduced.

Method id Used by What it is
features-idf-jaccard/1 similar, compare Jaccard over sourced traits, weighted by rarity (IDF): sharing a rare trait counts more
shuffled-features/2 similar z-scores 1,000 seeded shuffles that keep each language's trait count and each trait's frequency
k-medoids/idf-jaccard/1 cluster, dashboard k-medoids on the same distance; bootstrap support
criteria/1 rank, compare, guide Five criteria → score 0–100 and grade
kb-templates/1 ask, guide Template answers; every sentence cited or no answer

Shuffled baseline and z-scores

A raw score of 0.4 means little alone. similar compares each score to the same pair's scores under the shuffled baseline: z = (score − mean) / sd. z ≥ 3 is strong.

$ langsuite similar scheme --k 5
Most like Scheme (9 known traits · 252 candidates)
#  id             name          score    z  shared traits
1  racket         Racket        0.435  4.3  comments, homoiconicity, line-comments, macros,
                                            prefix-notation, print-debugging +1
2  power-query-m  PowerQuery M  0.335  3.0  comments, conditionals, line-comments,
                                            multi-line-comments, strings

langsuite s scheme --vs racket spells out the baseline for one pair. Languages with few known traits get noisy scores; the header shows how many traits the target has.

Clusters

$ langsuite cluster --langs haskell,ocaml,scheme,racket,c --k 2
2 clusters of 5 languages (silhouette 0.215 · bootstrap 100 runs over traits, seed 1729)
#  medoid   n  support  members
1  haskell  3     0.67  haskell, ocaml, c
2  scheme   2     0.66  scheme, racket
k-medoids/idf-jaccard/1 · support = share of bootstrap runs that recover the cluster (member Jaccard
≥ 0.75); ≥0.7 is stable · base-4fe788452522

Here neither cluster reaches 0.7, so treat them as tentative.

Scores and grades (criteria/1)

Criteria: Safety, Expressiveness, Modularity, Popularity, Maturity. Missing criteria lower the confidence column; they never add zeros. Adjust weights with langsuite settings profile safety=2 popularity=0.5.

Code similarity

similar --by code, compare and diff use Rosetta Code solutions (shingle similarity), e.g. code: 0.007 over 7 Rosetta tasks.

Caveats

  • PLDB coverage is uneven; unknown is never "no".
  • Scores describe the sourced data, not the language's real quality.

Clone this wiki locally