Skip to content

Total cost of irregularity is affected by nomalization of ngram weights (using normalize.py) #90

Description

@fredsilon

Issue

Default ngrams are compared, one time not normalized, one time normalized using normalize.py. The resulting irregularity cost are expected to be equal, because the relative n-grams' distribution is unaffected by the normalization script. However, currently this is not the case.

Steps to reproduce

  1. fresh clone of repository: git clone https://github.com/dariogoetz/keyboard_layout_optimizer.git
  2. cd keyboard_layout_optimizer
  3. cargo build --release
  4. Prepare normalization (copy default ngrams)
    cp -r ngrams/deu_mixed_wiki_web_0.6_eng_news_typical_wiki_web_0.4 ngrams/deu_mixed_wiki_web_0.6_eng_news_typical_wiki_web_0.4_norm
  5. Create normalized default ngrams:
    python scripts/ngrams/normalize.py ngrams/deu_mixed_wiki_web_0.6_eng_news_typical_wiki_web_0.4_norm
  6. Evaluate default ngrams (here for noted layout)
    ./target/release/evaluate -n ngrams/deu_mixed_wiki_web_0.6_eng_news_typical_wiki_web_0.4 "zyuaqpbmlfjßcsieodtnrhvxüäöwg,.k"
    Irregularity Cost: 11.17
  7. Evaluate normalized default ngrams (here for noted layout)
    ./target/release/evaluate -n ngrams/deu_mixed_wiki_web_0.6_eng_news_typical_wiki_web_0.4_norm "zyuaqpbmlfjßcsieodtnrhvxüäöwg,.k"
    Irregularity Cost: 16.93

Assumption of cause

I think there is an issue with layout_evaluation/src/metrics/trigram_metrics/irregularity.rs:

The sqrt not only affects the cost but somehow also the weighting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions