From 42dbd3c3583bd9862d351e32f8446a75fab4a516 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Mon, 19 Jul 2010 12:13:18 +0200 Subject: html representation of prediction added --- views/prediction.haml | 133 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 views/prediction.haml diff --git a/views/prediction.haml b/views/prediction.haml new file mode 100644 index 0000000..0187f87 --- /dev/null +++ b/views/prediction.haml @@ -0,0 +1,133 @@ +.predictions + %table + %tr + %th= @title.gsub(/_lazar_.*$/,' ').capitalize + %th Prediction + %th + %a{:href => "#", :id => "linkConfidence#{p.object_id}"} Confidence + :javascript + $("a#linkConfidence#{p.object_id}").click(function () { + $("dl#confidence").toggle(); + }); + %th Relevant features + %tr + %th + %img{:src => @compound.image_uri, :alt => @compound.smiles} + %td + - if @measured_activities + %br + - @measured_activities.each do |a| + - if activity(a) == 'active' + .active + = activity(a) + - elsif activity(a) == 'inactive' + .inactive + = activity(a) + - else + = a + %br + ( + %a{:href => "#", :id => "linkTrainingData#{p.object_id}"} Training data + :javascript + $("a#linkTrainingData#{p.object_id}").click(function () { + $("dl#training_data").toggle(); + }); + ) + + - else + - if activity(@activity) == 'active' + .active + = activity(@activity) + - elsif activity(@activity) == 'inactive' + .inactive + = activity(@activity) + - elsif @activity.is_a?(Float) + .other + = sprintf('%.03g', @activity) + - else + .other + %em= @activity.to_s + %td + = sprintf('%.03g', @confidence.to_f.abs) if @confidence + %td + %table + %tr + %th{:colspan => 2} activating + %th p value + - if @features[:activating] + - @features[:activating].sort{|a,b| b.last <=> a.last }.each do |f| + %tr + %th= f[0] + %td= f[1] + %tr + %th{:colspan => 2} deactivating + %th p value + - if @features[:deactivating] + - @features[:deactivating].sort{|a,b| b.last <=> a.last }.each do |f| + %tr + %th= f[0] + %td= f[1] + %tr + %th Neighbors + %th Activity + %th Similarity (activity specific) + %th Relevant features + - @neighbors.sort{|a,b| b.last[:similarity] <=> a.last[:similarity]}.each do |uri,data| + - c = OpenTox::Compound.new(:uri => uri) + %tr + %th + %br= c.smiles + %br + %a{:href => c.image_uri, :target => "_blank"} Image + %br + %img{:src => c.image_uri, :alt => c.smiles} + %td + - data[:activities].each do |act| + - if activity(act) == 'active' + .active + = activity(act) + - elsif activity(act) == 'inactive' + .inactive + = activity(act) + - elsif act.is_a?(Float) + .other + = sprintf('%.03g', act) + - else + .other + %em= act.to_s + %td + = sprintf('%.03g', data[:similarity]) + %td + %table + %tr + %th{:colspan => 2} activating + %th p value + -#%td= data[:features].inspect + -# data[:features][:activating].each do |f| + - data[:features][:activating].sort{|a,b| b.last[:p_value] <=> a.last[:p_value] }.each do |f| + -# f.inspect + %tr + %th= f[:smarts] + %td= f[:p_value] + %td=# f[:p_value] + %tr + %th{:colspan => 2} deactivating + %th p value + -# data[:features][:deactivating].sort{|a,b| b.last[:p_value] <=> a.last[:p_value] }.each do |f| + - data[:features][:deactivating].each do |f| + %tr + %th= f[:smarts] + %td= f[:p_value] + + + +%dl#confidence{ :style => "display: none;" } + %dt Confidence: + %dd Indicates the applicability domain of a model. Predictions with a high confidence can be expected to be more reliable than predictions with low confidence. Confidence values may take any value between 0 and 1. For most models confidence > 0.025 is a sensible (hard) cutoff to distiguish between reliable and unreliable predictions. + + +%dl#training_data{ :style => "display: none;" } + %dt Training data: + %dd Experimental result(s) from the training dataset are displayed here. + + -- cgit v1.2.3