Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calculating score of layout with minor tweaks #69

Open
spamwax opened this issue Sep 29, 2023 · 5 comments
Open

calculating score of layout with minor tweaks #69

spamwax opened this issue Sep 29, 2023 · 5 comments

Comments

@spamwax
Copy link

spamwax commented Sep 29, 2023

I was just wondering how I can run your code to calculate the score of default layout with 1 or 2 keys moved and/or swapped.

Given the higher frequency of letter G compared to J/K, and bigrams such as gh and ing, I wanted to know why it got assigned to current position (lower row of left pinky!!!).
What if we swap G and Y, or G and J, or G and K? what would be the score compared to the original layout?

@binarybottle
Copy link
Owner

binarybottle commented Sep 29, 2023

The following is from the jupyter notebook under "Test 5" and is used to score layout variants/tweaks:

https://github.com/binarybottle/engram/blob/master/engram_layout_v2.0.ipynb

layouts_26letters = [
['B','Y','O','U','C','I','E','A','G','X','J','K','L','D','W','V','H','T','S','N','R','M','F','P', '-','-','-', '-','-','-', 'Z','Q'],
['B','Y','O','U','C','I','E','A','G','X','J','K','L','D','W','V','H','T','S','N','R','M','F','P', '-','-','-', '-','-','-', 'Q','Z'],
['V','W','D','L','N','S','T','H','P','F','M','R','U','O','Y','B','A','E','I','C','K','J','X','G', '-','-','-', '-','-','-', 'Z','Q'],
['V','W','D','L','N','S','T','H','P','F','M','R','U','O','Y','B','A','E','I','C','K','J','X','G', '-','-','-', '-','-','-', 'Q','Z']]
data_matrix = Factors32x32
scores_26letters = []
for layout_26letters in layouts_26letters:
scores_26letters.append(score_layout(data_matrix, layout_26letters, bigrams, bigram_frequencies, verbose=False))

scores_26letters_sorted, ranks_26letters_sorted, Isort_26letters = rank_within_epsilon(scores_26letters,
factor32, factor=True, verbose=False)
print('\n Rank Score')
for i, rank in enumerate(ranks_26letters_sorted):
layout_string = layouts_26letters[Isort_26letters[i]]
layout = ' '.join(layout_string)
print(' {0}: {1} {2}'.format(rank, layout, scores_26letters_sorted[i]))

print('')
print_layout24(layouts_26letters[0])

Rank Score
1: B Y O U C I E A G X J K L D W V H T S N R M F P - - - - - - Z Q 0.621987268013091
1: B Y O U C I E A G X J K L D W V H T S N R M F P - - - - - - Q Z 0.6219870422703005
1: V W D L N S T H P F M R U O Y B A E I C K J X G - - - - - - Q Z 0.6219847143830128
1: V W D L N S T H P F M R U O Y B A E I C K J X G - - - - - - Z Q 0.6219774708803041

@binarybottle
Copy link
Owner

binarybottle commented Sep 29, 2023

Or better still, run the comparison jupyter notebook, and at the bottom, tweak to your heart's content!:

https://github.com/binarybottle/engram/blob/master/compare_layouts.ipynb

# Workspace for manual comparisons
layouts_26letters = [
    ['B','Y','O','U','C','I','E','A','G','X','J','K','L','D','W','V','H','T','S','N','R','M','F','P', "'",',','-', '"','.','?', 'Z','Q'],
    ['W','Y','O','U','C','I','E','A','G','P','J','K', 'V','L','D','X','H','T','S','N','R','M','F','B', "'",',','-', '"','.','?', 'Z','Q']]

data_matrix = Factors32x32
scores_26letters = []
for layout_26letters in layouts_26letters:
    scores_26letters.append(score_layout(data_matrix, layout_26letters, bigrams, bigram_frequencies, verbose=False))

scores_26letters_sorted, ranks_26letters_sorted, Isort_26letters = rank_within_epsilon(scores_26letters, 
                                                                        factor32, factor=True, verbose=False)
print('\n    Rank                                                                   Score')
for i, rank in enumerate(ranks_26letters_sorted):
    layout_string = layouts_26letters[Isort_26letters[i]]
    layout = ' '.join(layout_string)
    print('    {0}:  {1}    {2}'.format(rank, layout, scores_26letters_sorted[i]))

@spamwax
Copy link
Author

spamwax commented Sep 30, 2023

Thanks 🙏

@sunaku
Copy link
Contributor

sunaku commented Oct 7, 2023

This is an excellent question:

Given the higher frequency of letter G compared to J/K, and bigrams such as gh and ing, I wanted to know why it got assigned to current position (lower row of left pinky!!!).

I think the answer is inward rolls! ✨ Since G is more frequent than J/K, its placement on the pinky finger allows it to engage with the vowel cluster for inward rolls: git, get, gat, got, gut. Consequently, if we were to swap G with J or K as you suggested*, that may result in suboptimal G + vowel bigrams for most vowels compared to the infrequent J and K letters taking G's place:

  • Swapping G with J:

    • get and got would have same-finger bigrams
    • git would contain an outward roll (G -> I)
  • Swapping G with K:

    • gut and gat would have same-finger bigrams
    • git, get, got would contain outward rolls

*Great idea by the way! 🤩 I was consumed by this possibility until I realized the significance of placing G on the pinky finger.

@binarybottle
Copy link
Owner

binarybottle commented Oct 7, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants