summaryrefslogtreecommitdiff
path: root/test/model-classification.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/model-classification.rb')
-rw-r--r--test/model-classification.rb22
1 files changed, 11 insertions, 11 deletions
diff --git a/test/model-classification.rb b/test/model-classification.rb
index 0bb3e83..1424f6a 100644
--- a/test/model-classification.rb
+++ b/test/model-classification.rb
@@ -10,35 +10,35 @@ class LazarClassificationTest < MiniTest::Test
},
:similarity => {
:method => "Algorithm::Similarity.tanimoto",
- :min => 0.5
+ :min => 0.1
},
- :feature_selection => nil,
:prediction => {
:method => "Algorithm::Classification.weighted_majority_vote",
},
+ :feature_selection => nil,
}
training_dataset = Dataset.from_csv_file File.join(DATA_DIR,"hamster_carcinogenicity.csv")
model = Model::Lazar.create training_dataset: training_dataset
assert_kind_of Model::LazarClassification, model
assert_equal algorithms, model.algorithms
- substance = training_dataset.substances[49]
+ substance = training_dataset.substances[10]
prediction = model.predict substance
assert_equal "false", prediction[:value]
[ {
- :compound => OpenTox::Compound.from_inchi("InChI=1S/C6H14N2O4/c1-5(10)2-8(7-12)3-6(11)4-9/h5-6,9-11H,2-4H2,1H3"),
+ :compound => OpenTox::Compound.from_inchi("InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H"),
:prediction => "false",
},{
- :compound => OpenTox::Compound.from_smiles("OCC(CN(CC(O)C)N=O)O"),
+ :compound => OpenTox::Compound.from_smiles("c1ccccc1NN"),
:prediction => "false",
} ].each do |example|
prediction = model.predict example[:compound]
assert_equal example[:prediction], prediction[:value]
end
- compound = Compound.from_smiles "O=NN1CCC1"
+ compound = Compound.from_smiles "CCO"
prediction = model.predict compound
assert_equal "true", prediction[:value]
- #assert_equal ["false"], prediction[:measurements]
+ assert_equal ["false"], prediction[:measurements]
# make a dataset prediction
compound_dataset = OpenTox::Dataset.from_csv_file File.join(DATA_DIR,"EPAFHM.mini_log10.csv")
@@ -46,12 +46,12 @@ class LazarClassificationTest < MiniTest::Test
assert_equal compound_dataset.compounds, prediction_dataset.compounds
cid = prediction_dataset.compounds[7].id.to_s
- assert_equal "Could not find similar substances with experimental data in the training dataset.", prediction_dataset.predictions[cid][:warnings][0]
+ assert_equal "Could not find similar substances with experimental data in the training dataset.", prediction_dataset.predictions[cid][:warning]
prediction_dataset.predictions.each do |cid,pred|
- assert_equal "Could not find similar substances with experimental data in the training dataset.", pred[:warnings][0] if pred[:value].nil?
+ assert_equal "Could not find similar substances with experimental data in the training dataset.", pred[:warning] if pred[:value].nil?
end
cid = Compound.from_smiles("CCOC(=O)N").id.to_s
- assert_match "excluded", prediction_dataset.predictions[cid][:info]
+ assert_match "excluded", prediction_dataset.predictions[cid][:warning]
# cleanup
[training_dataset,model,compound_dataset,prediction_dataset].each{|o| o.delete}
end
@@ -85,7 +85,7 @@ class LazarClassificationTest < MiniTest::Test
model = Model::Lazar.create training_dataset: training_dataset
t = Time.now
2.times do
- compound = Compound.from_smiles("OCC(CN(CC(O)C)N=O)O")
+ compound = Compound.from_smiles("Clc1ccccc1NN")
prediction = model.predict compound
assert_equal "1", prediction[:value]
end