<commit_before>%h1 Experiments

- i = 0
- @stats.each do |test|
  - i += 1
  .experimentname
    = test[:name]
  .experimentdetails
    (goal: #{test[:goal]}) #{test[:trials]} trials
  .experimenttrash
    .btn{onclick: "document.getElementById('trashinfo#{i}').style.display='block'"}
      Trash
  
  .experimenttrashdata{id: "trashinfo#{i}"}
    - test[:arms].each do |arm|
      REDIS.del("whiplash/#{test[:name]}/#{arm[:name]}/spins")
      REDIS.del("whiplash/#{test[:name]}/#{arm[:name]}/wins")
  

  %table.table.table-striped.table-condensed.experiment_table.sortable
    %thead
      %tr
        %th
        %th % Tried
        %th.name Variable
        %th Spins
        %th Wins
        %th % Success
        %th
    %tbody
      - test[:arms].each do |arm|
        %tr
          %td
            .progress.progress-info
              .bar{ style: "width: #{float_to_percentage(arm[:spins]/test[:trials].to_f)}" }
          %td= float_to_percentage(arm[:spins]/test[:trials].to_f)
          %td.name= arm[:name]
          %td= arm[:spins]
          %td= arm[:wins]
          %td= float_to_percentage(arm[:wins]/arm[:spins].to_f)
          %td
            .progress.progress-success
              .bar{ style: "width: #{float_to_percentage(arm[:wins]/arm[:spins].to_f)}" }

%h2
  Email response by hour

%table
  %tr
    %th
      Response rate to emails by hour sent
    %th
      Signatures on emails sent by hour signed
  %tr
    %td
      #hourchart1{style: "width:600px;height:300px"}
    %td
      #hourchart2{style: "width:600px;height:300px"}

- content_for(:javascripts) do 
  $.plot($("#hourchart1"), [[
  - @hourlydata1[0].keys.sort.each do |h|
    [
    =h
    ,
    =@hourlydata1[1][h]/@hourlydata1[0][h].to_f
    ],
  ]], {
  series: {
  lines: {show: true, fill: true},
  points: {show: true, fill: true}}})
  $.plot($("#hourchart2"), [[
  - @hourlydata2.keys.sort.each do |h|
    [
    =h<commit_msg>fix crash in admin/experiments when you don't have any data<commit_after>%h1 Experiments

- i = 0
- @stats.each do |test|
  - i += 1
  .experimentname
    = test[:name]
  .experimentdetails
    (goal: #{test[:goal]}) #{test[:trials]} trials
  .experimenttrash
    .btn{onclick: "document.getElementById('trashinfo#{i}').style.display='block'"}
      Trash
  
  .experimenttrashdata{id: "trashinfo#{i}"}
    - test[:arms].each do |arm|
      REDIS.del("whiplash/#{test[:name]}/#{arm[:name]}/spins")
      REDIS.del("whiplash/#{test[:name]}/#{arm[:name]}/wins")
  

  %table.table.table-striped.table-condensed.experiment_table.sortable
    %thead
      %tr
        %th
        %th % Tried
        %th.name Variable
        %th Spins
        %th Wins
        %th % Success
        %th
    %tbody
      - test[:arms].each do |arm|
        %tr
          %td
            .progress.progress-info
              .bar{ style: "width: #{float_to_percentage(arm[:spins]/test[:trials].to_f)}" }
          %td= float_to_percentage(arm[:spins]/test[:trials].to_f)
          %td.name= arm[:name]
          %td= arm[:spins]
          %td= arm[:wins]
          %td= float_to_percentage(arm[:wins]/arm[:spins].to_f)
          %td
            .progress.progress-success
              .bar{ style: "width: #{float_to_percentage(arm[:wins]/arm[:spins].to_f)}" }

%h2
  Email response by hour

%table
  %tr
    %th
      Response rate to emails by hour sent
    %th
      Signatures on emails sent by hour signed
  %tr
    %td
      #hourchart1{style: "width:600px;height:300px"}
    %td
      #hourchart2{style: "width:600px;height:300px"}

- content_for(:javascripts) do 
  $.plot($("#hourchart1"), [[
  - @hourlydata1[0].keys.sort.each do |h|
    [
    =h
    ,
    =(@hourlydata1[1][h]||0)/@hourlydata1[0][h].to_f
    ],
  ]], {
  series: {
  lines: {show: true, fill: true},
  points: {show: true, fill: true}}})
  $.plot($("#hourchart2"), [[
  - @hourlydata2.keys.sort.each do |h|
    [
    =h
{'fraction_non_alphanumeric': 0.1757622341788368, 'fraction_numerical': 0.014091724314629772, 'mean_word_length': 2.439647577092511, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1777908', 'n_tokens_mistral': 1488, 'n_tokens_neox': 1448, 'n_words': 254}