summaryrefslogtreecommitdiff
path: root/views/batch.haml
diff options
context:
space:
mode:
Diffstat (limited to 'views/batch.haml')
-rw-r--r--views/batch.haml15
1 files changed, 9 insertions, 6 deletions
diff --git a/views/batch.haml b/views/batch.haml
index ec987c4..9bfa67e 100644
--- a/views/batch.haml
+++ b/views/batch.haml
@@ -18,6 +18,7 @@
/ key = compound, values = array of arrays with model, prediction
- @batch.each do |key, values|
- compound = key
+ - mw = compound.molecular_weight
%tr
%td{:style=>"vertical-align:top;"}
%p= compound.svg
@@ -32,10 +33,13 @@
%p
- if prediction[:confidence] == "measured"
%p
- / TODO fix scientific notation from database
- %b Measured activity:
- = prediction[:value].numeric? ? "#{prediction[:value].round(3)} (#{model.unit})" : prediction[:value]
- %p Compound is part of the training dataset
+ %b Measured activity:
+ - if prediction[:value].is_a?(Array)
+ = prediction[:value][0].numeric? ? prediction[:value].collect{|v| weight = compound.mmol_to_mg(v, mw); '%.2e' % v + " (#{model.unit})"+" | #{'%.2e' % weight} (mg/kg_bw/day)"}.join("</br>") : prediction[:value].join(", ")
+ - else
+ = prediction[:value].numeric? ? "#{'%.2e' % prediction[:value]} (#{model.unit}) | #{'%.2e' % compound.mmol_to_mg(prediction[:value], mw)} (mg/kg_bw/day)" : prediction[:value]
+ %p
+ %b Compound is part of the training dataset
- elsif prediction[:neighbors].size > 0
%p
/ model type (classification|regression)
@@ -43,8 +47,7 @@
= model.model.class.to_s.match("Classification") ? "Classification" : "Regression"
%br
%b Prediction:
- / TODO scientific notation
- = prediction[:value].numeric? ? "#{'%.2e' % prediction[:value]} (#{model.unit})" : prediction[:value]
+ = prediction[:value].numeric? ? "#{'%.2e' % prediction[:value]} (#{model.unit}) | #{'%.2e' % compound.mmol_to_mg(prediction[:value], mw)} (mg/kg_bw/day)" : prediction[:value]
%br
/ TODO probability
%b Confidence: