diff options
author | Christoph Helma <helma@in-silico.ch> | 2015-08-24 12:17:07 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2015-08-24 12:17:07 +0200 |
commit | 8c6c59980bc82dc2177147f2fe34adf8bfbc1539 (patch) | |
tree | 35fb78389a9ac2d54d4d2190c41a8269a754f205 /test/prediction_models.rb | |
parent | 398d8ca681db3aa0a0552eee026705e60dd8449d (diff) |
Model::Prediction with tests, initial indexesv0.0.8
Diffstat (limited to 'test/prediction_models.rb')
-rw-r--r-- | test/prediction_models.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/prediction_models.rb b/test/prediction_models.rb new file mode 100644 index 0000000..b4ad415 --- /dev/null +++ b/test/prediction_models.rb @@ -0,0 +1,23 @@ +require_relative "setup.rb" + +class PredictionModelTest < MiniTest::Test + + def test_prediction_model + dataset = Dataset.from_csv_file "#{DATA_DIR}/hamster_carcinogenicity.csv" + model = Model::LazarFminerClassification.create dataset + cv = ClassificationCrossValidation.create model + metadata = JSON.parse(File.read("#{DATA_DIR}/hamster_carcinogenicity.json")) + + metadata[:model_id] = model.id + metadata[:crossvalidation_id] = cv.id + pm = Model::Prediction.new(metadata) + pm.save + [:endpoint,:species,:source].each do |p| + refute_empty pm[p] + end + assert pm.crossvalidation.accuracy > 0.8 + prediction = pm.predict Compound.from_smiles("CCCC(NN)C") + assert_equal "true", prediction[:value] + pm.delete + end +end |