diff options
author | Christoph Helma <helma@in-silico.ch> | 2016-04-13 15:15:51 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2016-04-13 15:15:51 +0200 |
commit | a8368dda776c05331474adf7eaf9a6e413a3b1eb (patch) | |
tree | daafac9a7453a8d453fc6992293afe6f6a937551 /test | |
parent | 84222bae2bbb9fb3e0ce3e65de1be8e7f94d2147 (diff) |
validation tests pass
Diffstat (limited to 'test')
-rw-r--r-- | test/classification.rb | 6 | ||||
-rw-r--r-- | test/validation.rb | 6 |
2 files changed, 7 insertions, 5 deletions
diff --git a/test/classification.rb b/test/classification.rb index bedbe14..af23db6 100644 --- a/test/classification.rb +++ b/test/classification.rb @@ -33,8 +33,10 @@ class LazarClassificationTest < MiniTest::Test prediction = model.predict compound_dataset assert_equal compound_dataset.compounds, prediction.compounds - assert_equal "Could not find similar compounds with experimental data in the training dataset.", prediction.data_entries[7][3] - assert_equal "1 compounds have been removed from neighbors, because they have the same structure as the query compound.", prediction.data_entries[14][3] + cid = prediction.compounds[7].id.to_s + assert_equal "Could not find similar compounds with experimental data in the training dataset.", prediction.predictions[cid][:warning] + cid = prediction.compounds[9].id.to_s + assert_equal "1 compounds have been removed from neighbors, because they have the same structure as the query compound.", prediction.predictions[cid][:warning] # cleanup [training_dataset,model,compound_dataset].each{|o| o.delete} end diff --git a/test/validation.rb b/test/validation.rb index d8eea59..e702278 100644 --- a/test/validation.rb +++ b/test/validation.rb @@ -8,15 +8,15 @@ class ValidationTest < MiniTest::Test dataset = Dataset.from_csv_file "#{DATA_DIR}/hamster_carcinogenicity.csv" model = Model::LazarClassification.create dataset cv = ClassificationCrossValidation.create model - assert cv.accuracy > 0.7, "Accuracy (#{cv.accuracy}) should be larger than 0.7" + 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" end def test_default_regression_crossvalidation dataset = Dataset.from_csv_file "#{DATA_DIR}/EPAFHM.medi.csv" model = Model::LazarRegression.create dataset cv = RegressionCrossValidation.create model - assert cv.rmse < 1.5, "RMSE > 1.5" - assert cv.mae < 1 + assert cv.rmse < 1.5, "RMSE #{cv.rmse} should be larger than 1.5, this may occur due to an unfavorable training/test set split" + assert cv.mae < 1, "MAE #{cv.mae} should be larger than 1, this may occur due to an unfavorable training/test set split" end # parameters |