summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2019-07-18 13:55:40 +0000
committergebele <gebele@in-silico.ch>2019-07-18 13:55:40 +0000
commit87fc7e8997306f7edb74d5282ad337c5c3c48b1c (patch)
tree8f6ede95232138acfb136165614906fab8b789e9
parente0985405e2fdb0fe8c4740ccb256d3ac2d1fd5be (diff)
removed awstats;model details without separation buttons;restructured details table;adjust info with warning;reordered positive first
-rw-r--r--views/layout.haml1
-rw-r--r--views/model_details.haml85
-rw-r--r--views/neighbors.haml9
-rw-r--r--views/prediction.haml19
4 files changed, 59 insertions, 55 deletions
diff --git a/views/layout.haml b/views/layout.haml
index 22a8583..1fe3813 100644
--- a/views/layout.haml
+++ b/views/layout.haml
@@ -15,7 +15,6 @@
%script{:src=>"/javascripts/lazar-gui.js"}
%script{ :src=>"/javascripts/bootstrap.js"}
%script{:src=>"/javascripts/pagination.min.js"}
- %script{:src=>"/javascripts/google_analytics_lazar.js"}
%body
%noscript
%div{ :style=>"width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif"}
diff --git a/views/model_details.haml b/views/model_details.haml
index 2d7a693..714d4d8 100644
--- a/views/model_details.haml
+++ b/views/model_details.haml
@@ -48,34 +48,42 @@
%p.card-text
- if model.classification?
/ accuracy, confusion matrixes
- - av = cv.accept_values
+ - accept_values = cv.accept_values
+ - av = []
+ - if accept_values[1] =~ /^non/
+ - av << accept_values[0]
+ - av << accept_values[1]
+ - else
+ - av = accept_values
- keys = cv.accuracy.collect{|key, value| key}
- acc = cv.accuracy.collect{|key, value| value.signif(3)}
- tpr = cv.true_rate.collect{|key, hash| hash[av[0]].signif(3)}
- fpr = cv.true_rate.collect{|key, hash| hash[av[1]].signif(3)}
- pp = cv.predictivity.collect{|key, hash| hash[av[0]].signif(3)}
- np = cv.predictivity.collect{|key, hash| hash[av[1]].signif(3)}
- %table.table.table-borderless.table-responsive
+ %table.table.table-bordered.table-responsive.text-center.bg-white
%tr
- %td.text-center
+ %td.text-center.bg-light
= "Nr.#{idx+1}"
- %td Accuracy
+ %td
+ %a{:href=>"https://en.wikipedia.org/wiki/Accuracy_and_precision", :rel=>"external"}
+ Accuracy
%td
%a{:href=>"https://en.wikipedia.org/wiki/Sensitivity_and_specificity", :rel=>"external"}
- True #{av[0] =~ /^non/ ? "negative" : "positive"} rate
+ True positive rate (Sensitivity, Recall)
%td
%a{:href=>"https://en.wikipedia.org/wiki/Sensitivity_and_specificity", :rel=>"external"}
- True #{av[1] =~ /^non/ ? "negative" : "positive"} rate
+ True negative rate (Specificity)
%td
%a{:href=>"https://en.wikipedia.org/wiki/Positive_and_negative_predictive_values", :rel=>"external"}
- #{av[0] =~ /^non/ ? "Negative" : "Positive"} predictiv value
+ Positive predictive value (Precision)
%td
%a{:href=>"https://en.wikipedia.org/wiki/Positive_and_negative_predictive_values", :rel=>"external"}
- #{av[1] =~ /^non/ ? "Negative" : "Positive"} predictiv value
+ Negative predictive value
- keys.each_with_index do |key,idx|
%tr
/ keys
- %td.fit.text-right.pr-0= key.gsub("_", " ")
+ %td.fit.text-right= key.gsub("_", " ")
/ acc,accuray value:
%td= acc[idx]
/ tpr,true positive rate
@@ -86,52 +94,48 @@
%td= pp[idx]
/ np,negative predictions
%td= np[idx]
- %div.row
- %button.btn.btn-outline-info.mx-auto{:type=>"button", :data=>{:toggle=>"collapse", :target=>"#pplot#{model.id}#{idx}"}, :aria=>{:expanded=>"false", :controls=>"pplot#{model.id}#{idx}"}, :style=>"font-size:small;"}
- Probability plot
- %button.btn.btn-outline-info.mx-auto{:type=>"button", :data=>{:toggle=>"collapse", :target=>"#matrix#{model.id}#{idx}"}, :aria=>{:expanded=>"false", :controls=>"matrix#{model.id}#{idx}"}, :style=>"font-size:small;"}
- Confusion matrix
- %div.collapse{:id=>"matrix#{model.id}#{idx}"}
+ %div.row.justify-content-center
+ %h6 Confusion matrix
+ %div.row{:id=>"matrix#{model.id}#{idx}"}
%table.table.table-borderless.table-responsive
%tr
%td.fit.text-center all
%td.fit.text-center confidence high
%td.fit.text-center confidence low
- %tr
+ %tr.justify-content-around
/ confusion matrix
- keys.each do |key|
- matrix = cv.confusion_matrix[key]
- %td.fit.text-right
- %table.table-sm
+ %td
+ %table.table-sm.text-center
%tr
%td
%td
- %td
- %h6 actual
+ %td actual
%td
%tr
%td
%td
- %td active
- %td inactive
+ %td.border.bg-secondary.text-white active
+ %td.border.bg-secondary.text-white inactive
%tr
- %td
- %h6 predicted
- %td active
- %td
- = matrix[0][0]
- %td
+ %td predicted
+ %td.border.bg-secondary.text-white active
+ %td.border.bg-white
+ %b= matrix[0][0]
+ %td.border.bg-white
= matrix[0][1]
%tr
%td
- %td inactive
- %td
+ %td.border.bg-secondary.text-white inactive
+ %td.border.bg-white
= matrix[1][0]
- %td
- = matrix[1][1]
-
+ %td.border.bg-white
+ %b= matrix[1][1]
+ %div.row.justify-content-center
+ %h6 Probability plot
%div.row
- %div.collapse.plot.mx-auto{:id=>"pplot#{model.id}#{idx}"}
+ %div.plot.mx-auto{:id=>"pplot#{model.id}#{idx}"}
%img{:src=>"/#{cv.id}.png", :alt=>"#{cv.id}.png"}
/ regression
@@ -144,9 +148,9 @@
- nrp = cv.nr_predictions.collect{|key,value| value}
- wpi = cv.within_prediction_interval.collect{|key,value| value}
- opi = cv.out_of_prediction_interval.collect{|key,value| value}
- %table.table.table-borderless.table-responsive
+ %table.table.table-bordered.table-responsive.text-center.bg-white
%tr
- %td.text-center
+ %td.text-center.bg-light
= "Nr.#{idx+1}"
%td
%a{:href=>"https://en.wikipedia.org/wiki/Root-mean-square_deviation", :rel=>"external"}
@@ -162,7 +166,7 @@
- keys.each_with_index do |key,idx|
%tr
/ keys
- %td.fit.text-right.pr-0= key.gsub("_", " ")
+ %td.fit.text-right= key.gsub("_", " ")
/ rsme:
%td= rmse[idx]
/ mae:
@@ -175,11 +179,10 @@
%td= wpi[idx]
/ Out of prediction interval:
%td= opi[idx]
+ %div.row.justify-content-center
+ %h6 Correlation plot
%div.row
- %button.btn.btn-outline-info.mx-auto{:type=>"button", :data=>{:toggle=>"collapse", :target=>"#cplot#{model.id}#{idx}"}, :aria=>{:expanded=>"false", :controls=>"cplot#{model.id}#{idx}"}, :style=>"font-size:small;"}
- Correlation plot
- %div.row
- %div.collapse.plot.mx-auto{:id=>"cplot#{model.id}#{idx}"}
+ %div.plot.mx-auto{:id=>"cplot#{model.id}#{idx}"}
%img{:src=>"/#{cv.id}.png", :alt=>"#{cv.id}.png"}
- unless idx == crossvalidations.size-1
%hr
diff --git a/views/neighbors.haml b/views/neighbors.haml
index 5f3e2bc..8f8e186 100644
--- a/views/neighbors.haml
+++ b/views/neighbors.haml
@@ -44,10 +44,11 @@
- else
- if !neighbor[:measurement].nil?
= (type == "Regression") ? "#{neighbor[:measurement].delog10.signif(3)} (#{unit})</br>#{c.mmol_to_mg(neighbor[:measurement].delog10).signif(3)} #{(unit =~ /\b(mmol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : neighbor[:measurement]
- %p
- %a{:href=>PUBCHEM_CID_URI+c.cid, :rel => "external"}
- PubChem
- %span.fa.fa-xs.fa-external-link
+ - if c.cid && c.cid != "0"
+ %p
+ %a{:href=>PUBCHEM_CID_URI+c.cid, :rel => "external"}
+ PubChem
+ %span.fa.fa-xs.fa-external-link
/ Similarity = tanimoto
%td
= neighbor[:similarity].round(3)
diff --git a/views/prediction.haml b/views/prediction.haml
index fe1e487..3631f10 100644
--- a/views/prediction.haml
+++ b/views/prediction.haml
@@ -13,10 +13,11 @@
%a.btn.btn-link{:href => "#details0", data: { toggle: "modal", remote: to("/prediction/#{@compound.id}/details"), :id=>"link01"}}
= embedded_svg(@compound.svg, :title=>"click for details")
%p= @compound.smiles
- %p
- %a{:href=>PUBCHEM_CID_URI+@compound.cid, :rel => "external"}
- PubChem
- %span.fa.fa-xs.fa-external-link
+ - if @compound.cid && @compound.cid != "0"
+ %p
+ %a{:href=>PUBCHEM_CID_URI+@compound.cid, :rel => "external"}
+ PubChem
+ %span.fa.fa-xs.fa-external-link
- @model_types = {}
- @dbhit = {}
- @predictions.each_with_index do |prediction,i|
@@ -93,25 +94,25 @@
%b Confidence:
%br
= prediction[:confidence]
-
+
/ show warnings and info
%p
- - if !prediction[:info].blank?
+ - unless @dbhit[i] || prediction[:info].blank?
%b Info:
%br
%p=prediction[:info].sub(/\'.*\'/,"").sub(/,/, ",<br>")
- - if !prediction[:warnings].blank?
+ - unless prediction[:warnings].blank?
- warning = prediction[:warnings].last
%b Warnings:
%br
%p=warning#.sub(/,/, ",<br>")
- else
%br
- - if !prediction[:info].blank?
+ - unless @dbhit[i] || prediction[:info].blank?
%b Info:
%br
%p=prediction[:info].sub(/\'.*\'/,"").sub(/,/, ",<br>")
- - if !prediction[:warnings].blank?
+ - unless prediction[:warnings].blank?
- warning = prediction[:warnings].last
%b Warnings:
%br