diff options
author | gebele <gebele@in-silico.ch> | 2016-12-12 09:15:48 +0000 |
---|---|---|
committer | gebele <gebele@in-silico.ch> | 2016-12-12 09:15:48 +0000 |
commit | da086fad5b45c0d7b59feb40d0108ac620613933 (patch) | |
tree | 7e9cf8c9332e30552ab255ee9b30e04e904977b4 /test/classification.rb | |
parent | 32a16d99b51642cac8e75f90c43753d8d05ab770 (diff) | |
parent | 4570f11444bc10da88d849e9a2812e95a8933c8a (diff) |
merged development
Diffstat (limited to 'test/classification.rb')
-rw-r--r-- | test/classification.rb | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/test/classification.rb b/test/classification.rb deleted file mode 100644 index bedbe14..0000000 --- a/test/classification.rb +++ /dev/null @@ -1,41 +0,0 @@ -require_relative "setup.rb" - -class LazarClassificationTest < MiniTest::Test - - def test_lazar_classification - training_dataset = Dataset.from_csv_file File.join(DATA_DIR,"hamster_carcinogenicity.csv") - model = Model::LazarClassification.create training_dataset - - [ { - :compound => OpenTox::Compound.from_inchi("InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H"), - :prediction => "false", - :confidence => 0.25281385281385277, - :nr_neighbors => 11 - },{ - :compound => OpenTox::Compound.from_smiles("c1ccccc1NN"), - :prediction => "false", - :confidence => 0.3639589577089577, - :nr_neighbors => 14 - } ].each do |example| - prediction = model.predict example[:compound] - assert_equal example[:prediction], prediction[:value] - #assert_equal example[:confidence], prediction[:confidence] - #assert_equal example[:nr_neighbors], prediction[:neighbors].size - end - - compound = Compound.from_smiles "CCO" - prediction = model.predict compound - assert_equal ["false"], prediction[:database_activities] - assert_equal "true", prediction[:value] - - # make a dataset prediction - compound_dataset = OpenTox::Dataset.from_csv_file File.join(DATA_DIR,"EPAFHM.mini.csv") - 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] - # cleanup - [training_dataset,model,compound_dataset].each{|o| o.delete} - end -end |