Gaussian processes
predictive modelling
Wasserstein distances
Author

Jan Vanhove

Published

June 3, 2026

Lexical frequency as predictor of text quality ratings. Typically summarised as scalar (e.g., average log-frequency) or binned as lexical frequency profile.

But frequency distributions may have same scalar summaries yet differ considerably in their shape. Further, binning is based on arbitrary choices (number of bins, cut-offs).

Alternative: use distributions as predictors.

Example: German data.

  1. Frequency distributions (Zipf).
  2. Mean Zipf.
  3. Frequency bands à la Nation & Laufer.

Construct kernels. Use Gaussian process regression. Compare performance.

Code
library(slicer)
library(tidyverse)
Warning: package 'tidyverse' was built under R version 4.5.3
Warning: package 'ggplot2' was built under R version 4.5.3
Warning: package 'tidyr' was built under R version 4.5.3
Warning: package 'readr' was built under R version 4.5.3
Warning: package 'dplyr' was built under R version 4.5.3
Warning: package 'stringr' was built under R version 4.5.3
Warning: package 'forcats' was built under R version 4.5.3
Warning: package 'lubridate' was built under R version 4.5.3
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.2.1     ✔ readr     2.2.0
✔ forcats   1.0.1     ✔ stringr   1.6.0
✔ ggplot2   4.0.3     ✔ tibble    3.2.1
✔ lubridate 1.9.5     ✔ tidyr     1.3.2
✔ purrr     1.0.4     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
Code
# Scalar inputs and output
d <- read_csv("german_summary.csv") |> 
  select(TextType, Time, Batch, 
         contains("LemmaFreq"), LemmameanZipf, LemmameanZipfUnique,
         meanRating)
Rows: 1020 Columns: 139
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr   (7): Text, Class, TextType, Language, Batch, wordsNotInSUBTLEX, Lemmaw...
dbl (131): meanRating, nRatings, Learner, Time, TTR, Guiraud, nTokens, nType...
lgl   (1): ControlGroup

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Code
# Each text as a distribution
load("word_distributions_matrix.Rda")
length(matrix_list)
[1] 1020
Code
colnames(matrix_list[[314]])
 [1] "position"           "letters"            "is_noun"           
 [4] "is_verb"            "is_adjadv"          "hdd_prob_42"       
 [7] "hdd_prob_31"        "hdd_prob_20"        "SUBTLEX"           
