diff options
author | Christoph Helma <helma@in-silico.ch> | 2016-11-08 16:04:49 +0100 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2016-11-08 16:04:49 +0100 |
commit | c6e86fc1bfee7cb91782dd7067408d78a8e48ed9 (patch) | |
tree | f5c2c04d8a30e68180ef0114f02e95169e89483b /test | |
parent | 280f81dcffb3b8b929ff9cbe92ba17403f5a9dd3 (diff) |
probability plot for classification
Diffstat (limited to 'test')
-rw-r--r-- | test/descriptor.rb | 4 | ||||
-rw-r--r-- | test/validation-classification.rb | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/test/descriptor.rb b/test/descriptor.rb index e5d8ff9..42d4661 100644 --- a/test/descriptor.rb +++ b/test/descriptor.rb @@ -12,7 +12,9 @@ class DescriptorTest < MiniTest::Test def test_smarts c = OpenTox::Compound.from_smiles "N=C=C1CCC(=F=FO)C1" - File.open("tmp.png","w+"){|f| f.puts c.png} + File.open("/tmp/tmp.png","w+"){|f| f.puts c.png} + assert_match /^PNG/,`file -b /tmp/tmp.png` + File.delete "/tmp/tmp.png" s = Smarts.find_or_create_by(:smarts => "F=F") result = c.smarts_match [s] assert_equal [1], result diff --git a/test/validation-classification.rb b/test/validation-classification.rb index c93e71f..fb4c3e7 100644 --- a/test/validation-classification.rb +++ b/test/validation-classification.rb @@ -11,8 +11,10 @@ class ValidationClassificationTest < MiniTest::Test cv = ClassificationCrossValidation.create model assert cv.accuracy > 0.7, "Accuracy (#{cv.accuracy}) should be larger than 0.7, this may occur due to an unfavorable training/test set split" assert cv.weighted_accuracy > cv.accuracy, "Weighted accuracy (#{cv.weighted_accuracy}) should be larger than accuracy (#{cv.accuracy})." - #p cv - #File.open("tmp.pdf","w+"){|f| f.puts cv.probability_plot} + File.open("/tmp/tmp.pdf","w+"){|f| f.puts cv.probability_plot(format:"pdf")} + p `file -b /tmp/tmp.pdf` + File.open("/tmp/tmp.png","w+"){|f| f.puts cv.probability_plot(format:"png")} + p `file -b /tmp/tmp.png` end # parameters |