%div.well %a.btn.btn-warning{:href => to('/predict')} %i.glyphicon.glyphicon-menu-left New Prediction / displays all prediction result in first table %h3 Prediction Results: %div.table-responsive %table.table.table-bordered{:id=>"overview"} %tbody %tr %td{:id=>"compound", :style=>"vertical-align:top;"} %a.btn.btn-link{:href => "#details0", data: { toggle: "modal", remote: to("/prediction/#{CGI.escape(@compound.id.to_s)}/details"), :id=>"link01"}} = @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 - unit = @models[i].unit %td{:style=>"vertical-align:top;white-space:nowrap;"} %b{:class => "title"} = "#{@models[i].endpoint.gsub('_', ' ')} (#{@models[i].species})" / check for prediction /- if prediction[:neighbors].size > 0 - if prediction[:neighbors] and !prediction[:value].nil? %p / show model type (classification|regression) %b Type: = type %p / check for database hit - if prediction[:info] =~ /\b(identical)\b/i - @dbhit[i] = true / show message about dbhit and measurements %p %b Compound is part of the training dataset %p %b Measured activity: %br - if prediction[:measurements].is_a?(Array) = (type == "Regression") ? prediction[:measurements].collect{|value| "#{value.delog10.signif(3)} (#{unit})#{@compound.mmol_to_mg(value.delog10).signif(3)} #{unit =~ /mmol\/L/ ? "(mg/L)" : "(mg/kg_bw/day)"}"}.join("") : prediction[:measurements].join(", ") - else = (type == "Regression") ? "#{prediction[:measurements].delog10.signif(3)} (#{unit})#{@compound.mmol_to_mg(prediction[:measurements].delog10).signif(3)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : prediction[:measurements] - else - @dbhit[i] = false / show prediction %p %b Prediction: / prediction popover %a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"Prediction", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"
lazar searches the training dataset for similar compounds (neighbors) and calculates the prediction from their experimental activities.
Classification:Majority vote of neighbor activities weighted by similarity.
Regression:Prediction from a local partial least squares regression model with neighbor activities weighted by similarity.
Original publication."}}
%br
= (type == "Regression") ? "#{prediction[:value].delog10.signif(3)} (#{unit})#{@compound.mmol_to_mg(prediction[:value].delog10).signif(3)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" : prediction[:value]
/ show prediction interval or probability
%p
- if type == "Regression"
%b 95% Prediction interval:
- interval = (prediction[:prediction_interval].nil? ? nil : prediction[:prediction_interval])
/ prediction interval popover
%a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"Prediction intervall", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"An estimate of prediction uncertainty. The \"real\" value should be with 95% probability within the prediction interval."}}
%br
= interval.nil? ? "--" : "#{interval[1].delog10.signif(3)} - #{interval[0].delog10.signif(3)} (#{unit})"
%br
= "#{@compound.mmol_to_mg(interval[1].delog10).signif(3)} - #{@compound.mmol_to_mg(interval[0].delog10).signif(3)} #{(unit =~ /\b(mol\/L)\b/) ? "(mg/L)" : "(mg/kg_bw/day)"}" if !prediction[:prediction_interval].nil?
- else
%b Probability:
/ probability popover
%a.btn.glyphicon.glyphicon-info-sign{:href=>"javascript:void(0)", :title=>"Pobability", :tabindex=>"0", data: {trigger:"focus", toggle:"popover", placement:"left", html:"true", content:"Probability that the prediction belongs to one of the given classes."}}
- unless prediction[:probabilities].nil?
%br
= "#{prediction[:probabilities].keys[0]}: #{prediction[:probabilities].values[0].signif(3)}"
- if prediction[:probabilities].size == 2
%br
= "#{prediction[:probabilities].keys[1]}: #{prediction[:probabilities].values[1].signif(3)}"
/ show warnings and info
%p
- if !prediction[:info].blank?
%b info:
%br
%p=prediction[:info].sub(/excluded/, "excluded
")
- if !prediction[:warnings].blank?
%b warnings:
- prediction[:warnings].each do |warning|
%br
%p=warning
%p=warning.sub(/substances/, "substances
").sub(/prediction\:/, "prediction\:
")
- else
%br
- @dbhit[i] = false
- if !prediction[:info].blank?
%b info:
%br
%p=prediction[:info].sub(/excluded/, "excluded
")
- if !prediction[:warnings].blank?
%b warnings:
- prediction[:warnings].each do |warning|
%br
%p=warning.sub(/substances/, "substances
").sub(/prediction\:/, "prediction\:
")
/ always show the neighbors table, message is given there
= haml :neighbors, :layout => false, :model_type => @model_types, :dbhit => @dbhit
%div.modal.fade{:id=>"details0", :role=>"dialog"}
%div.modal-dialog.modal-lg
%div.modal-content