[10] "Zipf"               "Rank"               "Lemma_SUBTLEX"     
[13] "Lemma_Zipf"         "Lemma_Rank"         "mean_Levenshtein"  
[16] "Dispersion10"       "Lemma_Dispersion10" "Dispersion20"      
[19] "Lemma_Dispersion20" "Dispersion30"       "Lemma_Dispersion30"
Code
matrix_list[[314]]
       position letters is_noun is_verb is_adjadv hdd_prob_42 hdd_prob_31
  [1,]        1       3       0       0         0   0.5990847   0.4681922
  [2,]        2       3       0       1         0   0.5990847   0.4681922
  [3,]        3       3       0       0         0   0.3652174   0.2695652
  [4,]        4       3       0       0         0   0.3652174   0.2695652
  [5,]        5      11       1       0         0   0.3652174   0.2695652
  [6,]        6       3       0       0         0   0.5990847   0.4681922
  [7,]        7       5       0       0         0   0.3652174   0.2695652
  [8,]        8       2       0       0         0   0.8425609   0.7209018
  [9,]        9       5       1       0         0   0.3652174   0.2695652
 [10,]       10       2       0       0         0   0.9021325   0.7988481
 [11,]       11       6       1       0         0   0.3652174   0.2695652
 [12,]       12       5       0       1         0   0.7480974   0.6140864
 [13,]       13       3       0       0         0   0.9772740   0.9262956
 [14,]       14       6       1       0         0   0.5990847   0.4681922
 [15,]       15       7       0       1         0   0.3652174   0.2695652
 [16,]       16       3       0       0         0   0.9395001   0.8555364
 [17,]       17       2       0       0         0   0.9021325   0.7988481
 [18,]       18       8       1       0         0   0.3652174   0.2695652
 [19,]       19       5       0       1         0   0.7480974   0.6140864
 [20,]       20       3       0       0         0   0.9772740   0.9262956
 [21,]       21       3       0       0         0   0.9395001   0.8555364
 [22,]       22       6       1       0         0   0.5990847   0.4681922
 [23,]       23      13       0       1         0   0.3652174   0.2695652
 [24,]       24       3       0       0         0   0.9395001   0.8555364
 [25,]       25       4       0       0         1   0.3652174   0.2695652
 [26,]       26       4       0       0         0   0.3652174   0.2695652
 [27,]       27       3       0       0         0   0.9395001   0.8555364
 [28,]       28       2       0       0         0   0.8425609   0.7209018
 [29,]       29       4       1       0         0   0.3652174   0.2695652
 [30,]       30       7       0       1         0   0.3652174   0.2695652
 [31,]       31       3       0       0         0   0.3652174   0.2695652
 [32,]       32       8       1       0         0   0.3652174   0.2695652
 [33,]       33       4       0       0         0   0.3652174   0.2695652
 [34,]       34       3       0       0         0   0.3652174   0.2695652
 [35,]       35       8       0       0         1   0.3652174   0.2695652
 [36,]       36       5       1       0         0   0.3652174   0.2695652
 [37,]       37       6       0       1         0   0.3652174   0.2695652
 [38,]       38       3       0       0         0   0.5990847   0.4681922
 [39,]       39       3       0       0         0   0.9395001   0.8555364
 [40,]       40       2       0       0         0   0.8425609   0.7209018
 [41,]       41      10       1       0         0   0.3652174   0.2695652
 [42,]       42       3       0       0         0   0.9395001   0.8555364
 [43,]       43       2       0       0         0   0.9021325   0.7988481
 [44,]       44       8       1       0         0   0.3652174   0.2695652
 [45,]       45       5       0       1         0   0.7480974   0.6140864
 [46,]       46       3       0       0         0   0.9772740   0.9262956
 [47,]       47       3       0       0         0   0.7480974   0.6140864
 [48,]       48       4       0       0         0   0.3652174   0.2695652
 [49,]       49       3       0       0         0   0.7480974   0.6140864
 [50,]       50       3       0       0         0   0.9772740   0.9262956
 [51,]       51       3       0       0         0   0.5990847   0.4681922
 [52,]       52       3       0       0         0   0.7480974   0.6140864
 [53,]       53       1       1       0         0   0.5990847   0.4681922
 [54,]       54       5       1       0         0   0.3652174   0.2695652
 [55,]       55       7       0       1         0   0.3652174   0.2695652
 [56,]       56       7       0       1         0   0.3652174   0.2695652
 [57,]       57       3       0       0         0   0.9395001   0.8555364
 [58,]       58       3       0       1         0   0.5990847   0.4681922
 [59,]       59       8       0       1         0   0.3652174   0.2695652
 [60,]       60       2       0       0         0   0.3652174   0.2695652
 [61,]       61       6       0       1         0   0.3652174   0.2695652
 [62,]       62       2       0       0         0   0.9021325   0.7988481
 [63,]       63      10       1       0         0   0.5990847   0.4681922
 [64,]       64       6       0       0         1   0.3652174   0.2695652
 [65,]       65       6       0       1         0   0.3652174   0.2695652
 [66,]       66       3       0       0         0   0.3652174   0.2695652
 [67,]       67       3       0       0         0   0.9395001   0.8555364
 [68,]       68       7       0       0         0   0.3652174   0.2695652
 [69,]       69      10       1       0         0   0.5990847   0.4681922
 [70,]       70       3       0       0         0   0.9395001   0.8555364
 [71,]       71       1       1       0         0   0.5990847   0.4681922
 [72,]       72       6       1       0         0   0.3652174   0.2695652
 [73,]       73       5       0       1         0   0.3652174   0.2695652
 [74,]       74       8       0       1         0   0.3652174   0.2695652
 [75,]       75       3       0       0         0   0.9395001   0.8555364
 [76,]       76       3       0       0         0   0.9395001   0.8555364
 [77,]       77       5       1       0         0   0.3652174   0.2695652
 [78,]       78       3       0       1         0   0.5990847   0.4681922
 [79,]       79       4       0       0         1   0.3652174   0.2695652
 [80,]       80       6       0       0         1   0.3652174   0.2695652
 [81,]       81       3       0       0         0   0.9772740   0.9262956
 [82,]       82      10       0       1         0   0.3652174   0.2695652
 [83,]       83       5       0       0         0   0.3652174   0.2695652
 [84,]       84       3       0       0         0   0.3652174   0.2695652
 [85,]       85       7       1       0         0   0.3652174   0.2695652
 [86,]       86       3       0       0         0   0.9772740   0.9262956
 [87,]       87       8       0       1         0   0.3652174   0.2695652
 [88,]       88       3       0       0         0   0.3652174   0.2695652
 [89,]       89       3       0       0         0   0.5990847   0.4681922
 [90,]       90       3       0       0         0   0.3652174   0.2695652
 [91,]       91       5       1       0         0   0.3652174   0.2695652
 [92,]       92       2       0       0         0   0.9021325   0.7988481
 [93,]       93       7       1       0         0   0.5990847   0.4681922
 [94,]       94       3       0       0         0   0.3652174   0.2695652
 [95,]       95       7       1       0         0   0.5990847   0.4681922
 [96,]       96       5       0       0         1   0.3652174   0.2695652
 [97,]       97       3       0       1         0   0.3652174   0.2695652
 [98,]       98       3       0       0         0   0.3652174   0.2695652
 [99,]       99       6       0       0         1   0.3652174   0.2695652
