From 76e80aa9f157a2efac5a7b02d710af3b380049e2 Mon Sep 17 00:00:00 2001 From: rautenberg Date: Wed, 14 Sep 2016 16:45:03 +0200 Subject: refine HTML for validation details --- lib/report.rb | 2 +- views/model_details.haml | 34 +++++++++++++++++----------------- 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"} -- cgit v1.2.3