Documentation

Studies.Flemming2021

Flemming (2021): Comparing MaxEnt and Noisy Harmonic Grammar #

Flemming compares the stochastic harmonic grammars as random utility models (Train), in which noise is added to the candidates' harmonies: Gumbel noise for MaxEnt (Goldwater and Johnson, Hayes and Wilson), normal noise on the constraint weights for Noisy Harmonic Grammar (Boersma and Pater), and normal noise on the candidates for normal MaxEnt (Hayes). Between two candidates the probability of the first is a function of their harmony difference (7), so its logit is the harmony difference in MaxEnt (10) and its probit the harmony difference over the noise standard deviation σ_d in the normal models (16), (18). That deviation is the constant √(2v) in normal MaxEnt, but in NHG it grows with the violation difference of the two candidates (14). Adding a violation therefore changes the MaxEnt logit by the constraint's weight (§7.1), while the change in the NHG probit depends on the harmony difference before the change (38).

The test case is Smith and Pater's French schwa data (19): eight contexts crossing an underlying schwa or none, a preceding C or CC, and a following monosyllable or disyllable, evaluated by NoSchwa, *CCC, *Clash, Max, Dep and *Cluster (20)–(28).

Main results #

Implementation notes #

References #

Stochastic Harmonic Grammars as random utility models (§§4–5) #

theorem Flemming2021.choiceProb_pi_gumbelMeasure_eq_maxEnt {C : Type u_1} [Fintype C] [Nonempty C] {n : ℕ} [DecidableEq C] [MeasurableSpace C] [MeasurableSingletonClass C] (con : OptimalityTheory.ConstraintSet C (Fin n)) (w : Fin n → ℝ) (c : C) :

MaxEnt is the Gumbel random utility model (§4). When the candidates' harmonies are perturbed by independent standard Gumbel noise, the probability that c has the highest perturbed harmony is the MaxEnt probability of (4), by McFadden's Lemma 1.

theorem Flemming2021.logit_choiceProb_pi_gumbelMeasure {n : ℕ} (con : OptimalityTheory.ConstraintSet (Fin 2) (Fin n)) (w : Fin n → ℝ) :

Between two candidates the MaxEnt logit of the first is the harmony difference (10), since under standard Gumbel noise the choice probability is the logistic function of the difference.

theorem Flemming2021.probit_weightNoiseChoiceProb {n : ℕ} (con : OptimalityTheory.ConstraintSet (Fin 2) (Fin n)) (w : Fin n → ℝ) {v : NNReal} (hv : v ≠ 0) (hd : con.violationDiff 0 1 ≠ 0) :

Under noise of variance v on the weights, the probit of the first candidate is the harmony difference over the standard deviation σ_d of its noise (16).

theorem Flemming2021.probit_choiceProb_pi_gaussianReal {n : ℕ} (con : OptimalityTheory.ConstraintSet (Fin 2) (Fin n)) (w : Fin n → ℝ) {v : NNReal} (hv : v ≠ 0) :
ProbabilityTheory.probit (ProbabilityTheory.choiceProb (MeasureTheory.Measure.pi fun (c : Fin 2) => ProbabilityTheory.gaussianReal (HarmonicGrammar.harmonyScore con w c) v) 0).toReal = (HarmonicGrammar.harmonyScore con w 0 - HarmonicGrammar.harmonyScore con w 1) / √(2 * ↑v)

Under independent noise of variance v on the candidates' harmonies, the probit of the first candidate is the harmony difference over the constant √(2v) (18).

The effect of a change in violations on the NHG probit (§7.2) #