[100,]      100       3       1       0         0   0.3652174   0.2695652
[101,]      101       3       0       0         0   0.9772740   0.9262956
[102,]      102       5       0       1         0   0.3652174   0.2695652
[103,]      103       3       0       0         0   0.3652174   0.2695652
[104,]      104       3       0       0         0   0.9772740   0.9262956
[105,]      105       4       0       1         0   0.3652174   0.2695652
[106,]      106       4       0       0         1   0.3652174   0.2695652
[107,]      107       2       0       0         0   0.8425609   0.7209018
[108,]      108       3       0       1         0   0.5990847   0.4681922
[109,]      109       6       0       0         1   0.3652174   0.2695652
[110,]      110       8       0       1         0   0.3652174   0.2695652
[111,]      111       3       0       0         0   0.9395001   0.8555364
[112,]      112       3       0       0         0   0.5990847   0.4681922
[113,]      113       4       0       1         0   0.3652174   0.2695652
[114,]      114       4       0       0         0   0.3652174   0.2695652
[115,]      115       5       1       0         0   0.3652174   0.2695652
       hdd_prob_20  SUBTLEX     Zipf     Rank Lemma_SUBTLEX Lemma_Zipf
  [1,]   0.3188406 36633.29 7.560631      1.0      48891.92   7.688014
  [2,]   0.3188406  4412.54 6.641447     36.0      43630.74   7.638570
  [3,]   0.1739130  6445.29 6.806000     18.0       6445.29   6.808022
  [4,]   0.1739130  3005.83 6.474725     50.0      58116.73   7.763078
  [5,]   0.1739130     0.00 1.591937 190501.0          0.00   1.593959
  [6,]   0.3188406  5657.66 6.749395     23.0       5747.74   6.758277
  [7,]   0.1739130  1316.15 6.116073    112.0      11798.25   7.070596
  [8,]   0.5395070     0.71 2.871452  34145.0          0.71   2.873474
  [9,]   0.1739130   192.65 5.281613    546.0        319.74   5.503627
 [10,]   0.6224787  1031.06 6.010055    137.0       5055.79   6.702569
 [11,]   0.1739130    25.12 4.397455   2684.5         27.32   4.435883
 [12,]   0.4393998  4577.94 6.657429     33.0      21667.52   7.334587
 [13,]   0.7944991 11034.61 7.039513     12.0      14366.63   7.156133
 [14,]   0.3188406     2.20 3.346881  16277.5          8.38   3.924057
 [15,]   0.1739130   638.57 5.801990    190.0       4579.20   6.659570
 [16,]   0.6911189 14470.29 7.157233      9.0      14470.29   7.159255
 [17,]   0.6224787  1031.06 6.010055    137.0       5055.79   6.702569
 [18,]   0.1739130    16.97 4.227443   3619.5         17.13   4.233531
 [19,]   0.4393998  4577.94 6.657429     33.0      21667.52   7.334587
 [20,]   0.7944991 11034.61 7.039513     12.0      14366.63   7.156133
 [21,]   0.6911189 16139.02 7.204633      7.0      58116.73   7.763078
 [22,]   0.3188406     2.20 3.346881  16277.5          8.38   3.924057
 [23,]   0.1739130     0.83 2.935960  30926.5         42.41   4.626648
 [24,]   0.6911189 14470.29 7.157233      9.0      14470.29   7.159255
 [25,]   0.1739130  1075.20 6.028260    132.0       1075.20   6.030282
 [26,]   0.1739130  1252.25 6.094460    115.0       1272.29   6.103377
 [27,]   0.6911189 16139.02 7.204633      7.0      58116.73   7.763078
 [28,]   0.5395070     0.71 2.871452  34145.0          0.71   2.873474
 [29,]   0.1739130    15.20 4.179722   3945.0         33.11   4.519252
 [30,]   0.1739130    89.02 4.946434    949.0        329.50   5.516684
 [31,]   0.1739130  1455.49 6.159776     98.0      11414.94   7.056252
 [32,]   0.1739130    75.71 4.876134   1086.0         77.25   4.886897
 [33,]   0.1739130  5579.35 6.743342     24.0       5579.35   6.745364
 [34,]   0.1739130 22310.21 7.345259      2.0      23900.51   7.377185
 [35,]   0.1739130     6.42 3.806945   7618.0         27.80   4.443436
 [36,]   0.1739130   295.01 5.466650    367.0        531.20   5.724067
 [37,]   0.1739130  1531.36 6.181843     92.0       4579.20   6.659570
 [38,]   0.3188406  4575.53 6.657200     34.0       4575.53   6.659222
 [39,]   0.6911189 16139.02 7.204633      7.0      58116.73   7.763078
 [40,]   0.5395070     0.71 2.871452  34145.0          0.71   2.873474
 [41,]   0.1739130    16.30 4.209990   3737.5         17.36   4.239311
 [42,]   0.6911189 14470.29 7.157233      9.0      14470.29   7.159255
 [43,]   0.6224787  1031.06 6.010055    137.0       5055.79   6.702569
 [44,]   0.1739130    14.76 4.166998   4043.0         14.88   4.172528
 [45,]   0.4393998  4577.94 6.657429     33.0      21667.52   7.334587
 [46,]   0.7944991 11034.61 7.039513     12.0      14366.63   7.156133
 [47,]   0.4393998 20313.28 7.304536      3.0      58116.73   7.763078
 [48,]   0.1739130     4.17 3.620972  10505.0          4.17   3.622994
 [49,]   0.4393998 20313.28 7.304536      3.0      58116.73   7.763078
 [50,]   0.7944991 11034.61 7.039513     12.0      14366.63   7.156133
 [51,]   0.3188406  5657.66 6.749395     23.0       5747.74   6.758277
 [52,]   0.4393998 20313.28 7.304536      3.0      58116.73   7.763078
 [53,]   0.3188406    25.47 4.403455   2657.5         26.69   4.425766
 [54,]   0.1739130     8.19 3.912121   6331.5          9.73   3.988644
 [55,]   0.1739130     5.91 3.771226   8127.5         12.26   4.088660
 [56,]   0.1739130   103.31 5.011063    856.0       1389.25   6.141570
 [57,]   0.6911189 14470.29 7.157233      9.0      14470.29   7.159255
 [58,]   0.3188406  4825.27 6.680280     29.0      21667.52   7.334587
 [59,]   0.1739130    86.46 4.933768    974.0        256.87   5.408557
 [60,]   0.1739130  8452.30 6.923732     15.0      12576.08   7.098324
 [61,]   0.1739130   230.60 5.359688    457.0       4235.05   6.625640
 [62,]   0.6224787  1031.06 6.010055    137.0       5055.79   6.702569
 [63,]   0.3188406    19.76 4.293406   3214.5         20.08   4.302391
 [64,]   0.1739130   150.79 5.175241    639.0        325.30   5.511114
 [65,]   0.1739130   970.20 5.983634    144.0       4372.55   6.639516
 [66,]   0.1739130  2772.31 6.439603     59.0       2772.31   6.441625
 [67,]   0.6911189 16139.02 7.204633      7.0      58116.73   7.763078
 [68,]   0.1739130   582.11 5.761789    210.0       1271.51   6.103110
 [69,]   0.3188406    19.76 4.293406   3214.5         20.08   4.302391
 [70,]   0.6911189 16139.02 7.204633      7.0      58116.73   7.763078
 [71,]   0.3188406    25.47 4.403455   2657.5         26.69   4.425766
 [72,]   0.1739130     1.54 3.195239  20756.0          9.73   3.988644
 [73,]   0.1739130   711.17 5.848752    176.0      43630.74   7.638570
 [74,]   0.1739130     3.78 3.578747  11237.0         12.26   4.088660
 [75,]   0.6911189 14470.29 7.157233      9.0      14470.29   7.159255
 [76,]   0.6911189 16139.02 7.204633      7.0      58116.73   7.763078
 [77,]   0.1739130     6.18 3.790501   7838.5          8.38   3.924057
 [78,]   0.3188406  4412.54 6.641447     36.0      43630.74   7.638570
 [79,]   0.1739130  2894.41 6.458321     52.0       2894.41   6.460343
 [80,]   0.1739130   361.90 5.555391    304.5        364.14   5.560092
 [81,]   0.7944991 11034.61 7.039513     12.0      14366.63   7.156133
 [82,]   0.1739130     1.38 3.148851  22295.5         46.15   4.663319
 [83,]   0.1739130  2312.41 6.360827     69.0       4171.70   6.619094
 [84,]   0.1739130  2795.78 6.443264     57.0       2795.78   6.445286
 [85,]   0.1739130    28.66 4.454627   2409.5         28.86   4.459665
 [86,]   0.7944991 11034.61 7.039513     12.0      14366.63   7.156133
 [87,]   0.1739130    17.44 4.239281   3544.0         38.11   4.580264
 [88,]   0.1739130  3331.98 6.519462     48.0      14366.63   7.156133
 [89,]   0.3188406  4575.53 6.657200     34.0       4575.53   6.659222
 [90,]   0.1739130  5979.21 6.773401     20.0      58116.73   7.763078
 [91,]   0.1739130     2.44 3.391096  15197.0          2.56   3.413645
 [92,]   0.6224787  1031.06 6.010055    137.0       5055.79   6.702569
 [93,]   0.3188406    24.49 4.386441   2735.5         25.01   4.397574
 [94,]   0.1739130  1523.68 6.179660     94.0       1523.68   6.181682
 [95,]   0.3188406    24.49 4.386441   2735.5         25.01   4.397574
 [96,]   0.1739130   962.75 5.980286    146.0        962.75   5.982308
 [97,]   0.1739130 19976.46 7.297274      4.0      43630.74   7.638570
 [98,]   0.1739130 11241.11 7.047566     10.0      58116.73   7.763078
 [99,]   0.1739130   228.12 5.354993    462.0        891.68   5.949005
