summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2016-10-13 17:34:31 +0200
committerChristoph Helma <helma@in-silico.ch>2016-10-13 17:34:31 +0200
commitad7ec6a1e33f69557fe64371581d5f42a65ecaa8 (patch)
tree7bb819b950790d34fb4bc9746f67b71298f2d31c /test
parent9e99495ecbff147218023c136bade9e56a502fed (diff)
classification fixed
Diffstat (limited to 'test')
-rw-r--r--test/model-classification.rb (renamed from test/classification.rb)16
-rw-r--r--test/model.rb7
-rw-r--r--test/nanoparticles.rb13
3 files changed, 22 insertions, 14 deletions
diff --git a/test/classification.rb b/test/model-classification.rb
index c670bb5..1424f6a 100644
--- a/test/classification.rb
+++ b/test/model-classification.rb
@@ -4,7 +4,10 @@ class LazarClassificationTest < MiniTest::Test
def test_classification_default
algorithms = {
- :descriptors => [ "MP2D" ],
+ :descriptors => {
+ :method => "fingerprint",
+ :type => "MP2D"
+ },
:similarity => {
:method => "Algorithm::Similarity.tanimoto",
:min => 0.1
@@ -55,7 +58,10 @@ class LazarClassificationTest < MiniTest::Test
def test_classification_parameters
algorithms = {
- :descriptors => ['MACCS'],
+ :descriptors => {
+ :method => "fingerprint",
+ :type => "MACCS"
+ },
:similarity => {
:min => 0.4
},
@@ -86,7 +92,11 @@ class LazarClassificationTest < MiniTest::Test
training_dataset.delete
end
- def test_fingerprint_feature_selection
+ def test_caret_classification
+ skip
+ end
+
+ def test_fingerprint_chisq_feature_selection
skip
end
diff --git a/test/model.rb b/test/model.rb
index 322ad90..027efe4 100644
--- a/test/model.rb
+++ b/test/model.rb
@@ -49,7 +49,10 @@ class ModelTest < MiniTest::Test
def test_physchem_regression
algorithms = {
- :descriptors => [PhysChem::OPENBABEL],
+ :descriptors => {
+ :method => "calculate_properties",
+ :features => PhysChem.openbabel_descriptors,
+ },
:similarity => {
:method => "Algorithm::Similarity.cosine",
}
@@ -60,9 +63,9 @@ class ModelTest < MiniTest::Test
assert_equal "Algorithm::Caret.pls", model.algorithms[:prediction][:method]
assert_equal "Algorithm::Similarity.cosine", model.algorithms[:similarity][:method]
assert_equal 0.1, model.algorithms[:similarity][:min]
+ algorithms[:descriptors].delete :features
assert_equal algorithms[:descriptors], model.algorithms[:descriptors]
prediction = model.predict training_dataset.substances[10]
- p prediction
refute_nil prediction[:value]
# TODO test predictin
end
diff --git a/test/nanoparticles.rb b/test/nanoparticles.rb
index c489cb7..9a67e63 100644
--- a/test/nanoparticles.rb
+++ b/test/nanoparticles.rb
@@ -1,6 +1,5 @@
require_relative "setup.rb"
-
class NanoparticleTest < MiniTest::Test
include OpenTox::Validation
@@ -13,7 +12,7 @@ class NanoparticleTest < MiniTest::Test
@prediction_feature = @training_dataset.features.select{|f| f["name"] == 'log2(Net cell association)'}.first
end
- def test_create_model
+ def test_nanoparticle_model
model = Model::Lazar.create training_dataset: @training_dataset, prediction_feature: @prediction_feature
nanoparticle = @training_dataset.nanoparticles[-34]
prediction = model.predict nanoparticle
@@ -23,6 +22,8 @@ class NanoparticleTest < MiniTest::Test
model.delete
end
+ # validations
+
def test_validate_default_nanoparticle_model
model = Model::Lazar.create training_dataset: @training_dataset, prediction_feature: @prediction_feature
cv = CrossValidation.create model
@@ -77,15 +78,9 @@ class NanoparticleTest < MiniTest::Test
refute_nil cv.rmse
end
- def test_export
- skip
- Dataset.all.each do |d|
- puts d.to_csv
- end
- end
def test_import_ld
- skip
+ skip # Ambit JSON-LD export defunct
dataset_ids = Import::Enanomapper.import_ld
end
end