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
- fresh clone of repository:
git clone https://github.com/dariogoetz/keyboard_layout_optimizer.git
cd keyboard_layout_optimizer
cargo build --release
- 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
- Create normalized default ngrams:
python scripts/ngrams/normalize.py ngrams/deu_mixed_wiki_web_0.6_eng_news_typical_wiki_web_0.4_norm
- 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
- 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.
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
git clone https://github.com/dariogoetz/keyboard_layout_optimizer.gitcd keyboard_layout_optimizercargo build --releasecp -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_normpython scripts/ngrams/normalize.py ngrams/deu_mixed_wiki_web_0.6_eng_news_typical_wiki_web_0.4_norm./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
./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.