[100,]   0.1739130   649.83 5.809581    185.0       1055.36   6.022194
[101,]   0.7944991 11034.61 7.039513     12.0      14366.63   7.156133
[102,]   0.1739130  1440.25 6.155205    100.0       4639.80   6.665280
[103,]   0.1739130  1585.02 6.196800     91.0       1586.08   6.199113
[104,]   0.7944991 11034.61 7.039513     12.0      14366.63   7.156133
[105,]   0.1739130  4648.37 6.664059     30.0      43630.74   7.638570
[106,]   0.1739130  5060.71 6.700970     28.0       5060.71   6.702992
[107,]   0.5395070     0.71 2.871452  34145.0          0.71   2.873474
[108,]   0.3188406  4825.27 6.680280     29.0      21667.52   7.334587
[109,]   0.1739130   117.17 5.065717    773.5        117.17   5.067739
[110,]   0.1739130   241.66 5.380030    438.0        475.02   5.675525
[111,]   0.6911189 14470.29 7.157233      9.0      14470.29   7.159255
[112,]   0.3188406 36633.29 7.560631      1.0      48891.92   7.688014
[113,]   0.1739130   274.74 5.435739    391.0       4639.80   6.665280
[114,]   0.1739130  2038.86 6.306151     73.0       2038.86   6.308173
[115,]   0.1739130   450.53 5.650516    261.0        899.56   5.952826
       Lemma_Rank mean_Levenshtein Dispersion10 Lemma_Dispersion10 Dispersion20
  [1,]        2.0        0.8762092            0                  0            0
  [2,]        3.0        0.8178196            0                  0            0
  [3,]       21.0        0.8583929            0                  0            0
  [4,]        1.0        0.8622185            0                  0            0
  [5,]    71626.0        0.8444843            0                  0            0
  [6,]       24.0        0.8772036            0                  0            0
  [7,]       12.0        0.7913577            0                  0            0
  [8,]    19931.0        0.9332813            0                  0            1
  [9,]      280.0        0.8456919            0                  0            0
 [10,]       31.0        0.8740711            1                  1            1
 [11,]     1987.5        0.8732043            0                  0            0
 [12,]        6.0        0.8135299            1                  1            1
 [13,]       10.0        0.8266509            1                  1            1
 [14,]     4697.0        0.8036938            1                  1            1
 [15,]       35.0        0.8432992            0                  0            0
 [16,]        9.0        0.9001908            1                  1            1
 [17,]       31.0        0.8740711            0                  0            0
 [18,]     2831.0        0.8062071            0                  0            0
 [19,]        6.0        0.8135299            0                  0            0
 [20,]       10.0        0.8266509            0                  0            0
 [21,]        1.0        0.7994922            1                  1            2
 [22,]     4697.0        0.8036938            0                  0            0
 [23,]     1407.0        0.8453313            0                  0            0
 [24,]        9.0        0.9001908            0                  0            1
 [25,]      107.0        0.8563357            0                  0            0
 [26,]       96.0        0.8613622            0                  0            0
 [27,]        1.0        0.7994922            0                  0            1
 [28,]    19931.0        0.9332813            0                  0            1
 [29,]     1703.0        0.8373436            0                  0            0
 [30,]      272.0        0.8343510            0                  0            0
 [31,]       13.0        0.9429238            0                  0            0
 [32,]      857.0        0.8703663            0                  0            0
 [33,]       25.0        0.8573728            0                  0            0
 [34,]        5.0        0.8260760            0                  0            0
 [35,]     1958.0        0.8620019            0                  0            0
 [36,]      190.0        0.8173461            0                  0            0
 [37,]       35.0        0.8005984            0                  0            0
 [38,]       36.0        0.8990082            0                  0            0
 [39,]        1.0        0.7994922            0                  2            0
 [40,]    19931.0        0.9332813            0                  0            0
 [41,]     2799.0        0.8647191            0                  0            0
 [42,]        9.0        0.9001908            0                  0            1
 [43,]       31.0        0.8740711            0                  0            1
 [44,]     3146.0        0.8937523            0                  0            0
 [45,]        6.0        0.8135299            0                  0            0
 [46,]       10.0        0.8266509            1                  1            1
 [47,]        1.0        0.8381372            2                  2            2
 [48,]     7406.5        0.9672242            0                  0            0
 [49,]        1.0        0.8381372            1                  1            1
 [50,]       10.0        0.8266509            0                  0            0
 [51,]       24.0        0.8772036            0                  0            0
 [52,]        1.0        0.8381372            0                  0            0
 [53,]     2025.0        0.9486113            0                  0            1
 [54,]     4211.0        0.8383997            0                  0            0
 [55,]     3598.0        0.8308855            0                  0            0
 [56,]       92.0        0.8324416            0                  0            0
 [57,]        9.0        0.9001908            0                  0            1
 [58,]        6.0        0.8583585            0                  0            0
 [59,]      342.0        0.8614695            0                  0            0
 [60,]       11.0        0.8728492            0                  0            0
 [61,]       40.0        0.8435353            0                  0            0
 [62,]       31.0        0.8740711            0                  0            0
 [63,]     2509.0        0.8270028            1                  1            1
 [64,]      275.0        0.8446920            0                  0            0
 [65,]       38.0        0.8713797            0                  0            0
 [66,]       57.0        0.8773850            0                  0            0
 [67,]        1.0        0.7994922            2                  2            2
 [68,]       97.0        0.7949970            0                  0            0
 [69,]     2509.0        0.8270028            0                  0            0
 [70,]        1.0        0.7994922            1                  1            1
 [71,]     2025.0        0.9486113            0                  0            0
 [72,]     4211.0        0.8384365            0                  0            0
 [73,]        3.0        0.7754076            0                  1            0
 [74,]     3598.0        0.8659059            0                  0            0
 [75,]        9.0        0.9001908            0                  0            0
 [76,]        1.0        0.7994922            0                  0            0
 [77,]     4697.0        0.8060399            0                  0            0
 [78,]        3.0        0.8178196            0                  0            0
 [79,]       53.0        0.8587591            0                  0            0
 [80,]      257.0        0.8499693            0                  0            0
 [81,]       10.0        0.8266509            1                  2            2
 [82,]     1323.0        0.8347554            0                  0            0
 [83,]       41.0        0.8444301            0                  0            0
 [84,]       56.0        0.8541498            0                  0            0
 [85,]     1893.0        0.8340602            0                  0            0
 [86,]       10.0        0.8266509            0                  1            2
 [87,]     1534.5        0.8262209            0                  0            0
 [88,]       10.0        0.8836533            0                  0            0
 [89,]       36.0        0.8990082            0                  0            0
 [90,]        1.0        0.8325465            0                  1            0
 [91,]     9915.5        0.8640225            0                  0            0
 [92,]       31.0        0.8740711            0                  0            0
 [93,]     2121.0        0.8638015            1                  1            1
 [94,]       86.0        0.9110069            0                  0            0
 [95,]     2121.0        0.8638015            0                  0            0
 [96,]      117.0        0.8351539            0                  0            0
 [97,]        3.0        0.8661241            0                  1            0
 [98,]        1.0        0.8183655            0                  0            0
 [99,]      132.0        0.8662549            0                  0            0
