summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--example.rb3
-rw-r--r--lib/ot_predictions.rb2
-rw-r--r--nightly/nightly.rb27
-rw-r--r--report/report_application.rb9
-rw-r--r--report/report_format.rb2
-rw-r--r--validation/validation_test.rb16
6 files changed, 32 insertions, 27 deletions
diff --git a/example.rb b/example.rb
index 9e62763..9684748 100644
--- a/example.rb
+++ b/example.rb
@@ -57,7 +57,7 @@ class Example
log "upload dataset"
halt 400,"File not found: "+@@file.path.to_s unless File.exist?(@@file.path)
data = File.read(@@file.path)
- data_uri = OpenTox::RestClientWrapper.post(@@config[:services]["opentox-dataset"],data,{:content_type => @@file_type},true).chomp("\n")
+ data_uri = OpenTox::RestClientWrapper.post(@@config[:services]["opentox-dataset"],{:content_type => @@file_type},data).chomp("\n")
log "train-test-validation"
Lib::Validation.auto_migrate!
@@ -153,6 +153,7 @@ class Example
# deletes resources listed by service
def self.delete_all(uri_list_service)
uri_list = OpenTox::RestClientWrapper.get(uri_list_service)
+ LOGGER.debug "deleting: "+uri_list.inspect
uri_list.split("\n").each do |uri|
OpenTox::RestClientWrapper.delete(uri)
end
diff --git a/lib/ot_predictions.rb b/lib/ot_predictions.rb
index fa17547..6d02466 100644
--- a/lib/ot_predictions.rb
+++ b/lib/ot_predictions.rb
@@ -34,7 +34,7 @@ module Lib
raise "test dataset not found: '"+test_dataset_uri.to_s+"'" unless test_dataset
raise "prediction_feature missing" unless prediction_feature
- if test_target_dataset_uri == nil || test_target_dataset_uri==test_dataset_uri
+ if test_target_dataset_uri == nil || test_target_dataset_uri.strip.size==0 || test_target_dataset_uri==test_dataset_uri
test_target_dataset_uri = test_dataset_uri
test_target_dataset = test_dataset
raise "prediction_feature not found in test_dataset, specify a test_target_dataset\n"+
diff --git a/nightly/nightly.rb b/nightly/nightly.rb
index a085c30..97d8c94 100644
--- a/nightly/nightly.rb
+++ b/nightly/nightly.rb
@@ -17,7 +17,7 @@ class Nightly
def self.build_nightly
OpenTox::Task.as_task do
- LOGGER.info("Building nightly report.")
+ LOGGER.info("Building nightly report")
benchmarks = [ HamsterTrainingTestBenchmark.new,
MiniRegressionBenchmark.new,
@@ -27,18 +27,18 @@ class Nightly
running = []
report = Reports::XMLReport.new("Nightly Validation", Time.now.strftime("Created at %m.%d.%Y - %H:%M"))
benchmarks.each do |b|
- running << b.class.to_s+b.object_id.to_s
+ running << b.class.to_s.gsub(/Nightly::/, "")+b.object_id.to_s
Thread.new do
begin
b.build
ensure
- running.delete(b.class.to_s+b.object_id.to_s)
+ running.delete(b.class.to_s.gsub(/Nightly::/, "")+b.object_id.to_s)
end
end
end
wait = 0
while running.size>0
- LOGGER.debug "Nighlty report waiting for "+running.inspect if wait%10==0
+ LOGGER.debug "Nighlty report waiting for "+running.inspect if wait%60==0
wait += 1
sleep 1
end
@@ -175,12 +175,12 @@ class Nightly
Thread.new do
running << @comparables[i]+i.to_s
begin
- LOGGER.debug "validate: "+@algs[i].to_s
+ LOGGER.debug "Validate: "+@algs[i].to_s
@validations[i] = Util.validate_alg(@train_data, @test_data, @test_class_data,
@algs[i], URI.decode(@pred_feature), @alg_params[i]).to_s
begin
- LOGGER.debug "building validation-report"
+ LOGGER.debug "Building validation-report for "+@validations[i].to_s+" ("+@algs[i].to_s+")"
@reports[i] = Util.create_report(@validations[i])
rescue => ex
LOGGER.error "validation-report error: "+ex.message
@@ -199,7 +199,7 @@ class Nightly
end
wait = 0
while running.size>0
- LOGGER.debug self.class.to_s+" waiting for "+running.inspect if wait%5==0
+ LOGGER.debug self.class.to_s.gsub(/Nightly::/, "")+" waiting for "+running.inspect if wait%20==0
wait += 1
sleep 1
end
@@ -235,8 +235,8 @@ class Nightly
end
def info
- res = [ "This is the regression use case used in D2.2."+
- "The task is to predict LC50 values of the well known Fathead Minnow Acute Toxicity dataset."+
+ res = [ "This is the regression use case used in D2.2. "+
+ "The task is to predict LC50 values of the well known Fathead Minnow Acute Toxicity dataset. "+
"JOELIB was used to compute numerical descriptors as features." ] + super
return res
end
@@ -245,7 +245,8 @@ class Nightly
@algs = [
"http://opentox.informatik.tu-muenchen.de:8080/OpenTox-dev/algorithm/kNNregression",
"http://opentox.informatik.tu-muenchen.de:8080/OpenTox-dev/algorithm/M5P",
- "http://opentox.informatik.tu-muenchen.de:8080/OpenTox-dev/algorithm/GaussP"]
+ "http://opentox.informatik.tu-muenchen.de:8080/OpenTox-dev/algorithm/GaussP"
+ ]
@alg_params = [nil, nil, nil]
@train_data = "http://ambit.uni-plovdiv.bg:8080/ambit2/dataset/639"
@test_data = "http://ambit.uni-plovdiv.bg:8080/ambit2/dataset/640"
@@ -291,7 +292,7 @@ class Nightly
def self.upload_dataset(dataset_service, file, file_type)
raise "File not found: "+file.path.to_s unless File.exist?(file.path)
data = File.read(file.path)
- data_uri = OpenTox::RestClientWrapper.post dataset_service, data, {:content_type => file_type}, true
+ data_uri = OpenTox::RestClientWrapper.post dataset_service, {:content_type => file_type}, data
#data_uri = OpenTox::Task.find(data_uri).wait_for_resource.to_s if OpenTox::Utils.task_uri?(data_uri)
return data_uri
end
@@ -304,7 +305,7 @@ class Nightly
def self.validate_alg(train_data, test_data, test_class_data, alg, feature, alg_params)
uri = OpenTox::RestClientWrapper.post @@validation_service, { :training_dataset_uri => train_data, :test_dataset_uri => test_data,
:test_target_dataset_uri => test_class_data,
- :algorithm_uri => alg, :prediction_feature => feature, :algorithm_params => alg_params }, nil, true
+ :algorithm_uri => alg, :prediction_feature => feature, :algorithm_params => alg_params }
#LOGGER.info "waiting for validation "+uri.to_s
#uri = OpenTox::Task.find(uri).wait_for_resource.to_s if OpenTox::Utils.task_uri?(uri)
#LOGGER.info "validaiton done "+uri.to_s
@@ -312,7 +313,7 @@ class Nightly
end
def self.create_report(validation)
- uri = OpenTox::RestClientWrapper.post File.join(@@validation_service,"report/validation"), { :validation_uris => validation }, nil, true
+ uri = OpenTox::RestClientWrapper.post File.join(@@validation_service,"report/validation"), { :validation_uris => validation }
#uri = OpenTox::Task.find(uri).wait_for_resource.to_s if OpenTox::Utils.task_uri?(uri)
return uri
end
diff --git a/report/report_application.rb b/report/report_application.rb
index 83a6bc9..7a3815e 100644
--- a/report/report_application.rb
+++ b/report/report_application.rb
@@ -15,6 +15,7 @@ def perform
end
end
+
get '/report/:type/css_style_sheet/?' do
perform do |rs|
"@import \""+params[:css_style_sheet]+"\";"
@@ -81,8 +82,10 @@ delete '/report/:type/:id' do
end
post '/report/:type' do
- perform do |rs|
- content_type "text/uri-list"
- rs.create_report(params[:type],params[:validation_uris]?params[:validation_uris].split(/\n|,/):nil)
+ OpenTox::Task.as_task do
+ perform do |rs|
+ content_type "text/uri-list"
+ rs.create_report(params[:type],params[:validation_uris]?params[:validation_uris].split(/\n|,/):nil)
+ end
end
end
diff --git a/report/report_format.rb b/report/report_format.rb
index 9f80524..e9a5645 100644
--- a/report/report_format.rb
+++ b/report/report_format.rb
@@ -56,7 +56,7 @@ module Reports::ReportFormat
cmd = "java -jar "+ENV['SAXON_JAR']+" -o:" + File.join(directory,html_filename.to_s)+
" -s:"+File.join(directory,xml_filename.to_s)+" -xsl:"+ENV['REPORT_XSL']+" -versionmsg:off"+css.to_s
- LOGGER.debug "converting report to html: '"+cmd+"'"
+ LOGGER.debug "Converting report to html: '"+cmd+"'"
IO.popen(cmd.to_s) do |f|
while line = f.gets do
LOGGER.info "saxon-xslt> "+line
diff --git a/validation/validation_test.rb b/validation/validation_test.rb
index 0618ec5..3e68081 100644
--- a/validation/validation_test.rb
+++ b/validation/validation_test.rb
@@ -26,7 +26,7 @@ class ValidationTest < Test::Unit::TestCase
#puts last_response.body
#prepare_examples
- #do_test_examples # USES CURL, DO NOT FORGET TO RESTART
+ #do_test_examples # USES CURL, DO NOT FORGET TO RESTART VALIDATION SERVICE
#ex = ex_ntua
#ex = ex_ntua2
@@ -144,7 +144,7 @@ class ValidationTest < Test::Unit::TestCase
def ex_ntua
ex = Example.new
ex.classification = false
- ex.alg = "http://opentox.ntua.gr:3000/algorithm/mlr"
+ ex.alg = "http://opentox.ntua.gr:3003/algorithm/mlr"
#ex.orig_data = "http://apps.ideaconsult.net:8180/ambit2/dataset/52"
@@ -171,14 +171,14 @@ class ValidationTest < Test::Unit::TestCase
#ex.alg = "http://opentox.informatik.tu-muenchen.de:8080/OpenTox-dev/algorithm/GaussP"
#mini
- #ex.train_data = "http://ambit.uni-plovdiv.bg:8080/ambit2/dataset/342"
- #ex.test_data = "http://ambit.uni-plovdiv.bg:8080/ambit2/dataset/342"
- #ex.act_feat = "http://ambit.uni-plovdiv.bg:8080/ambit2/feature/103141"
+ ex.train_data = "http://ambit.uni-plovdiv.bg:8080/ambit2/dataset/342"
+ ex.test_data = "http://ambit.uni-plovdiv.bg:8080/ambit2/dataset/342"
+ ex.act_feat = "http://ambit.uni-plovdiv.bg:8080/ambit2/feature/103141"
#big
- ex.train_data = "http://ambit.uni-plovdiv.bg:8080/ambit2/dataset/639"
- ex.test_data = "http://ambit.uni-plovdiv.bg:8080/ambit2/dataset/640"
- ex.act_feat = "http://ambit.uni-plovdiv.bg:8080/ambit2/feature/264185"
+ #ex.train_data = "http://ambit.uni-plovdiv.bg:8080/ambit2/dataset/639"
+ #ex.test_data = "http://ambit.uni-plovdiv.bg:8080/ambit2/dataset/640"
+ #ex.act_feat = "http://ambit.uni-plovdiv.bg:8080/ambit2/feature/264185"
#ex.act_feat = "http://ambit.uni-plovdiv.bg:8080/ambit2/feature/264187" #test
# example model