From d158443709b03194fe71350f4970dfd167ec6035 Mon Sep 17 00:00:00 2001 From: gebele Date: Mon, 26 Oct 2015 16:15:55 +0000 Subject: consistend unit display;fixed type definition for neighbors;added neighbors view also if database hit --- views/model_details.haml | 21 ++++++++++++++------- views/neighbors.haml | 7 +++---- views/prediction.haml | 11 ++++++++--- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/views/model_details.haml b/views/model_details.haml index f539a70..e5886e7 100644 --- a/views/model_details.haml +++ b/views/model_details.haml @@ -18,7 +18,7 @@ Source: = training_dataset.compounds.size %p -%b Validation (repeated): +%b Crossvalidation (3 independent): %div.row{:id=>"validations#{model.id}", :style=>"background-color:#f5f5f5;"} - model.crossvalidations.each do |crossvalidation| %span.col-xs-4.col-sm-4.col-md-4.col-lg-4 @@ -96,6 +96,11 @@ Source: %td -#= "Confusion Matrix:\t" -#= cv.confusion_matrix + %br + -#%p + = "Confidence plot:" + -#%p{:id=>"confp#{cv.id}", :style=>"transform:scale(0.5);margin-left:-30%;margin-top:-30%;padding:0;"} + = cv.confidence_plot - if model.regression? %br = "Root mean squared error:\t" @@ -112,10 +117,12 @@ Source: %br = "R square:\t" = cv.r_squared.round(3) if cv.r_squared - /%br - /= "Correlation plot" - /= cv.correlation_plot - /%br - /= "Confidence plot:" - /= cv.confidence_plot + -#%p + = "Correlation plot" + -#%p{:id=>"corrp#{cv.id}", :style=>"transform:scale(0.5);margin-left:-30%;margin-top:-30%;margin-bottom:0;padding:0;"} + =cv.correlation_plot + -#%p + = "Confidence plot:" + -#%p{:id=>"confp#{cv.id}", :style=>"transform:scale(0.5);margin-left:-30%;margin-top:-30%;margin-bottom:0;padding:0;"} + = cv.confidence_plot %br diff --git a/views/neighbors.haml b/views/neighbors.haml index bdc7f65..e94c57a 100644 --- a/views/neighbors.haml +++ b/views/neighbors.haml @@ -10,7 +10,6 @@ %ul.nav.nav-tabs.nav-justified{:id=>"neighborTabs", :role=>"tablist"} / each model a tab head ; - @models.each_with_index do |model,i| - - @type = model.model.class.to_s.match("Classification") ? "Classification" : "Regression" %li{:class => ("active" if i == 0)} %a{:href => "#results_#{i+1}", :id => "linkTab#{i+1}", data: {toggle:"tab"}} = "#{model.endpoint} (#{model.species})" @@ -37,7 +36,6 @@ }); }); - if prediction[:neighbors].size > 0 - %div.table-responsive %table.tablesorter{:id=>"#{j+1}", :style=>"border-style: solid;"} %thead @@ -59,6 +57,7 @@ / %a.btn.glyphicon.glyphicon-info-sign{:href=>"#neighbors", :title=>"Similarity", data: {toggle:"popover", placement:"auto", html:"true", content:"LAZAR calculates activity specific similarities based on the presence of statistically significant fragments. This procedure will "}, :style=>"z-index:auto+10;"} / %td %tbody + - type = @model_types[j] - prediction[:neighbors].each_with_index do |neighbor,count| %tr / Compound @@ -68,11 +67,11 @@ %p= Compound.find(neighbor[0]).smiles / Measured Activity %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;"} - = (@type == "Regression") ? neighbor[2].collect{|n| '%.2e' % n}.join(", ") : neighbor[2].join(", ") + = (type == "Regression") ? neighbor[2].collect{|n| '%.2e' % n}.join(", ") : neighbor[2].join(", ") / Similarity %td{:style =>"vertical-align:middle;padding-left:1em;width:20%;"} / TODO differentiate between no neighbors found and compound found in dataset, display neighbors for compounds in dataset? - = neighbor[1] != nil ? neighbor[1].round(2) : "Not enough similar compounds
in training dataset." + = neighbor[1] != nil ? neighbor[1].round(2) : "Not enough similar compounds
in training dataset." - else %span.btn.btn-default.disabled diff --git a/views/prediction.haml b/views/prediction.haml index 191ff15..ef0c5db 100644 --- a/views/prediction.haml +++ b/views/prediction.haml @@ -18,17 +18,21 @@ %td{:id=>"compound", :style=>"vertical-align:top;"} %p= @compound.svg %p= @compound.smiles + - @model_types = {} + - @dbhit = {} - @predictions.each_with_index do |prediction,i| - type = @models[i].model.class.to_s.match("Classification") ? "Classification" : "Regression" + - @model_types[i] = type %td{:style=>"vertical-align:top;white-space:nowrap;"} %b{:class => "title"} = "#{@models[i].endpoint.gsub('_', ' ')} (#{@models[i].species})" %p - if prediction[:confidence] == "measured" + - @dbhit[i] = true %p / TODO fix scientific notation from database %b Measured activity: - = (type == "Regression") ? "#{prediction[:value].round(2)} (#{@models[i].unit})" : prediction[:value] + = (type == "Regression") ? "#{"%.2e" % prediction[:value]} (#{@models[i].unit})" : prediction[:value] %p Compound is part of the training dataset - elsif prediction[:neighbors].size > 0 %p @@ -38,7 +42,7 @@ %br %b Prediction: / TODO scientific notation - = (type == "Regression") ? "#{'%.2e' % prediction[:value]} #{@models[i].unit}" : prediction[:value] + = (type == "Regression") ? "#{'%.2e' % prediction[:value]} (#{@models[i].unit})" : prediction[:value] / TODO update description / %a.btn.glyphicon.glyphicon-info-sign{:href=>"#", :title=>"Prediction", data: {toggle:"popover", placement:"left", html:"true", content:"LAZAR calculates searches the training dataset for similar compounds (neighbors) and calculates the prediction from their measured activities. LAZAR calculates predictions using Please keep in mind that predictions are based on the measured activities of neighbors."}} %br @@ -57,9 +61,10 @@ / %p %p - else + - @dbhit[i] = false %p = "Not enough similar compounds
in training dataset." / always show the neighbors table, message is given there - = haml :neighbors, :layout => false, :model_type => @model_type + = haml :neighbors, :layout => false, :model_type => @model_types, :dbhit => @dbhit -- cgit v1.2.3