[100,]      110.0        0.8819487            0                  0            0
[101,]       10.0        0.8266509            1                  1            1
[102,]       34.0        0.8390181            0                  0            0
[103,]       83.0        0.9331558            0                  0            0
[104,]       10.0        0.8266509            0                  0            0
[105,]        3.0        0.8718946            0                  0            0
[106,]       30.0        0.7898921            0                  0            0
[107,]    19931.0        0.9332813            0                  0            0
[108,]        6.0        0.8583585            0                  0            0
[109,]      612.0        0.8095991            0                  0            0
[110,]      210.0        0.8561141            0                  0            0
[111,]        9.0        0.9001908            0                  0            0
[112,]        2.0        0.8762092            0                  0            0
[113,]       34.0        0.8622538            0                  0            0
[114,]       66.0        0.8596678            0                  0            0
[115,]      130.0        0.8070178            0                  0            0
       Lemma_Dispersion20 Dispersion30 Lemma_Dispersion30
  [1,]                  0            0                  0
  [2,]                  0            0                  0
  [3,]                  0            0                  0
  [4,]                  1            0                  2
  [5,]                  0            0                  0
  [6,]                  0            0                  0
  [7,]                  0            0                  0
  [8,]                  1            1                  1
  [9,]                  0            0                  0
 [10,]                  1            1                  1
 [11,]                  0            0                  0
 [12,]                  1            1                  1
 [13,]                  1            1                  1
 [14,]                  1            1                  1
 [15,]                  0            0                  1
 [16,]                  1            2                  2
 [17,]                  0            1                  1
 [18,]                  0            0                  0
 [19,]                  0            1                  1
 [20,]                  0            2                  2
 [21,]                  2            2                  4
 [22,]                  0            0                  0
 [23,]                  0            0                  0
 [24,]                  1            1                  1
 [25,]                  0            0                  0
 [26,]                  0            0                  0
 [27,]                  2            1                  4
 [28,]                  1            1                  1
 [29,]                  0            0                  0
 [30,]                  0            0                  0
 [31,]                  0            0                  0
 [32,]                  0            0                  0
 [33,]                  0            0                  0
 [34,]                  0            0                  0
 [35,]                  0            0                  0
 [36,]                  0            0                  0
 [37,]                  0            0                  0
 [38,]                  0            0                  0
 [39,]                  3            1                  4
 [40,]                  0            0                  0
 [41,]                  0            0                  0
 [42,]                  1            1                  1
 [43,]                  1            1                  1
 [44,]                  0            0                  0
 [45,]                  1            0                  1
 [46,]                  1            1                  1
 [47,]                  3            2                  5
 [48,]                  0            0                  0
 [49,]                  2            1                  4
 [50,]                  0            0                  0
 [51,]                  0            0                  0
 [52,]                  2            0                  3
 [53,]                  1            1                  1
 [54,]                  1            0                  1
 [55,]                  1            0                  1
 [56,]                  0            0                  0
 [57,]                  1            1                  1
 [58,]                  0            0                  0
 [59,]                  0            0                  0
 [60,]                  0            0                  0
 [61,]                  0            0                  0
 [62,]                  0            1                  1
 [63,]                  1            1                  1
 [64,]                  0            0                  0
 [65,]                  0            0                  0
 [66,]                  0            0                  0
 [67,]                  2            2                  3
 [68,]                  0            0                  0
 [69,]                  0            0                  0
 [70,]                  2            1                  3
 [71,]                  0            0                  0
 [72,]                  0            0                  0
 [73,]                  1            0                  2
 [74,]                  0            0                  0
 [75,]                  0            0                  0
 [76,]                  1            0                  2
 [77,]                  0            0                  0
 [78,]                  1            0                  2
 [79,]                  0            0                  0
 [80,]                  0            0                  0
 [81,]                  3            3                  4
 [82,]                  0            0                  0
 [83,]                  0            0                  0
 [84,]                  0            0                  0
 [85,]                  0            0                  0
 [86,]                  3            2                  3
 [87,]                  0            0                  0
 [88,]                  2            0                  2
 [89,]                  0            0                  0
 [90,]                  1            0                  1
 [91,]                  0            0                  0
 [92,]                  0            0                  0
 [93,]                  1            1                  1
 [94,]                  0            0                  0
 [95,]                  0            0                  0
 [96,]                  0            0                  0
 [97,]                  1            0                  1
 [98,]                  0            0                  0
 [99,]                  0            0                  0
