summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormguetlein <martin.guetlein@gmail.com>2011-02-23 12:14:04 +0100
committermguetlein <martin.guetlein@gmail.com>2011-02-23 12:14:04 +0100
commite57856a3c2cd10df207e722301c24a022e9fd802 (patch)
tree8d66572b851affa4cc963ceb779992c073a06e95
parent84b787bf6d99f6b8cce56df2bc45a8b93ada4d64 (diff)
extend limit to 512 from 255, plus minor fix
-rwxr-xr-xlib/ot_predictions.rb3
-rwxr-xr-xlib/validation_db.rb20
-rwxr-xr-xtest/test_examples.rb10
-rwxr-xr-xvalidation/validation_service.rb6
-rwxr-xr-xvalidation/validation_test.rb12
5 files changed, 37 insertions, 14 deletions
diff --git a/lib/ot_predictions.rb b/lib/ot_predictions.rb
index 116b4db..eb80205 100755
--- a/lib/ot_predictions.rb
+++ b/lib/ot_predictions.rb
@@ -158,7 +158,8 @@ module Lib
else
v = dataset.data_entries[compound][feature]
end
- raise "no array" unless v.is_a?(Array)
+ return nil if v==nil
+ raise "no array "+v.class.to_s+" : '"+v.to_s+"'" unless v.is_a?(Array)
if v.size>1
v.uniq!
raise "not yet implemented: multiple non-equal values "+compound.to_s+" "+v.inspect if v.size>1
diff --git a/lib/validation_db.rb b/lib/validation_db.rb
index 25f1d66..d12f5ce 100755
--- a/lib/validation_db.rb
+++ b/lib/validation_db.rb
@@ -58,14 +58,14 @@ module Lib
include DataMapper::Resource
property :id, Serial
- property :validation_type, String, :length => 255
- property :model_uri, String, :length => 255
- property :algorithm_uri, String, :length => 255
- property :training_dataset_uri, String, :length => 255
- property :test_target_dataset_uri, String, :length => 255
- property :test_dataset_uri, String, :length => 255
- property :prediction_dataset_uri, String, :length => 255
- property :prediction_feature, String, :length => 255
+ property :validation_type, String, :length => 512
+ property :model_uri, String, :length => 512
+ property :algorithm_uri, String, :length => 512
+ property :training_dataset_uri, String, :length => 512
+ property :test_target_dataset_uri, String, :length => 512
+ property :test_dataset_uri, String, :length => 512
+ property :prediction_dataset_uri, String, :length => 512
+ property :prediction_feature, String, :length => 512
property :created_at, DateTime
property :num_instances, Integer
property :num_without_class, Integer
@@ -121,8 +121,8 @@ module Lib
include DataMapper::Resource
property :id, Serial
- property :algorithm_uri, String, :length => 255
- property :dataset_uri, String, :length => 255
+ property :algorithm_uri, String, :length => 512
+ property :dataset_uri, String, :length => 512
property :created_at, DateTime
property :num_folds, Integer, :default => 10
property :random_seed, Integer, :default => 1
diff --git a/test/test_examples.rb b/test/test_examples.rb
index 503bc13..b2b9c19 100755
--- a/test/test_examples.rb
+++ b/test/test_examples.rb
@@ -394,6 +394,14 @@ module ValidationExamples
end
end
+ class AmbitAquaticModelValidation < ModelValidation
+ def initialize
+ @model_uri = "http://apps.ideaconsult.net:8080/ambit2/model/130668"
+ @test_dataset_uri = "http://apps.ideaconsult.net:8080/ambit2/dataset/186293?feature_uris[]=http://apps.ideaconsult.net:8080/ambit2/feature/430904&feature_uris[]=http://apps.ideaconsult.net:8080/ambit2/feature/430905"
+ @prediction_feature = "http://apps.ideaconsult.net:8080/ambit2/feature/430905"
+ end
+ end
+
class AmbitTrainingTest < TrainingTestValidation
def initialize
@training_dataset_uri = "https://ambit.uni-plovdiv.bg:8443/ambit2/dataset/R401560"
@@ -590,6 +598,8 @@ module ValidationExamples
"19f" => [ AmbitBursiTrainingTestSplit ],
"19g" => [ AmbitJ48TrainingTest ],
"19h" => [ AmbitJ48TrainingTestSplit ],
+ "19i" => [ AmbitAquaticModelValidation ],
+
}
diff --git a/validation/validation_service.rb b/validation/validation_service.rb
index d917a96..a1efba5 100755
--- a/validation/validation_service.rb
+++ b/validation/validation_service.rb
@@ -228,7 +228,11 @@ module Validation
:num_unpredicted => prediction.num_unpredicted,
:percent_unpredicted => prediction.percent_unpredicted,
:finished => true}
- self.save
+ begin
+ self.save
+ rescue DataMapper::SaveFailureError => e
+ raise "could not save validation: "+e.resource.errors.inspect
+ end
end
task.progress(100) if task
diff --git a/validation/validation_test.rb b/validation/validation_test.rb
index 3f10ca2..ffb25c4 100755
--- a/validation/validation_test.rb
+++ b/validation/validation_test.rb
@@ -115,6 +115,14 @@ class ValidationTest < Test::Unit::TestCase
# get "/crossvalidation/2",nil,'HTTP_ACCEPT' => "application/rdf+xml"
#puts last_response.body
#exit
+
+# OpenTox::Crossvalidation.create(
+# :dataset_uri=>"http://local-ot/dataset/1874",
+# :algorithm_uri=>"http://local-ot/algorithm/lazar",
+# :prediction_feature=>"http://local-ot/dataset/1874/feature/Hamster%20Carcinogenicity",
+# :algorithm_params=>"feature_generation_uri=http://local-ot/algorithm/fminer/bbrc")
+
+#http://local-ot/dataset/1878
#get "/crossvalidation?model_uri=lazar"
# post "/test_validation",:select=>"6d" #,:report=>"yes,please"
@@ -209,7 +217,7 @@ class ValidationTest < Test::Unit::TestCase
# d2 = d.split(d.compounds[0..5], d.features.keys[0..1], {}, SUBJECTID)
# puts d2.to_yaml
- run_test("1b")#,:validation_uri=>"http://local-ot/validation/253") #,"http://local-ot/validation/28")#,"http://local-ot/validation/394");
+ # run_test("1b")#,:validation_uri=>"http://local-ot/validation/253") #,"http://local-ot/validation/28")#,"http://local-ot/validation/394");
#run_test("3b",:validation_uri=>"http://local-ot/validation/crossvalidation/45") #,{:dataset_uri => "http://local-ot/dataset/773", :prediction_feature => "http://local-ot/dataset/773/feature/Hamster%20Carcinogenicity"})
@@ -249,7 +257,7 @@ class ValidationTest < Test::Unit::TestCase
#delete "/1",:subjectid=>SUBJECTID
- #run_test("7b","http://local-ot/validation/21")
+ run_test("19i")
#run_test("3a","http://local-ot/validation/crossvalidation/4")
#run_test("3b","http://local-ot/validation/crossvalidation/3")