summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2019-08-19 15:28:44 +0200
committerChristoph Helma <helma@in-silico.ch>2019-08-19 15:28:44 +0200
commit15f093eee66597b0b4a4defa7d8645a3e13372a0 (patch)
tree19da2771f88bbb3c77d2c6905a0c4b1694bf5620 /test
parenta43af9e1d26d564fdbcf089977908a19299acd5a (diff)
parent488ce9fe6d4b715680675861105b8c52a7535140 (diff)
Merge branch 'development' of ssh://git.in-silico.ch:2222/home/ist/public/lazar into developmentdevelopment
Diffstat (limited to 'test')
-rw-r--r--test/classification-validation.rb28
-rw-r--r--test/regression-validation.rb17
2 files changed, 45 insertions, 0 deletions
diff --git a/test/classification-validation.rb b/test/classification-validation.rb
index 33f0353..b913e1e 100644
--- a/test/classification-validation.rb
+++ b/test/classification-validation.rb
@@ -36,6 +36,34 @@ class ClassificationValidationTest < MiniTest::Test
refute_nil validation.model.training_dataset_id
refute_equal model.training_dataset_id, validation.model.training_dataset_id
assert_equal params, validation_params
+ keys = cv.accuracy.keys
+ av = cv.accept_values
+ types = ["nr_predictions", \
+ "predictivity", \
+ "true_rate", \
+ "confusion_matrix"
+ ]
+ types.each do |type|
+ keys.each do |key|
+ case type
+ when "confusion_matrix"
+ cv[type][key].each do |arr|
+ arr.each do |a|
+ refute_nil a
+ assert a > 0, "#{cv[type][key]} values should be greater than 0."
+ end
+ end
+ when "predictivity", "true_rate"
+ av.each do |v|
+ refute_nil cv[type][key][v]
+ assert cv[type][key][v] > 0, "#{cv[type][key]} values should be greater than 0."
+ end
+ else
+ refute_nil cv[type][key]
+ assert cv[type][key] > 0, "#{cv[type][key]} value should be greater than 0."
+ end
+ end
+ end
end
end
diff --git a/test/regression-validation.rb b/test/regression-validation.rb
index 65bec63..9a2da8f 100644
--- a/test/regression-validation.rb
+++ b/test/regression-validation.rb
@@ -86,6 +86,23 @@ class RegressionValidationTest < MiniTest::Test
repeated_cv.crossvalidations.each do |cv|
assert cv.r_squared[:all] > 0.34, "R^2 (#{cv.r_squared[:all]}) should be larger than 0.34"
assert cv.rmse[:all] < 1.5, "RMSE (#{cv.rmse[:all]}) should be smaller than 0.5"
+=begin
+ #actually some values can be 0 or nil depending on the random folds in this small dataset
+ keys = cv.rmse.keys
+ types = ["rmse", \
+ "r_squared", \
+ "mae", \
+ "nr_predictions", \
+ "within_prediction_interval", \
+ "out_of_prediction_interval"
+ ]
+ types.each do |type|
+ keys.each do |key|
+ refute_nil cv[type][key]
+ assert cv[type][key] > 0
+ end
+ end
+=end
end
end