noncomputable def Flemming2021.probitChange (h Δh σ σ' : ℝ) :
ℝ

probitChange h Δh σ σ' is the change in the NHG probit when the harmony difference h changes by Δh and the noise standard deviation from σ to σ' (38a).

Equations
Instances For
    theorem Flemming2021.probitChange_eq (h Δh : ℝ) {σ σ' : ℝ} (hσ : 0 < σ) (hσ' : 0 < σ') :
    probitChange h Δh σ σ' = h * (σ - σ') / (σ * σ') + Δh / σ'

    The change decomposes into a term proportional to the initial harmony difference and the rescaled harmony change (38b).

    theorem Flemming2021.probitChange_strictAnti (Δh : ℝ) {σ σ' : ℝ} (hσ : 0 < σ) (hσ' : σ < σ') :
    StrictAnti fun (x : ℝ) => probitChange x Δh σ σ'

    When the change enlarges the noise, σ < σ', the probit gain decreases with the initial harmony difference: the same change in violations has a smaller effect the higher the schwa candidate already stands (§7.2).

    French schwa (§6): the contexts of (19) and the constraints of (20)–(23) #

    A context of (19).

    Instances For
      def Flemming2021.instDecidableEqContext.decEq (x✝ x✝¹ : Context) :
      Decidable (x✝ = x✝¹)
      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        def Flemming2021.instReprContext.repr :
        Context → ℕ → Std.Format
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          @[reducible, inline]

          Each tableau has two candidates, 0 realizing the schwa and 1 not.

          Equations
          Instances For

            NoSchwa (20) assigns one violation to a schwa in the output.

            Equations
            Instances For

              *CCC (21) penalizes the three-consonant cluster the schwaless candidate forms after two consonants.

              Equations
              Instances For

                *Clash (23) penalizes the schwaless candidate when a stressed monosyllable then follows a stressed syllable.

                Equations
                Instances For

                  Max penalizes the schwaless candidate for deleting an underlying schwa.

                  Equations
                  Instances For

                    Dep penalizes the schwa candidate for inserting a schwa where there is none underlyingly.

                    Equations
                    Instances For

                      *Cluster (22) penalizes a two-consonant cluster, which the schwaless candidate always forms and the schwa candidate forms after two consonants.

                      Equations
                      Instances For
                        def Flemming2021.diff (x : Context) (k : Fin 6) :
                        ℤ

                        The difference tableau records the schwa candidate's violations minus the schwaless candidate's, signed negatively as in the paper.

                        Equations
                        Instances For
                          theorem Flemming2021.diff_eq (u : Underlying) (o : Onset) (f : Following) :
                          List.ofFn (diff { underlying := u, onset := o, following := f }) = match u, o, f with | Underlying.zero, Onset.c, Following.disyllable => [-1, 0, 0, 0, -1, 1] | Underlying.zero, Onset.c, Following.monosyllable => [-1, 0, 1, 0, -1, 1] | Underlying.zero, Onset.cc, Following.disyllable => [-1, 1, 0, 0, -1, 0] | Underlying.zero, Onset.cc, Following.monosyllable => [-1, 1, 1, 0, -1, 0] | Underlying.schwa, Onset.c, Following.disyllable => [-1, 0, 0, 1, 0, 1] | Underlying.schwa, Onset.c, Following.monosyllable => [-1, 0, 1, 1, 0, 1] | Underlying.schwa, Onset.cc, Following.disyllable => [-1, 1, 0, 1, 0, 0] | Underlying.schwa, Onset.cc, Following.monosyllable => [-1, 1, 1, 1, 0, 0]

                          The difference tableaux of (35), derived from the constraint definitions.

                          noncomputable def Flemming2021.harmonyDiff (x : Context) (w : Fin 6 → ℝ) :
                          ℝ

                          hə − h∅, the harmony difference of a context under weights w.

                          Equations
                          Instances For
                            theorem Flemming2021.harmonyDiff_eq_sum (x : Context) (w : Fin 6 → ℝ) :
                            harmonyDiff x w = ∑ k : Fin 6, w k * ↑(diff x k)

                            The harmony difference is the weighted difference tableau, as in (29)–(34).

                            MaxEnt predicts uniform logit differences (§7.1) #

                            theorem Flemming2021.harmonyDiff_following (u : Underlying) (o : Onset) (w : Fin 6 → ℝ) :
                            harmonyDiff { underlying := u, onset := o, following := Following.monosyllable } w - harmonyDiff { underlying := u, onset := o, following := Following.disyllable } w = w 2

                            Adding the *Clash violation, –sś to –ś, raises the harmony difference by the weight of *Clash whatever the other features.

                            theorem Flemming2021.harmonyDiff_onset (u : Underlying) (f : Following) (w : Fin 6 → ℝ) :
                            harmonyDiff { underlying := u, onset := Onset.cc, following := f } w - harmonyDiff { underlying := u, onset := Onset.c, following := f } w = w 1 - w 5

                            Two preceding consonants add a *CCC and remove a *Cluster violation difference.

                            theorem Flemming2021.harmonyDiff_underlying (o : Onset) (f : Following) (w : Fin 6 → ℝ) :
                            harmonyDiff { underlying := Underlying.schwa, onset := o, following := f } w - harmonyDiff { underlying := Underlying.zero, onset := o, following := f } w = w 3 + w 4

                            An underlying schwa adds a Max and removes a Dep violation difference.

                            noncomputable def Flemming2021.maxEntProb (x : Context) (w : Fin 6 → ℝ) :
                            ℝ

                            The MaxEnt probability of the schwa candidate.

                            Equations
                            Instances For
                              theorem Flemming2021.logit_maxEntProb (x : Context) (w : Fin 6 → ℝ) :
                              theorem Flemming2021.logit_following (u : Underlying) (o : Onset) (w : Fin 6 → ℝ) :
                              (maxEntProb { underlying := u, onset := o, following := Following.monosyllable } w).logit - (maxEntProb { underlying := u, onset := o, following := Following.disyllable } w).logit = w 2

                              MaxEnt predicts the same logit difference, the weight of *Clash, across the four pairs 1-2, 3-4, 5-6, 7-8.

                              theorem Flemming2021.logit_onset (u : Underlying) (f : Following) (w : Fin 6 → ℝ) :
                              (maxEntProb { underlying := u, onset := Onset.cc, following := f } w).logit - (maxEntProb { underlying := u, onset := Onset.c, following := f } w).logit = w 1 - w 5

                              … and the same logit difference across the pairs 1-3, 2-4, 5-7, 6-8.

                              theorem Flemming2021.logit_underlying (o : Onset) (f : Following) (w : Fin 6 → ℝ) :
                              (maxEntProb { underlying := Underlying.schwa, onset := o, following := f } w).logit - (maxEntProb { underlying := Underlying.zero, onset := o, following := f } w).logit = w 3 + w 4

                              … and across the pairs 1-5, 2-6, 3-7, 4-8.

                              NHG predicts context-dependent probit differences (§7.2, §8.2) #

                              noncomputable def Flemming2021.weightNoiseProb (x : Context) (w : Fin 6 → ℝ) (σ : ℝ) :
                              ℝ

                              The NHG probability of the schwa candidate under weight noise of standard deviation σ.

                              Equations
                              Instances For

                                The squared length of the violation difference (37) is the number of differing constraints, 4 with the *Clash difference and 3 without (Table 3).

                                theorem Flemming2021.probit_weightNoiseProb (x : Context) (w : Fin 6 → ℝ) {σ : ℝ} (hσ : 0 < σ) :
                                ProbabilityTheory.probit (weightNoiseProb x w σ) = harmonyDiff x w / (σ * √(if x.following = Following.monosyllable then 4 else 3))

                                The NHG probit of the schwa candidate is its harmony difference over σ_d (36).

                                theorem Flemming2021.probit_gain_following (u : Underlying) (o : Onset) (w : Fin 6 → ℝ) {σ : ℝ} (hσ : 0 < σ) :
                                ProbabilityTheory.probit (weightNoiseProb { underlying := u, onset := o, following := Following.monosyllable } w σ) - ProbabilityTheory.probit (weightNoiseProb { underlying := u, onset := o, following := Following.disyllable } w σ) = probitChange (harmonyDiff { underlying := u, onset := o, following := Following.disyllable } w) (w 2) (σ * √3) (2 * σ)

                                The probit gain from the *Clash violation is (38a) with Δh the weight of *Clash, σ_d = σ√3 and σ_d' = 2σ.

                                theorem Flemming2021.clash_gain_ordered (w : Fin 6 → ℝ) {σ : ℝ} (hσ : 0 < σ) (hw : 0 < w 3 + w 4) (hw' : w 3 + w 4 < w 1 - w 5) :
                                have gain := fun (u : Underlying) (o : Onset) => ProbabilityTheory.probit (weightNoiseProb { underlying := u, onset := o, following := Following.monosyllable } w σ) - ProbabilityTheory.probit (weightNoiseProb { underlying := u, onset := o, following := Following.disyllable } w σ); gain Underlying.schwa Onset.c < gain Underlying.zero Onset.c ∧ gain Underlying.zero Onset.cc < gain Underlying.schwa Onset.c ∧ gain Underlying.schwa Onset.cc < gain Underlying.zero Onset.cc

                                With positive weights and the Max and Dep effect below the *CCC one, the initial harmony differences of the four *Clash pairs are ordered 1 < 5 < 3 < 7, so NHG predicts their probit gains ordered 1-2 > 5-6 > 3-4 > 7-8, where the data show the same gain in three of the four (§8.2).

                                theorem Flemming2021.probit_gain_onset (u : Underlying) (f : Following) (w : Fin 6 → ℝ) {σ : ℝ} (hσ : 0 < σ) :
                                ProbabilityTheory.probit (weightNoiseProb { underlying := u, onset := Onset.cc, following := f } w σ) - ProbabilityTheory.probit (weightNoiseProb { underlying := u, onset := Onset.c, following := f } w σ) = (w 1 - w 5) / (σ * √(if f = Following.monosyllable then 4 else 3))

                                For the pairs differing in the preceding consonants, σ_d is unchanged, so the NHG probit gain is the rescaled harmony change (41): the same for words and clitics, larger before a monosyllable than before a disyllable.

                                The observed rates (Table 2) and the revised constraint set (§8.3) #

                                The observed rate of a context, in hundredths.

                                Equations
                                Instances For
                                  theorem Flemming2021.observedRate_following (u : Underlying) (o : Onset) :
                                  observedRate { underlying := u, onset := o, following := Following.disyllable } < observedRate { underlying := u, onset := o, following := Following.monosyllable }

                                  The schwa is pronounced more often before a monosyllable in every pair, as every model with a positive *Clash weight predicts.

                                  theorem Flemming2021.maxEntProb_following_lt (u : Underlying) (o : Onset) (w : Fin 6 → ℝ) (hw : 0 < w 2) :
                                  maxEntProb { underlying := u, onset := o, following := Following.disyllable } w < maxEntProb { underlying := u, onset := o, following := Following.monosyllable } w

                                  In MaxEnt a positive *Clash weight raises the schwa's probability.

                                  def Flemming2021.odds (x : Context) :
                                  ℚ

                                  The observed odds of the schwa.

                                  Equations
                                  Instances For
                                    theorem Flemming2021.onset_effect_larger_for_words (f : Following) :
                                    odds { underlying := Underlying.schwa, onset := Onset.cc, following := f } / odds { underlying := Underlying.schwa, onset := Onset.c, following := f } < odds { underlying := Underlying.zero, onset := Onset.cc, following := f } / odds { underlying := Underlying.zero, onset := Onset.c, following := f }

                                    The effect of the preceding consonants is larger in words than in clitics (§8.2). The odds ratio across *CCC is larger with underlying /∅/ than with /ə/, in both stress contexts. MaxEnt with Smith & Pater's constraints predicts equal odds ratios (logit_onset); this is the Max × *CCC interaction that motivates *CCC/iP.

                                    *CCC/iP (§8.3) penalizes a three-consonant cluster within one intermediate phrase, which the schwaless candidate forms after two consonants only in the word-final items.

                                    Equations
                                    Instances For

                                      Max and Dep collapsed into one correspondence constraint (§8.3).

                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For
                                        noncomputable def Flemming2021.harmonyDiffRevised (x : Context) (w : Fin 6 → ℝ) :
                                        ℝ

                                        hə − h∅ under the revised constraint set.

                                        Equations
                                        Instances For
                                          theorem Flemming2021.harmonyDiffRevised_onset (u : Underlying) (f : Following) (w : Fin 6 → ℝ) :
                                          harmonyDiffRevised { underlying := u, onset := Onset.cc, following := f } w - harmonyDiffRevised { underlying := u, onset := Onset.c, following := f } w = w 1 - w 5 + if u = Underlying.zero then w 2 else 0

                                          With *CCC/iP the effect of the preceding consonants on the harmony difference is larger in words by the weight of *CCC/iP, so a MaxEnt grammar can fit the interaction (§8.3).

                                          Three candidates (§9): tableau (45) #

                                          The tableau of (1), (3), (5) and (45) has the candidates a, b, c as 0, 1, 2.

                                          Equations
                                          Instances For
                                            noncomputable def Flemming2021.tableW :
                                            Fin 3 → ℝ

                                            The weights 15, 8, 8.

                                            Equations
                                            Instances For

                                              MaxEnt gives a the probability e⁻¹⁵ / (e⁻¹⁵ + 2e⁻¹⁶) = 1 / (1 + 2e⁻¹), 0.58, and b and c equal probabilities (5).

                                              theorem Flemming2021.table45_variance_covariance (v : NNReal) :
                                              ProbabilityTheory.variance (fun (η : Fin 3 → ℝ) => HarmonicGrammar.harmonyScore tableCon (tableW + η) 0 - HarmonicGrammar.harmonyScore tableCon (tableW + η) 1) (HarmonicGrammar.weightNoise (Fin 3) v) = 5 * ↑v ∧ ProbabilityTheory.variance (fun (η : Fin 3 → ℝ) => HarmonicGrammar.harmonyScore tableCon (tableW + η) 2 - HarmonicGrammar.harmonyScore tableCon (tableW + η) 1) (HarmonicGrammar.weightNoise (Fin 3) v) = 2 * ↑v ∧ ProbabilityTheory.covariance (fun (η : Fin 3 → ℝ) => HarmonicGrammar.harmonyScore tableCon (tableW + η) 0 - HarmonicGrammar.harmonyScore tableCon (tableW + η) 1) (fun (η : Fin 3 → ℝ) => HarmonicGrammar.harmonyScore tableCon (tableW + η) 2 - HarmonicGrammar.harmonyScore tableCon (tableW + η) 1) (HarmonicGrammar.weightNoise (Fin 3) v) = 2 * ↑v

                                              Under weight noise of variance v, the harmony differences of a and of c from b have variances 5v and 2v (14) and covariance 2v (§9), so their joint law is not determined by the harmonies. The paper computes by numerical integration that b and c, of equal harmony, then receive the probabilities 0.260 and 0.141.