[100,]                  0            0                  0
[101,]                  1            1                  1
[102,]                  1            0                  1
[103,]                  0            0                  0
[104,]                  0            0                  0
[105,]                  0            0                  0
[106,]                  0            0                  0
[107,]                  0            0                  0
[108,]                  0            0                  0
[109,]                  0            0                  0
[110,]                  0            0                  0
[111,]                  0            0                  0
[112,]                  0            0                  0
[113,]                  0            0                  0
[114,]                  0            0                  0
[115,]                  0            0                  0
Code
test_idx <- which(d$Batch %in% c("F", "G", "I", "N"))
training_idx <- (1:nrow(d))[-test_idx]

Mean Zipf values (unique and not unique)

Code
mean_zipf_dist <- outer(d$LemmameanZipf, d$LemmameanZipf, "-") |> abs()
mean_unique_zipf_dist <- outer(d$LemmameanZipfUnique , d$LemmameanZipfUnique , "-") |> abs()
Code
# training data
plot(meanRating ~ LemmameanZipf, data = d[training_idx, ],
     xlab = "mean Zipf (lemma-based)", ylab = "Mean rating")

Code
plot(meanRating ~ LemmameanZipfUnique, data = d[training_idx, ],
     xlab = "mean Zipf (unique lemma-based)", ylab = "Mean rating")

