From 621d438f0406058f8ba5a2d0c11c9a4477d6a951 Mon Sep 17 00:00:00 2001 From: Patrick Simianer
Date: Fri, 11 Dec 2015 15:45:52 +0100
Subject: overhauled debug view
---
views/debug.haml | 203 +++++++++++++++++++++++++++++++++----------------------
1 file changed, 124 insertions(+), 79 deletions(-)
(limited to 'views')
diff --git a/views/debug.haml b/views/debug.haml
index 013b7b1..1cda494 100644
--- a/views/debug.haml
+++ b/views/debug.haml
@@ -2,98 +2,135 @@
!!!
%html
%head
- %title debug view (session ##{session_key})
+ %title Debug view (Session ##{session_key})
%link(rel="stylesheet" type="text/css" href="debug.css")
%script{:src =>"http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js", :charset=>"utf-8"}
%script{:src => "http://postedit.cl.uni-heidelberg.de/js/debug.js"}
%body
- %h1 debug view
- %h2 session ##{session_key}
- - if data["kbest"].empty?
+ %h1 Debug view
+ %h2 Session [##{session_key}]
+ - if pairwise_ranking_data["kbest"].empty?
%p.red
%strong No data to show!
%ul
%li
- %a.ajax{:tgt => "/reset_progress", :href => "#"} reset progress
+ %a{ :href => "#controls" } Controls
%li
- %a.ajax{:tgt => "/reset_weights", :href => "#"} reset weights
+ %a{ :href => "#post_edit" } Post-edit & machine translation
%li
- %a.ajax{:tgt => "/reset_extractor", :href => "#"} reset extractor
+ %a{ :href => "#meta" } Meta
%li
- %a.ajax{:tgt => "/reset_add_rules", :href => "#"} reset add. rules
+ %a{ :href => "#rules" } Learned rules
%li
- %a.ajax{:tgt => "/shutdown", :href => "#"} shutdown
- %p#ajax_result
- %p
- %strong learning rate:
- %select
- - [1000,100,10,1,0.1,0.01,0.001,0.0001,0.00001,0.000001,0.0000001,0.00000001,0.000000001,0.0000000001].each do |i|
- %option{:value => i, :onclick => "window.open(\"http://\"+window.location.host+\"/set_learning_rate/#{i}\");"} #{i}
- %span | sparse features:
- %select
- - [1000,100,10,1,0.1,0.01,0.001,0.0001,0.00001,0.000001,0.0000001,0.00000001,0.000000001,0.0000000001].each do |i|
- %option{:value => i, :onclick => "window.open(\"http://\"+window.location.host+\"/set_sparse_learning_rate/#{i}\");"} #{i}
- %p#svg_b64 #{data2["svg"][data2["progress"]-1]}
+ %a{ :href => "#pairwise_ranking" } Pairwise ranking
+ %hr
+ /=#########################################################################
+ %h2#controls Controls
+ %h3 Reset
+ %p
+ %strong [Server reply]
+ %span#control_reply
+ %ul
+ %li
+ %a.ajax{:tgt => "/reset_progress", :href => "#controls"} Reset progress
+ %li
+ %a.ajax{:tgt => "/reset_weights", :href => "#controls"} Reset weights
+ %li
+ %a.ajax{:tgt => "/reset_extractor", :href => "#controls"} Reset extractor
+ %li
+ %a.ajax{:tgt => "/reset_new_rules", :href => "#controls"} Reset new rules
+ %li
+ %a.ajax{:tgt => "/shutdown", :href => "#controls"} Initiate shutdown
+ %h3 Learning rate
+ %p Default for dense features: 1.0, for sparse features: 1.0e-05
+ %select
+ - [1000,100,10,1,0.1,0.01,0.001,0.0001,0.00001,0.000001,0.0000001,0.00000001,0.000000001,0.0000000001].each do |i|
+ %option.ajax{:value => i, :tgt => "/set_learning_rate/#{i}"} #{i}
+ %em dense features
+ %select
+ - [1000,100,10,1,0.1,0.01,0.001,0.0001,0.00001,0.000001,0.0000001,0.00000001,0.000000001,0.0000000001].each do |i|
+ %option.ajax{:value => i, :tgt => "/set_learning_rate/sparse/#{i}"} #{i}
+ %em sparse features
+ %p
+ %a{ :href => "#" } ^ up
+ %hr
+ /=#########################################################################
+ %h2#post_edit Post-edit & machine translation
+ %p#svg_b64 #{data["svg"][progress]}
%div#svg
%table
%tr
%td.noborder
%strong progress:
- %td.left #{[0,data2["progress"]-1].max}
+ %td.left #{[0,progress].max}
%tr
%td.noborder
- %strong source:
- %td.left #{data2["source_segments"][[0,data2["progress"]-1].max]}
+ %strong MT Input
+ %td.left #{data["source_segments"][[0,progress].max]}
%tr
%td.noborder
- %strong source (original):
- %td.left #{data2["raw_source_segments"][[0,data2["progress"]-1].max]}
+ %strong Raw source
+ %td.left #{data["raw_source_segments"][[0,progress].max]}
%tr
%td.noborder
- %strong post-edit:
- %td.left #{data2["post_edits_raw"][data2["progress"]-1]}
+ %strong Post-edit
+ %td.left #{data["post_edits_raw"][progress]}
%tr
%td.noborder
- %strong post-edit (processed):
- %td.left #{data2["post_edits"][data2["progress"]-1]}
+ %strong Post-edit (processed)
+ %td.left #{data["post_edits"][progress]}
%tr
%td.noborder
- %strong original mt:
- %td.left #{data2["mt_raw"][data2["progress"]-1]}
+ %strong Original MT
+ %td.left #{data["mt_raw"][progress]}
%tr
%td.noborder
- %strong shown mt:
- %td.left #{data2["mt"][data2["progress"]-1]}
+ %strong Displayed MT
+ %td.left #{data["mt"][progress]}
%tr
%td.noborder
- %strong best match (bleu=#{data["best_match_score"]}):
- %td.left #{data["best_match"]}
- %h2 derivation
- %pre #{data2["derivations"][data2["progress"]-1]}
+ %strong Best match (BLEU=#{(pairwise_ranking_data["best_match_score"]*100).round(2)}%)
+ %td.left #{pairwise_ranking_data["best_match"]}
+ %h2 Derivation
+ %pre #{data["derivations"][progress]}
+ %h3 Processed
+ - if data["derivations_proc"][progress]
+ %pre #{JSON.pretty_generate(JSON.parse(data["derivations_proc"][progress]))}
+ %h2 Client reply
+ - if data["feedback"][progress]
+ %pre #{JSON.pretty_generate(JSON.parse(data["feedback"][progress]))}
+ %p
+ %a{ :href => "#" } ^ up
+ %hr
+ /=#########################################################################
+ %h2#meta Meta
+ %p k: #{pairwise_ranking_data["samples_size"]}
+ %p number of updates: #{pairwise_ranking_data["num_up"]}
+ %p updated features: #{pairwise_ranking_data["updated_features"]}
+ %p learning rate: #{pairwise_ranking_data["learning_rate"]}
+ %p learning rate (sparse): #{pairwise_ranking_data["learning_rate_sparse"]}
+ %p duration: #{data["durations"][progress]}ms
+ %p updated: #{data["updated"][progress]}
%p
- %strong processed
- - if data2["derivations_proc"][data2["progress"]-1]
- %pre #{JSON.pretty_generate(JSON.parse(data2["derivations_proc"][data2["progress"]-1]))}
- %h2 manual update
- - if data2["feedback"][data2["progress"]-1]
- %pre #{JSON.pretty_generate(JSON.parse(data2["feedback"][data2["progress"]-1]))}
- %h2 meta
- %p k: #{data["samples_size"]}
- %p number of updates: #{data["num_up"]}
- %p updated features: #{data["updated_features"]}
- %p learning rate: #{data["learning_rate"]}
- %p learning rate (sparse): #{data["learning_rate_sparse"]}
- %p duration: #{data2["durations"][data2["progress"].to_i-1]}ms
- %p updated: #{data2["updated"][data2["progress"].to_i-1]}
- %h2
- additional rules (forced rules)
+ %a{ :href => "#" } ^ up
+ %hr
+ /=#########################################################################
+ %h2#rules New & known rules
%pre #{additional_rules.join("\n")}
- %h2 k-best
- %p bleu | model score | original rank | \|e\| | translation \n features
- %p.red update needed ("any of the above hypotheses has a lower model score")
+ %h3
+ Rejected [known] rules
+ %pre #{rejected_rules.join("\n")}
+ %p
+ %a{ :href => "#" } ^ up
+ %hr
+ /=#########################################################################
+ %h2#pairwise_ranking Pairwise ranking updates
+ %h3 K-best list
+ %pre [BLEU score | Model score | Original rank | \|e\| | Translation \n Features]
+ %p.red In red: Update needed, i.e. "any of the above hypotheses has a lower model score"
%ol
- kbest = []
- - data["kbest"].each { |i| x=splitpipe(i); kbest << [ x[0].to_f, x[1].to_f, x[2].to_i, x[3], x[4] ] }
+ - pairwise_ranking_data["kbest"].each { |i| x=splitpipe(i); kbest << [ x[0].to_f, x[1].to_f, x[2].to_i, x[3], x[4] ] }
- kbest.sort! { |i,j| j[0] <=> i[0] }
- kbest.each_with_index do |k,j|
- b = kbest[0,j].map { |l| l[0]>k[0] && l[1]