diff options
author | gebele <gebele@in-silico.ch> | 2017-11-06 14:37:21 +0000 |
---|---|---|
committer | gebele <gebele@in-silico.ch> | 2017-11-06 14:37:21 +0000 |
commit | 66334c4479e993fdf75535629700c84edbc7ba6c (patch) | |
tree | 94a3c20eaa4935ac8ee0763dc356cdaedd0715f9 /application.rb | |
parent | f9f3faf930a9c348d81646dd9ef60e48821444a7 (diff) |
various small fixes
Diffstat (limited to 'application.rb')
-rw-r--r-- | application.rb | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/application.rb b/application.rb index 13df650..5baec21 100644 --- a/application.rb +++ b/application.rb @@ -50,6 +50,8 @@ get '/task/?' do smiles = compound.smiles task = Task.find(params[:predictions].to_s) unless task.predictions[params[:model]].nil? + model = Model::Validation.find params[:model].to_s + type = (model.regression? ? "Regression" : "Classification") if params[:model] == "Cramer" prediction = task.predictions[params[:model]] html = "<table class=\"table table-bordered single-batch\"><tr>" @@ -67,20 +69,20 @@ get '/task/?' do sorter = [] if prediction[:info] sorter << {"Info" => prediction[:info]} - if prediction[:measurements_string].kind_of?(Array) - sorter << {"Measured activity" => "#{prediction[:measurements_string].join(";")}</br>#{prediction[:converted_measurements].join(";")}"} + if prediction["measurements_string"].kind_of?(Array) + sorter << {"Measured activity" => "#{prediction["measurements_string"].join(";")}</br>#{prediction["converted_measurements"].join(";")}"} else - sorter << {"Measured activity" => "#{prediction[:measurements_string]}</br>#{prediction[:converted_measurements]}"} + sorter << {"Measured activity" => "#{prediction["measurements_string"]}</br>#{prediction["converted_measurements"]}"} end end # regression - if prediction[:prediction_interval] - sorter << {"Prediction" => "#{prediction[:prediction_value]}</br>#{prediction[:converted_prediction_value]}"} - sorter << {"95% Prediction interval" => "#{prediction[:interval]}</br>#{prediction[:converted_interval]}"} + if prediction[:value] && type == "Regression" + sorter << {"Prediction" => "#{prediction["prediction_value"]}</br>#{prediction["converted_prediction_value"]}"} + sorter << {"95% Prediction interval" => "#{prediction[:interval]}</br>#{prediction["converted_interval"]}"} sorter << {"Warnings" => prediction[:warnings].join("</br>")} # classification - elsif prediction[:probabilities] + elsif prediction[:value] && type == "Classification" sorter << {"Consensus prediction" => prediction["Consensus prediction"]} sorter << {"Consensus confidence" => prediction["Consensus confidence"]} sorter << {"Structural alerts for mutagenicity" => prediction["Structural alerts for mutagenicity"]} |