Code
mean_zipf_gpr <- fit_gpr(D2 = mean_zipf_dist^2, training_idx, test_idx,
  y_train = d$meanRating[training_idx], y_test = d$meanRating[test_idx],
  runs = 10L)
Hyperparameter search 1 of 10.
Optimum set at 1290.2190989.
Hyperparameter search 2 of 10.
Hyperparameter search 3 of 10.
Hyperparameter search 4 of 10.
Hyperparameter search 5 of 10.
Hyperparameter search 6 of 10.
Current optimum improved from 1290.2190989 to 1290.2190989.
Hyperparameter search 7 of 10.
Hyperparameter search 8 of 10.
Hyperparameter search 9 of 10.
Hyperparameter search 10 of 10.
Code
plot(d$LemmameanZipf[test_idx], mean_zipf_gpr$test_predictions)

Code
mean_unique_zipf_gpr <- fit_gpr(D2 = mean_unique_zipf_dist^2, training_idx, test_idx,
  y_train = d$meanRating[training_idx], y_test = d$meanRating[test_idx],
  runs = 10L)
Hyperparameter search 1 of 10.
Optimum set at 1289.6914095.
Hyperparameter search 2 of 10.
Hyperparameter search 3 of 10.
Hyperparameter search 4 of 10.
Hyperparameter search 5 of 10.
Hyperparameter search 6 of 10.
Hyperparameter search 7 of 10.
Hyperparameter search 8 of 10.
Hyperparameter search 9 of 10.
Hyperparameter search 10 of 10.
Code
plot(d$LemmameanZipfUnique[test_idx], mean_unique_zipf_gpr$test_predictions)

Code
# RMSE: 0.99

Comparison of frequency bands

Code
d$LemmaFreqTop1000 <- d[, 4:13] |> rowSums()
top1000_dist <- outer(d$LemmaFreqTop1000, d$LemmaFreqTop1000, "-") |> abs()
top2000_dist <- outer(d$LemmaFreq2000, d$LemmaFreq2000, "-") |> abs()
lfp_dist <- list(top1000_dist^2, top2000_dist^2)
plot(meanRating ~ LemmaFreqTop1000, data = d[training_idx, ],
     xlab = "Proportion in Top 1000", ylab = "Mean rating")

