summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrautenberg <rautenberg@in-silico.ch>2016-09-14 16:45:03 +0200
committerrautenberg <rautenberg@in-silico.ch>2016-09-14 16:45:03 +0200
commit76e80aa9f157a2efac5a7b02d710af3b380049e2 (patch)
tree1223ae2c82dffbc91ba7b3a3acb5254ae367bdfb
parent6c48f5e40457ed0b363b82606fd8c68282e41cbb (diff)
refine HTML for validation details
-rw-r--r--lib/report.rb2
-rw-r--r--views/model_details.haml34
2 files changed, 18 insertions, 18 deletions
diff --git a/lib/report.rb b/lib/report.rb
index aec30cd..7863707 100644
--- a/lib/report.rb
+++ b/lib/report.rb
@@ -150,7 +150,7 @@ get "/report/:id/?" do
if prediction_model.crossvalidations
crossvalidations = prediction_model.crossvalidations
out = haml File.read(validation_template), :layout=> false, :locals => {:model => prediction_model}
- report.value "lmo", CGI.escapeHTML(out)
+ report.value "lmo", out
end
# output
diff --git a/views/model_details.haml b/views/model_details.haml
index 42cf693..470f5b0 100644
--- a/views/model_details.haml
+++ b/views/model_details.haml
@@ -2,18 +2,18 @@
%head
%body
%b Model:
-
+ %br
Source:
= model.source
-
+ %br
- model.classification? ? type = "Classification" : type = "Regression"
= "Type:\t"
= type
-
+ %br
- training_dataset = OpenTox::Dataset.find model.training_dataset.id
= "Training compounds:\t"
= training_dataset.compounds.size
-
+ %br
- if type == "Classification"
%b Independent crossvalidations:
- else
@@ -21,34 +21,34 @@
- model.crossvalidations.each do |crossvalidation|
= "Num folds:\t"
= crossvalidation.folds
-
+ %br
= "Num instances:\t"
= crossvalidation.nr_instances
-
+ %br
= "Num unpredicted"
= crossvalidation.nr_unpredicted
- if model.classification?
-
+ %br
= "Accuracy:\t"
= crossvalidation.accuracy.round(3) if crossvalidation.accuracy
-
+ %br
- if crossvalidation.true_rate
= "True positive rate:\t"
= crossvalidation.true_rate["active"].round(3) if crossvalidation.true_rate["active"]
-
+ %br
= "True negative rate:\t"
= crossvalidation.true_rate["inactive"].round(3) if crossvalidation.true_rate["inactive"]
-
+ %br
- if crossvalidation.predictivity
= "Positive predictive value:\t"
= crossvalidation.predictivity["active"].round(3) if crossvalidation.predictivity["active"]
-
+ %br
= "Negative predictive value:\t"
= crossvalidation.predictivity["inactive"].round(3) if crossvalidation.predictivity["inactive"]
-
+ %br
%b Confusion Matrix:
- %table{:style=>"width:20%;"}
+ %table{:class => "table table-condensed table-borderless", :style=>"width:20%;"}
%tbody
%tr
%td
@@ -97,16 +97,16 @@
/%p.plot
/ %img{:src=>"confp#{crossvalidation.id}.svg"}
- if model.regression?
-
+ %br
= "Root mean squared error:\t"
= crossvalidation.rmse.round(3) if crossvalidation.rmse
-
+ %br
= "Mean absolute error:\t"
= crossvalidation.mae.round(3) if crossvalidation.mae
-
+ %br
= "R square:\t"
= crossvalidation.r_squared.round(3) if crossvalidation.r_squared
-
+ %br
/= "Confidence plot:"
/%p.plot
/ %img{:src=>"/confp#{crossvalidation.id}.svg"}