From 280f81dcffb3b8b929ff9cbe92ba17403f5a9dd3 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Fri, 28 Oct 2016 12:31:53 +0200 Subject: adjusted r^2 removed (does not apply well to local models) --- test/validation-nanoparticle.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/validation-nanoparticle.rb b/test/validation-nanoparticle.rb index c0f2f92..1742ef2 100644 --- a/test/validation-nanoparticle.rb +++ b/test/validation-nanoparticle.rb @@ -15,6 +15,7 @@ class NanoparticleValidationTest < MiniTest::Test def test_validate_default_nanoparticle_model model = Model::Lazar.create training_dataset: @training_dataset, prediction_feature: @prediction_feature cv = CrossValidation.create model + p cv p cv.rmse p cv.r_squared #File.open("tmp.pdf","w+"){|f| f.puts cv.correlation_plot} -- cgit v1.2.3 From c6e86fc1bfee7cb91782dd7067408d78a8e48ed9 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Tue, 8 Nov 2016 16:04:49 +0100 Subject: probability plot for classification --- test/descriptor.rb | 4 +++- test/validation-classification.rb | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'test') 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 -- cgit v1.2.3