Code
plot(meanRating ~ LemmaFreq2000, data = d[training_idx, ],
     xlab = "Proportion in Band 1001-2000", ylab = "Mean rating")

Code
lfp_gpr <- fit_gpr(D2 = lfp_dist, training_idx, test_idx,
  y_train = d$meanRating[training_idx], y_test = d$meanRating[test_idx],
  runs = 10L)
Hyperparameter search 1 of 10.
Optimum set at 1236.173485.
Hyperparameter search 2 of 10.
Hyperparameter search 3 of 10.
Hyperparameter search 4 of 10.
Hyperparameter search 5 of 10.
Hyperparameter search 6 of 10.
Hyperparameter search 7 of 10.
Hyperparameter search 8 of 10.
Hyperparameter search 9 of 10.
Hyperparameter search 10 of 10.
Code
# $RMSE
# [1] 1.049372
# 
# $length_scale
# [1] 8.965691e-02 9.390859e-16
# 
# $scaling_factor
# [1] 0.2483085 0.3552805
# 
# $noise_variance
# [1] 1.002978
# 
# $nll
# [1] 1226.377

Entire distributions

Code
e_vect <- function(i, n) {
  if (i == 0) {
    return(c(1, rep(0, n - 1)))
  }
  if (i == n) {
    return(c(rep(0, n - 1), 1))
  }
  c(rep(0, i - 1), 1, rep(0, n - i))
}

thetas <- matrix(
  c(
    e_vect(13, 21) # frequency information
  ), 
  nrow = 1, byrow = TRUE)
zipf_distances <- compute_all_distances(
  matrix_list, thetas, verbose = TRUE, keep_projections = TRUE
)
Projecting distributions...
Computing sliced Wasserstein distances...

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
Code
distribution_gpr <- fit_gpr(D2 = zipf_distances, training_idx, test_idx,
  y_train = d$meanRating[training_idx], y_test = d$meanRating[test_idx],
  runs = 10L)
Hyperparameter search 1 of 10.
Optimum set at 1290.2190989.
Hyperparameter search 2 of 10.
Current optimum improved from 1290.2190989 to 1154.9665027.
Hyperparameter search 3 of 10.
Hyperparameter search 4 of 10.
Current optimum improved from 1154.9665027 to 1154.9665027.
Hyperparameter search 5 of 10.
Hyperparameter search 6 of 10.
Hyperparameter search 7 of 10.
Hyperparameter search 8 of 10.
Hyperparameter search 9 of 10.
Hyperparameter search 10 of 10.
Code
# $RMSE
# [1] 0.9280229
# 
# $length_scale
# [1] 0.3431806
# 
# $scaling_factor
# [1] 1.413498
# 
# $noise_variance
# [1] 0.7332158
# 
# $nll
# [1] 1154.967

References

Session info

Code
devtools::session_info("attached")
Warning in system2("quarto", "-V", stdout = TRUE, env = paste0("TMPDIR=", :
running command '"quarto"
TMPDIR=C:/Users/VanhoveJ/AppData/Local/Temp/RtmpyuI6ap/file1ec853702351 -V' had
status 1
─ Session info ───────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.5.0 (2025-04-11 ucrt)
 os       Windows 11 x64 (build 26200)
 system   x86_64, mingw32
 ui       RTerm
 language (EN)
 collate  English_United Kingdom.utf8
 ctype    English_United Kingdom.utf8
 tz       Europe/Zurich
 date     2026-07-09
 pandoc   3.1.1 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)
 quarto   NA @ C:\\Users\\VanhoveJ\\AppData\\Local\\Programs\\Quarto\\bin\\quarto.exe

─ Packages ───────────────────────────────────────────────────────────────────
 package   * version    date (UTC) lib source
 dplyr     * 1.2.1      2026-04-03 [1] CRAN (R 4.5.3)
 forcats   * 1.0.1      2025-09-25 [1] CRAN (R 4.5.3)
 ggplot2   * 4.0.3      2026-04-22 [1] CRAN (R 4.5.3)
 lubridate * 1.9.5      2026-02-04 [1] CRAN (R 4.5.3)
 purrr     * 1.0.4      2025-02-05 [1] CRAN (R 4.5.0)
 readr     * 2.2.0      2026-02-19 [1] CRAN (R 4.5.3)
 slicer    * 0.0.0.9000 2026-07-09 [1] local
 stringr   * 1.6.0      2025-11-04 [1] CRAN (R 4.5.3)
 tibble    * 3.2.1      2023-03-20 [1] CRAN (R 4.5.0)
 tidyr     * 1.3.2      2025-12-19 [1] CRAN (R 4.5.3)
 tidyverse * 2.0.0      2023-02-22 [1] CRAN (R 4.5.3)

 [1] C:/Users/VanhoveJ/AppData/Local/R/win-library/4.5
 [2] C:/Program Files/R/R-4.5.0/library
 * ── Packages attached to the search path.

──────────────────────────────────────────────────────────────────────────────