diff options
author | Christoph Helma <helma@in-silico.ch> | 2015-08-07 19:49:31 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2015-08-07 19:49:31 +0200 |
commit | 2dc460ee78325c731ab12b375c2bd12e4e3393e8 (patch) | |
tree | e01efea5d9a187d58b4939bf257039a99a675921 | |
parent | 03be6b36a03f00bbb432c4161da7312011ffa076 (diff) |
initial k-nn weighted average implementation, validation test added
-rw-r--r-- | test/compound.rb | 16 | ||||
-rw-r--r-- | test/setup.rb | 2 | ||||
-rw-r--r-- | test/validation.rb | 13 |
3 files changed, 30 insertions, 1 deletions
diff --git a/test/compound.rb b/test/compound.rb index 86930b6..2bf0204 100644 --- a/test/compound.rb +++ b/test/compound.rb @@ -74,4 +74,20 @@ class CompoundTest < MiniTest::Test assert !c.sdf_id.nil? end + def test_fingerprint + c = OpenTox::Compound.from_smiles "CC(=O)CC(C)C#N" + assert c.fp4.collect{|fid| Feature.find(fid).name}.include? ("1,3-Tautomerizable") + assert_equal c.fp4.size, c.fp4_size + end + + def test_neighbors + d = Dataset.from_csv_file "data/EPAFHM.csv" + d.compounds.each do |c| + refute_nil c.fp4 + end + c = d.compounds[371] + #p c + p c.neighbors + end + end diff --git a/test/setup.rb b/test/setup.rb index cfa670d..d8f05d5 100644 --- a/test/setup.rb +++ b/test/setup.rb @@ -2,7 +2,7 @@ require 'minitest/autorun' require 'bundler' Bundler.require require 'opentox-client' -require File.join(ENV["HOME"],".opentox","config","test.rb") +#require File.join(ENV["HOME"],".opentox","config","test.rb") include OpenTox TEST_DIR ||= File.expand_path(File.dirname(__FILE__)) diff --git a/test/validation.rb b/test/validation.rb new file mode 100644 index 0000000..80055f2 --- /dev/null +++ b/test/validation.rb @@ -0,0 +1,13 @@ +require_relative "setup.rb" + +class ValidationTest < MiniTest::Test + + def test_classification_crossvalidation + dataset = Dataset.from_csv_file "#{DATA_DIR}/hamster_carcinogenicity.csv" + features = Algorithm::Fminer.bbrc dataset + model = Model::Lazar.create dataset, features + cv = CrossValidation.create model + p cv + end + +end |