diff options
author | Christoph Helma <helma@in-silico.ch> | 2010-08-25 12:28:39 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2010-08-25 12:28:39 +0200 |
commit | ab9a669b922b3a7c72a60e96e2bbf65c062b05ab (patch) | |
tree | 2d32367819457a2b9c6480a2dd0a4effc2d648e4 | |
parent | 6b422d9c03a0f72785d4f7bde9bd384835e5ce5a (diff) |
initial version for quantitative features, some improvements suggested by david
-rw-r--r-- | application.rb | 21 | ||||
-rw-r--r-- | model.rb | 81 | ||||
-rw-r--r-- | parser.rb | 2 | ||||
-rwxr-xr-x | public/javascripts/toxcreate.js | 2 | ||||
-rw-r--r-- | views/classification.haml | 11 | ||||
-rw-r--r-- | views/classification_validation.haml | 87 | ||||
-rw-r--r-- | views/create.haml | 20 | ||||
-rw-r--r-- | views/endpoint.haml | 12 | ||||
-rw-r--r-- | views/help.haml | 5 | ||||
-rw-r--r-- | views/layout.haml | 4 | ||||
-rw-r--r-- | views/lazar_algorithm.haml | 6 | ||||
-rw-r--r-- | views/lazar_description.haml | 29 | ||||
-rw-r--r-- | views/model.haml | 14 | ||||
-rw-r--r-- | views/models.haml | 6 | ||||
-rw-r--r-- | views/regression.haml | 11 | ||||
-rw-r--r-- | views/regression_validation.haml | 36 | ||||
-rw-r--r-- | views/style.sass | 13 | ||||
-rw-r--r-- | views/unit.haml | 10 | ||||
-rw-r--r-- | views/validation.haml | 289 |
19 files changed, 270 insertions, 389 deletions
diff --git a/application.rb b/application.rb index 9f511e7..0bca96f 100644 --- a/application.rb +++ b/application.rb @@ -1,7 +1,7 @@ ['rubygems', "haml", "sass", "rack-flash"].each do |lib| require lib end -gem "opentox-ruby-api-wrapper", "= 1.6.3" +gem "opentox-ruby-api-wrapper", "= 1.6.4" require 'opentox-ruby-api-wrapper' gem 'sinatra-static-assets' require 'sinatra/static_assets' @@ -49,21 +49,22 @@ end get '/model/:id/:view/?' do response['Content-Type'] = 'text/plain' model = ToxCreateModel.get(params[:id]) - model.process - model.save begin + model.process + model.save case params[:view] when "model" haml :model, :locals=>{:model=>model}, :layout => false when /validation/ - if model.type == "classification" - haml :classification_validation, :locals=>{:model=>model}, :layout => false - elsif model.type == "regression" - haml :regression_validation, :locals=>{:model=>model}, :layout => false - else - return "Unknown model type '#{model.type}'" - end + haml :validation, :locals=>{:model=>model}, :layout => false + #if model.type == "classification" + #haml :classification_validation, :locals=>{:model=>model}, :layout => false + #elsif model.type == "regression" + #haml :regression_validation, :locals=>{:model=>model}, :layout => false + #else + #return "Unknown model type '#{model.type}'" + #end else return "unable to render model: id #{params[:id]}, view #{params[:view]}" end @@ -11,6 +11,18 @@ class ToxCreateModel property :validation_report_uri, String, :length => 255 property :warnings, Text, :length => 2**32-1 property :nr_compounds, Integer + property :nr_predictions, Integer + property :true_positives, Integer + property :false_positives, Integer + property :true_negatives, Integer + property :false_negatives, Integer + property :correct_predictions, Integer + property :weighted_area_under_roc, Float + property :sensitivity, Float + property :specificity, Float + property :r_square, Float + property :root_mean_squared_error, Float + property :mean_absolute_error, Float property :type, String property :created_at, DateTime @@ -62,6 +74,7 @@ class ToxCreateModel end end +=begin def classification_validation begin uri = File.join(@validation_uri, 'statistics') @@ -83,17 +96,21 @@ class ToxCreateModel n += fp end end - { - :n => n, - :tp => tp, - :fp => fp, - :tn => tn, - :fn => fn, - :correct_predictions => sprintf("%.2f", 100*(tp+tn).to_f/n), - :weighted_area_under_roc => sprintf("%.3f", v[:classification_statistics][:weighted_area_under_roc].to_f), - :sensitivity => sprintf("%.3f", tp.to_f/(tp+fn)), - :specificity => sprintf("%.3f", tn.to_f/(tn+fp)) - } + @nr_predictions = n + @true_positives = tp + @false_positives = fp + @true_negatives = tn + @false_negatives = fn + @correct_predictions = 100*(tp+tn).to_f/n + @weighted_area_under_roc = v[:classification_statistics][:weighted_area_under_roc].to_f + @sensitivity = tp.to_f/(tp+fn) + @specificity = tn.to_f/(tn+fp) + save + #:correct_predictions => sprintf("%.2f", 100*(tp+tn).to_f/n), + #:weighted_area_under_roc => sprintf("%.3f", v[:classification_statistics][:weighted_area_under_roc].to_f), + #:sensitivity => sprintf("%.3f", tp.to_f/(tp+fn)), + #:specificity => sprintf("%.3f", tn.to_f/(tn+fp)) + #} rescue "Service offline" end @@ -104,10 +121,16 @@ class ToxCreateModel uri = File.join(@validation_uri, 'statistics') yaml = RestClient.get(uri).body v = YAML.load(yaml) + @nr_predictions = v[:num_instances] - v[:num_unpredicted] + @r_square = v[:regression_statistics][:r_square] + @root_mean_squared_error = v[:regression_statistics][:root_mean_squared_error] + @mean_absolute_error = v[:regression_statistics][:mean_absolute_error] + save rescue "Service offline" end end +=end def process @@ -129,6 +152,42 @@ class ToxCreateModel LOGGER.debug "Validation URI: #{@validation_uri}" update :validation_report_task_uri => RestClient.post(File.join(@@config[:services]["opentox-validation"],"/report/crossvalidation"), :validation_uris => @validation_uri).body LOGGER.debug "Validation Report Task URI: #{@validation_report_task_uri}" + uri = File.join(@validation_uri, 'statistics') + yaml = RestClient.get(uri).body + v = YAML.load(yaml) + case type + when "classification" + tp=0; tn=0; fp=0; fn=0; n=0 + v[:classification_statistics][:confusion_matrix][:confusion_matrix_cell].each do |cell| + if cell[:confusion_matrix_predicted] == "true" and cell[:confusion_matrix_actual] == "true" + tp = cell[:confusion_matrix_value] + n += tp + elsif cell[:confusion_matrix_predicted] == "false" and cell[:confusion_matrix_actual] == "false" + tn = cell[:confusion_matrix_value] + n += tn + elsif cell[:confusion_matrix_predicted] == "false" and cell[:confusion_matrix_actual] == "true" + fn = cell[:confusion_matrix_value] + n += fn + elsif cell[:confusion_matrix_predicted] == "true" and cell[:confusion_matrix_actual] == "false" + fp = cell[:confusion_matrix_value] + n += fp + end + end + update :nr_predictions => n + update :true_positives => tp + update :false_positives => fp + update :true_negatives => tn + update :false_negatives => fn + update :correct_predictions => 100*(tp+tn).to_f/n + update :weighted_area_under_roc => v[:classification_statistics][:weighted_area_under_roc].to_f + update :sensitivity => tp.to_f/(tp+fn) + update :specificity => tn.to_f/(tn+fp) + when "regression" + update :nr_predictions => v[:num_instances] - v[:num_unpredicted] + update :r_square => v[:regression_statistics][:r_square] + update :root_mean_squared_error => v[:regression_statistics][:root_mean_squared_error] + update :mean_absolute_error => v[:regression_statistics][:mean_absolute_error] + end rescue LOGGER.warn "Cannot create Validation Report Task #{@validation_report_task_uri} for Validation URI #{@validation_uri} from Task #{@validation_task_uri}" end @@ -93,7 +93,7 @@ class Parser def validate(smiles, act, row) compound = OpenTox::Compound.new(:smiles => smiles) - if compound.inchi == "" + if compound.nil? or compound.inchi.nil? or compound.inchi == "" @smiles_errors << "Row #{row}: " + [smiles,act].join(", ") return false end diff --git a/public/javascripts/toxcreate.js b/public/javascripts/toxcreate.js index 048bd46..d1ed490 100755 --- a/public/javascripts/toxcreate.js +++ b/public/javascripts/toxcreate.js @@ -80,7 +80,7 @@ $(function() { checkValidation = function() { var reload_id = ""; $("input.model_validation_report").each(function(){ - if($(this).val() != "Completed") { + if(!$(this).val().match(/Completed|Error/)) { reload_id = this.id.replace("model_validation_report_",""); if(/^\d+$/.test(reload_id)) loadModel(reload_id, 'validation'); }; diff --git a/views/classification.haml b/views/classification.haml new file mode 100644 index 0000000..5c739cf --- /dev/null +++ b/views/classification.haml @@ -0,0 +1,11 @@ +%dl#classification{ :style => "display: none;" } + %dt + Classification + ( + = hide_link "#classification" + ) + %dd + Prediction of + %em qualitative + properties, e.g. to distinguish between toxic and non-toxic compounds + diff --git a/views/classification_validation.haml b/views/classification_validation.haml index 26f0617..4a2d689 100644 --- a/views/classification_validation.haml +++ b/views/classification_validation.haml @@ -1,54 +1,33 @@ -%dl{:id => "model_validation_#{model.id}"} - %dt - Validation: - %input{ :id => "model_validation_report_#{model.id}", :type => "hidden", :value => "#{model.validation_report_status}", :class => "model_validation_report" } - - if model.validation_report_uri - %a{:href => model.validation_report_uri, :target => "_blank"} (more details) - %dd - - if model.validation_uri - - v = model.classification_validation - - if v == "Service offline" - = v - - else - %dl - %dt Number of predictions: - %dd= v[:n] - %dt Correct predictions: - %dd - = v[:correct_predictions] - = '%' - %dt - %a{:href => "http://en.wikipedia.org/wiki/Receiver_operating_characteristic", :target => "_blank"} Weighted area under ROC: - %dd - = v[:weighted_area_under_roc] - %dt - %a{:href => "http://en.wikipedia.org/wiki/Sensitivity_and_specificity", :target => "_blank"} Specificity: - %dd= v[:specificity] - %dt - %a{:href => "http://en.wikipedia.org/wiki/Sensitivity_and_specificity", :target => "_blank"} Sensitivity: - %dd= v[:sensitivity] - %dt - %a{:href => "http://en.wikipedia.org/wiki/Confusion_matrix", :target => "_blank"} Confusion Matrix: - %dd - %table - %tr - %td{:colspan => 2, :rowspan => 2} - -#%td - %th{:colspan => 2} Measured - %tr - -#%td{:colspan => 2} - -#%th Predicted - %th{:bgcolor => "#CCD2DC"} active - %th{:bgcolor => "#CCD2DC"} inactive - %tr - %th{:rowspan => 2} Predicted - %th{:bgcolor => "#CCD2DC"} active - %td= v[:tp] - %td= v[:fp] - %tr - %th{:bgcolor => "#CCD2DC"} inactive - %td= v[:fn] - %td= v[:tn] - - else - = image_tag("/snake_transparent.gif") if model.validation_status == "Running" - %a{:href => model.validation_task_uri} #{model.validation_status} +%dt Correct predictions: +%dd + = sprintf("%.2f", model.correct_predictions) + = '%' +%dt + %a{:href => "http://en.wikipedia.org/wiki/Receiver_operating_characteristic", :target => "_blank"} Weighted area under ROC: +%dd + = sprintf("%.3f", model.weighted_area_under_roc) +%dt + %a{:href => "http://en.wikipedia.org/wiki/Sensitivity_and_specificity", :target => "_blank"} Specificity: +%dd= sprintf("%.3f", model.specificity) +%dt + %a{:href => "http://en.wikipedia.org/wiki/Sensitivity_and_specificity", :target => "_blank"} Sensitivity: +%dd= sprintf("%.3f", model.sensitivity) +%dt + %a{:href => "http://en.wikipedia.org/wiki/Confusion_matrix", :target => "_blank"} Confusion Matrix: +%dd + %table + %tr + %td{:colspan => 2, :rowspan => 2} + %th{:colspan => 2} Measured + %tr + %th{:bgcolor => "#CCD2DC"} active + %th{:bgcolor => "#CCD2DC"} inactive + %tr + %th{:rowspan => 2} Predicted + %th{:bgcolor => "#CCD2DC"} active + %td= model.true_positives + %td= model.false_positives + %tr + %th{:bgcolor => "#CCD2DC"} inactive + %td= model.false_negatives + %td= model.true_negatives diff --git a/views/create.haml b/views/create.haml index 3cf05c1..20de401 100644 --- a/views/create.haml +++ b/views/create.haml @@ -4,13 +4,13 @@ This service creates %ul %li - %a{:href => 'http://lazar.in-silico.de'} lazar - %em classification - models (i.e. models that discriminate between toxic/nontoxic compounds) and + = toggle_link("#lazar_description","lazar") + %em= toggle_link("#classification","classification") + models and %li - %a{:href => 'http://lazar.in-silico.de'} lazar - %em regression - models (i.e. models that predict quantitative values, e.g. LC50's) + = toggle_link("#lazar_description","lazar") + %em= toggle_link("#regression","regression") + models from your uploaded datasets. Further modelling algorithms will be added in future versions. %p @@ -20,7 +20,7 @@ %form{ :action => url_for('/upload'), :method => "post", :enctype => "multipart/form-data" } %fieldset - %label{:for => 'endpoint'} 1. Enter endpoint name and unit (for regression): + %label{:for => 'endpoint'} 1. Enter #{toggle_link("#endpoint_description","endpoint")} name and #{toggle_link("#unit","unit")} (for #{toggle_link("#regression","regression")}): %input{:type => 'text', :name => 'endpoint', :id => 'endpoint', :size => '50'} %br %label{:for => 'file'} @@ -33,3 +33,9 @@ %input{ :type => "submit", :value => "Create model"} = link_to "Cancel", '/create' + -# explanations + = haml :lazar_description, :layout => false + = haml :classification, :layout => false + = haml :regression, :layout => false + = haml :endpoint, :layout => false + = haml :unit, :layout => false diff --git a/views/endpoint.haml b/views/endpoint.haml new file mode 100644 index 0000000..af06b80 --- /dev/null +++ b/views/endpoint.haml @@ -0,0 +1,12 @@ +%dl#endpoint_description{ :style => "display: none;" } + %dt + Endpoint + ( + = hide_link "#endpoint_description" + ) + %dd + Toxic effect that constitutes the outcome of an + %em in-vitro, + or + %em in-vivo + expriment, clinical trial or epidemiological study diff --git a/views/help.haml b/views/help.haml index 52339ce..eabf978 100644 --- a/views/help.haml +++ b/views/help.haml @@ -10,7 +10,10 @@ %dd Enter a quantitative value. For optimal performance you should %ul - %li use molar units + %li + use + %a{:href => "http://en.wikipedia.org/wiki/Molar_(concentration)"} molar + units %li enter non-logarithmic values (logarithms are taken internally) %li avoid 0 activities (will be ignored) %p diff --git a/views/layout.haml b/views/layout.haml index 6c9202b..a3db5e9 100644 --- a/views/layout.haml +++ b/views/layout.haml @@ -9,7 +9,9 @@ %link{:rel=>'stylesheet', :href=>'stylesheets/style.css', :type => "text/css"} %body - .logo= image_tag "/ToxCreate_rgb_72.png", :alt => 'ToxCreate', :align => "right" + .logo + = image_tag "/ToxCreate_rgb_72.png", :alt => 'ToxCreate', :align => 'right' + %br Create and evaluate models to predict toxicity .index %ul %li{:class => ("selected" if /\/create/ =~ request.path )} diff --git a/views/lazar_algorithm.haml b/views/lazar_algorithm.haml index 6322b17..b83de6b 100644 --- a/views/lazar_algorithm.haml +++ b/views/lazar_algorithm.haml @@ -19,9 +19,15 @@ %li a majority vote (weighted by compound similarity) for %em classification + ( + %a{:href => "http://www.in-silico.de/articles/modi020905.pdf"} original publication + ) %li a local QSAR model based on neighbors for %em regression + ( + %a{:href => "http://www.in-silico.de/articles/mh_tf.pdf"} original publication + ) %p = toggle_link "#significant_fragments", "Significant fragments" diff --git a/views/lazar_description.haml b/views/lazar_description.haml new file mode 100644 index 0000000..d870425 --- /dev/null +++ b/views/lazar_description.haml @@ -0,0 +1,29 @@ +%dl#lazar_description{ :style => "display: none;" } + %dt + %code lazar + ( + = hide_link "#lazar_description" + ) + %dd + %p + %code lazar + searches the training dataset for + = toggle_link "#similarity", "similar" + compounds + %em (neighbors) + and calculates the prediction from their measured activities. + %code lazar + calculates predictions using + %ul + %li + a majority vote (weighted by compound similarity) for + %em= toggle_link("#classification","classification") + ( + %a{:href => "http://www.in-silico.de/articles/modi020905.pdf"} original publication + ) + %li + a local QSAR model based on neighbors for + %em= toggle_link("#regression","regression") + ( + %a{:href => "http://www.in-silico.de/articles/mh_tf.pdf"} original publication + ) diff --git a/views/model.haml b/views/model.haml index 234dcc6..454423a 100644 --- a/views/model.haml +++ b/views/model.haml @@ -8,6 +8,7 @@ %div{:id => "model_#{model.id}"} %h2 = model.name + .model %dl %dt Status: @@ -31,9 +32,9 @@ - if model.status == 'Completed' %dt Algorithm: %dd - %a{:href => "http://www.in-silico.de/articles/modi020905.pdf"} #{File.basename model.algorithm} + = toggle_link("#lazar_description","lazar") %dt Type: - %dd= model.type + %dd= toggle_link("##{model.type}","#{model.type}") %dt Descriptors: %dd %a{:href => 'http://www.maunz.de/libfminer2-bbrc-doc/'} Fminer backbone refinement classes @@ -56,10 +57,5 @@ %a{:href => "#{model.uri}.rdf"} RDF/XML , %a{:href => "#{model.uri}.yaml"} YAML - %em (experts, models cannot be exported in Excel) - - case model.type - - when "classification" - = haml :classification_validation, :locals=>{:model=>model}, :layout => false - -when "regression" - = haml :regression_validation, :locals=>{:model=>model}, :layout => false - + %em (experts, models cannot be represented in Excel) + = haml :validation, :locals=>{:model=>model}, :layout => false diff --git a/views/models.haml b/views/models.haml index 806a935..6712e3d 100644 --- a/views/models.haml +++ b/views/models.haml @@ -10,5 +10,11 @@ }); %p Get an overview about ToxCreate models. This page is refreshed every 15 seconds to update the model status. + +-# explanations += haml :lazar_description, :layout => false += haml :classification, :layout => false += haml :regression, :layout => false + - @models.each do |model| = haml :model, :locals=>{:model=>model}, :layout => false diff --git a/views/regression.haml b/views/regression.haml new file mode 100644 index 0000000..4866b08 --- /dev/null +++ b/views/regression.haml @@ -0,0 +1,11 @@ +%dl#regression{ :style => "display: none;" } + %dt + Regression + ( + = hide_link "#regression" + ) + %dd + Prediction of + %em quantitative + properties, e.g. LC50 values + diff --git a/views/regression_validation.haml b/views/regression_validation.haml index ac45307..00267a9 100644 --- a/views/regression_validation.haml +++ b/views/regression_validation.haml @@ -1,27 +1,9 @@ -%dl{:id => "model_validation_#{model.id}"} - %dt - Validation: - %input{ :id => "model_validation_report_#{model.id}", :type => "hidden", :value => "#{model.validation_report_status}", :class => "model_validation_report" } - - if model.validation_report_uri - %a{:href => model.validation_report_uri, :target => "_blank"} (more details) - %dd - - if model.validation_uri - - v = model.regression_validation - - if v == "Service offline" - = v - - else - %dl - %dt Number of predictions - %dd= v[:num_instances] - v[:num_unpredicted] - %dt - %a{:href => "http://en.wikipedia.org/wiki/R-squared"} R-squared - %dd= sprintf '%.03g', v[:regression_statistics][:r_square] - %dt - %a{:href => "http://en.wikipedia.org/wiki/Root_mean_square_deviation"} Root Mean Square Error - %dd= sprintf '%.03g', v[:regression_statistics][:root_mean_squared_error] - %dt - %a{:href => "http://en.wikipedia.org/wiki/Mean_absolute_error"} Mean Absolute Error - %dd= sprintf '%.03g', v[:regression_statistics][:mean_absolute_error] - - else - = image_tag("/snake_transparent.gif") if model.validation_status == "Running" - %a{:href => model.validation_task_uri} #{model.validation_status} +%dt + %a{:href => "http://en.wikipedia.org/wiki/R-squared"} R-squared +%dd= sprintf '%.03g', model.r_square +%dt + %a{:href => "http://en.wikipedia.org/wiki/Root_mean_square_deviation"} Root Mean Square Error +%dd= sprintf '%.03g', model.root_mean_squared_error +%dt + %a{:href => "http://en.wikipedia.org/wiki/Mean_absolute_error"} Mean Absolute Error +%dd= sprintf '%.03g', model.mean_absolute_error diff --git a/views/style.sass b/views/style.sass index 4977da1..44917cc 100644 --- a/views/style.sass +++ b/views/style.sass @@ -19,9 +19,14 @@ body a:hover color: black - .headline - .logo - float: right + .logo + float: right + br + clear: both + //border-right: 90px + img + margin: 0 + padding: 0 .index clear: both @@ -85,7 +90,7 @@ body font-weight: bold color: $fg_color label - width: 25em + width: 30em display: block float: left br diff --git a/views/unit.haml b/views/unit.haml new file mode 100644 index 0000000..a352599 --- /dev/null +++ b/views/unit.haml @@ -0,0 +1,10 @@ +%dl#unit{ :style => "display: none;" } + %dt + Unit + ( + = hide_link "#unit" + ) + %dd + Unit of measurement, e.g. mmol or mmol/kg-bodyweight. For optimal performance you should use + %a{:href => "http://en.wikipedia.org/wiki/Molar_(concentration)"} molar + units. diff --git a/views/validation.haml b/views/validation.haml index d1af379..90150d1 100644 --- a/views/validation.haml +++ b/views/validation.haml @@ -1,264 +1,27 @@ -= "-> " -%a{ :href => "/validation/#{params[:id]}" } Validation +%dl{:id => "model_validation_#{model.id}"} + %dt + Validation: + %input{ :id => "model_validation_report_#{model.id}", :type => "hidden", :value => "#{model.validation_report_status}", :class => "model_validation_report" } + %dd + - if model.validation_uri + %dl + %dt + Detailed report: + %dd + - if model.validation_report_uri + %a{:href => model.validation_report_uri, :target => "_blank"} show + - else + = image_tag("/snake_transparent.gif") if model.validation_report_status == "Running" + %a{:href => model.validation_report_task_uri} #{model.validation_report_status} + %dt Number of predictions + %dd= model.nr_predictions + - case model.type + - when "classification" + = haml :classification_validation, :locals=>{:model=>model}, :layout => false + - when "regression" + = haml :regression_validation, :locals=>{:model=>model}, :layout => false + - else + = image_tag("/snake_transparent.gif") if model.validation_status == "Running" + %a{:href => model.validation_task_uri} #{model.validation_status} + -%h1 - = @model['name'].capitalize.gsub(/_/,' ') - validation - -Created on -= @model['created_at'] -by -= @model['user'] -( -%a{ :href => @model['validation']['details_uri'] } Prediction details -) - -%h3 Predictions weighted by confidence index -%p - %em Best indication of the overall performance - -%table - %tr - %th - True positive predictions - %td - tp - %td - = sprintf("%0.2f",@summary[:weighted][:tp].to_f) - %tr - %th - True negative predictions - %td - tn - %td - = sprintf("%0.2f",@summary[:weighted][:tn].to_f) - %tr - %th - False positive predictions - %td - fp - %td - = sprintf("%0.2f",@summary[:weighted][:fp].to_f) - %tr - %th - False negative predictions - %td - fn - %td - = sprintf("%0.2f",@summary[:weighted][:fn].to_f) - %tr - %th - Sensitivity (true positive rate) - %td - tp/(tp+fn) - %td - = (100*@summary[:weighted][:tp].to_f/(@summary[:weighted][:tp].to_f+@summary[:weighted][:fn].to_f)).round/100.00 - %tr - %th - Specificity (true negative rate) - %td - tn/(tn+fp) - %td - = (100*@summary[:weighted][:tn].to_f/(@summary[:weighted][:tn].to_f+@summary[:weighted][:fp].to_f).to_f).round/100.00 - %tr - %th - Positive predictivity - %td - tp/(tp+fp) - %td - = (100*@summary[:weighted][:tp].to_f/(@summary[:weighted][:tp].to_f+@summary[:weighted][:fp].to_f).to_f).round/100.00 - %tr - %th - Negative predictivity - %td - tn/(tn+fn) - %td - = (100*@summary[:weighted][:tn].to_f/(@summary[:weighted][:tn].to_f+@summary[:weighted][:fn].to_f).to_f).round/100.00 - %tr - %th - False positive rate - %td - fp/(tp+fn) - %td - = (100*@summary[:weighted][:fp].to_f/(@summary[:weighted][:tp].to_f+@summary[:weighted][:fn].to_f).to_f).round/100.00 - %tr - %th - False negative rate - %td - fn/(tn+fp) - %td - = (100*@summary[:weighted][:fn].to_f/(@summary[:weighted][:tn].to_f+@summary[:weighted][:fp].to_f).to_f).round/100.00 - %tr - %th - Accuracy (concordance) - %td - (tp+tn)/(tp+fp+tn+fn) - %th - = (100*(@summary[:weighted][:tp].to_f+@summary[:weighted][:tn].to_f)/(@summary[:weighted][:tp].to_f+@summary[:weighted][:tn].to_f+@summary[:weighted][:fn].to_f+@summary[:weighted][:fp].to_f).to_f).round/100.00 - - -%h3 Predictions within the applicability domain -%p - %em Hard cutoff at confidence > 0.025 - -%table - %tr - %th - True positive predictions - %td - tp - %td - = @summary[:within_ad][:tp].to_i - %tr - %th - True negative predictions - %td - tn - %td - = @summary[:within_ad][:tn].to_i - %tr - %th - False positive predictions - %td - fp - %td - = @summary[:within_ad][:fp].to_i - %tr - %th - False negative predictions - %td - fn - %td - = @summary[:within_ad][:fn].to_i - %tr - %th - Sensitivity (true positive rate) - %td - tp/(tp+fn) - %td - = (100*@summary[:within_ad][:tp].to_i/(@summary[:within_ad][:tp].to_i+@summary[:within_ad][:fn].to_i).to_f).round/100.00 - %tr - %th - Specificity (true negative rate) - %td - tn/(tn+fp) - %td - = (100*@summary[:within_ad][:tn].to_i/(@summary[:within_ad][:tn].to_i+@summary[:within_ad][:fp].to_i).to_f).round/100.00 - %tr - %th - Positive predictivity - %td - tp/(tp+fp) - %td - = (100*@summary[:within_ad][:tp].to_i/(@summary[:within_ad][:tp].to_i+@summary[:within_ad][:fp].to_i).to_f).round/100.00 - %tr - %th - Negative predictivity - %td - tn/(tn+fn) - %td - = (100*@summary[:within_ad][:tn].to_i/(@summary[:within_ad][:tn].to_i+@summary[:within_ad][:fn].to_i).to_f).round/100.00 - %tr - %th - False positive rate - %td - fp/(tp+fn) - %td - = (100*@summary[:within_ad][:fp].to_i/(@summary[:within_ad][:tp].to_i+@summary[:within_ad][:fn].to_i).to_f).round/100.00 - %tr - %th - False negative rate - %td - fn/(tn+fp) - %td - = (100*@summary[:within_ad][:fn].to_i/(@summary[:within_ad][:tn].to_i+@summary[:within_ad][:fp].to_i).to_f).round/100.00 - %tr - %th - Accuracy (concordance) - %td - (tp+tn)/(tp+fp+tn+fn) - %th - = (100*(@summary[:within_ad][:tp].to_i+@summary[:within_ad][:tn].to_i)/(@summary[:within_ad][:tp].to_i+@summary[:within_ad][:tn].to_i+@summary[:within_ad][:fn].to_i+@summary[:within_ad][:fp].to_i).to_f).round/100.00 - -%h3 All predictions -%p - %em Poor indication of the overall performance. Depends predominatly on the fraction of compounds within the applicability domain. - -%table - %tr - %th - True positive predictions - %td - tp - %td - = @summary[:all][:tp].to_i - %tr - %th - True negative predictions - %td - tn - %td - = @summary[:all][:tn].to_i - %tr - %th - False positive predictions - %td - fp - %td - = @summary[:all][:fp].to_i - %tr - %th - False negative predictions - %td - fn - %td - = @summary[:all][:fn].to_i - %tr - %th - Sensitivity (true positive rate) - %td - tp/(tp+fn) - %td - = (100*@summary[:all][:tp].to_i/(@summary[:all][:tp].to_i+@summary[:all][:fn].to_i).to_f).round/100.00 - %tr - %th - Specificity (true negative rate) - %td - tn/(tn+fp) - %td - = (100*@summary[:all][:tn].to_i/(@summary[:all][:tn].to_i+@summary[:all][:fp].to_i).to_f).round/100.00 - %tr - %th - Positive predictivity - %td - tp/(tp+fp) - %td - = (100*@summary[:all][:tp].to_i/(@summary[:all][:tp].to_i+@summary[:all][:fp].to_i).to_f).round/100.00 - %tr - %th - Negative predictivity - %td - tn/(tn+fn) - %td - = (100*@summary[:all][:tn].to_i/(@summary[:all][:tn].to_i+@summary[:all][:fn].to_i).to_f).round/100.00 - %tr - %th - False positive rate - %td - fp/(tp+fn) - %td - = (100*@summary[:all][:fp].to_i/(@summary[:all][:tp].to_i+@summary[:all][:fn].to_i).to_f).round/100.00 - %tr - %th - False negative rate - %td - fn/(tn+fp) - %td - = (100*@summary[:all][:fn].to_i/(@summary[:all][:tn].to_i+@summary[:all][:fp].to_i).to_f).round/100.00 - %tr - %th - Accuracy (concordance) - %td - (tp+tn)/(tp+fp+tn+fn) - %th - = (100*(@summary[:all][:tp].to_i+@summary[:all][:tn].to_i)/(@summary[:all][:tp].to_i+@summary[:all][:tn].to_i+@summary[:all][:fn].to_i+@summary[:all][:fp].to_i).to_f).round/100.00 |