summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2011-08-22 11:12:47 +0000
committerChristoph Helma <helma@in-silico.ch>2011-08-22 11:12:47 +0000
commit28da7a09067ee75b07f7c11ab83b6d4d54048384 (patch)
tree7678aac801aa6b73723ba05c7bcc097546a91788
parent3b7a80f1af7e8b68f2f8bc9fd137ec9be5658c20 (diff)
parenta4b6e68acf76949a1765177b6d5b8c454990cb8a (diff)
Merge branch 'development' of github.com:opentox/toxcreate into development
Conflicts: application.rb
-rw-r--r--application.rb8
-rw-r--r--helper.rb30
-rw-r--r--model.rb2
-rw-r--r--views/classification_validation.haml2
4 files changed, 6 insertions, 36 deletions
diff --git a/application.rb b/application.rb
index 9eafcbe..eb86916 100644
--- a/application.rb
+++ b/application.rb
@@ -9,8 +9,9 @@ require 'ftools'
require File.join(File.dirname(__FILE__),'model.rb')
require File.join(File.dirname(__FILE__),'helper.rb')
-use Rack::Session::Cookie, :expire_after => 28800,
- :secret => "ui6vaiNi-change_me"
+#moved to wrapper->environment
+#use Rack::Session::Cookie, :expire_after => 28800,
+# :secret => "ui6vaiNi-change_me"
use Rack::Flash
set :lock, true
@@ -319,8 +320,7 @@ post '/models' do # create a new model
if validation.metadata[OT.classificationStatistics]
@model.update(:correct_predictions => validation.metadata[OT.classificationStatistics][OT.percentCorrect].to_f)
@model.update(:confusion_matrix => validation.confusion_matrix.to_yaml)
- #@model.update(:weighted_area_under_roc => validation.metadata[OT.classificationStatistics][OT.weightedAreaUnderRoc].to_f)
- @model.update(:weighted_area_under_roc => validation.metadata[OT.classificationStatistics][OT.averageAreaUnderRoc].to_f)
+ @model.update(:average_area_under_roc => validation.metadata[OT.classificationStatistics][OT.averageAreaUnderRoc].to_f)
validation.metadata[OT.classificationStatistics][OT.classValueStatistics].each do |m|
if m[OT.classValue] =~ TRUE_REGEXP
#HACK: estimate true feature value correctly
diff --git a/helper.rb b/helper.rb
index 698fd3e..80707c3 100644
--- a/helper.rb
+++ b/helper.rb
@@ -1,35 +1,5 @@
helpers do
- def login(username, password)
- logout
- session[:subjectid] = OpenTox::Authorization.authenticate(username, password)
- #LOGGER.debug "ToxCreate login user #{username} with subjectid: " + session[:subjectid].to_s
- if session[:subjectid] != nil
- session[:username] = username
- return true
- else
- session[:username] = ""
- return false
- end
- end
-
- def logout
- if session[:subjectid] != nil
- session[:subjectid] = nil
- session[:username] = ""
- return true
- end
- return false
- end
-
- def logged_in()
- return true if !AA_SERVER
- if session[:subjectid] != nil
- return OpenTox::Authorization.is_token_valid(session[:subjectid])
- end
- return false
- end
-
def is_authorized(uri, action)
if OpenTox::Authorization.server && session[:subjectid] != nil
return OpenTox::Authorization.authorized?(uri, action, session[:subjectid])
diff --git a/model.rb b/model.rb
index e433893..bab5bde 100644
--- a/model.rb
+++ b/model.rb
@@ -31,7 +31,7 @@ class ToxCreateModel < Ohm::Model
attribute :nr_compounds
attribute :nr_predictions
attribute :correct_predictions
- attribute :weighted_area_under_roc
+ attribute :average_area_under_roc
attribute :sensitivity
attribute :specificity
attribute :r_square
diff --git a/views/classification_validation.haml b/views/classification_validation.haml
index dd2a7ae..362a76f 100644
--- a/views/classification_validation.haml
+++ b/views/classification_validation.haml
@@ -5,7 +5,7 @@
%dt
%a{:href => "http://en.wikipedia.org/wiki/Receiver_operating_characteristic", :rel => "external"} Average area under ROC:
%dd
- = sprintf("%.3f", model.weighted_area_under_roc.to_f) if model.weighted_area_under_roc
+ = sprintf("%.3f", model.average_area_under_roc.to_f) if model.average_area_under_roc
%dt
%a{:href => "http://en.wikipedia.org/wiki/Sensitivity_and_specificity", :rel => "external"} Specificity:
%dd= sprintf("%.3f", model.specificity.to_f) if model.specificity