<commit_before>---
layout: page
---

The task was to compute the change in proportion of visitors who will see an element in its current location vs a proposed location.  

I suggested a gamma distribution to compute probabilities, but it is easier to use that data as an empirical distribution than to attempt to back-fit the data to a set of shape parameters.  

I can use the gamma to simulate one group of scroll data for each of 10 accounts:  


```r
scroller <- function(n=50) round(rgamma(n, runif(1, 2, 2.25), runif(1, 3.25, 3.5)) * 500) + 500
hScroll <- function(scrolls) hist(scrolls, breaks=seq(0, 2500, by=25), plot=FALSE)

tenaccts <- replicate(10, scroller(round(runif(1, 50, 85))), simplify=FALSE)
htenaccts <- lapply(tenaccts, hScroll)
htenaccts.mat <- do.call(rbind, lapply(htenaccts, function(x) cumsum(x$counts)))
# Also a blue color palette
blues <- colorRampPalette(colors=c('darkblue', 'white'))
```

In the image below, the 'fold' is a red line, the line at 'A' is the location or an element now, the line at 'B' is the proposed location.  

<commit_msg>page style<commit_after>---
layout: page
---

2018-08-17  

The task was to compute the change in proportion of visitors who will see an element in its current location vs a proposed location.  

Yesterday I suggested a gamma distribution to compute probabilities, but it is easier to use the  data as an empirical distribution rather than attempt to back-fit the data to a set of shape parameters.  

I can use the gamma to simulate one group of scroll data for each of 10 accounts:  


```r
scroller <- function(n=50) round(rgamma(n, runif(1, 2, 2.25), runif(1, 3.25, 3.5)) * 500) + 500
hScroll <- function(scrolls) hist(scrolls, breaks=seq(0, 2500, by=25), plot=FALSE)

tenaccts <- replicate(10, scroller(round(runif(1, 50, 85))), simplify=FALSE)
htenaccts <- lapply(tenaccts, hScroll)
htenaccts.mat <- do.call(rbind, lapply(htenaccts, function(x) cumsum(x$counts)))
# Also a blue color palette
blues <- colorRampPalette(colors=c('darkblue', 'white'))
```

In the image below, the 'fold' is a red line, the line at 'A' is the location or an element now, the line at 'B' is the proposed location.  


{'fraction_non_alphanumeric': 0.10922441486920606, 'fraction_numerical': 0.03579623680587425, 'mean_word_length': 4.45, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5733600', 'n_tokens_mistral': 786, 'n_tokens_neox': 698, 'n_words': 297}