summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Maunz <andreas@maunz.de>2011-12-07 09:05:38 +0100
committerAndreas Maunz <andreas@maunz.de>2011-12-07 09:05:38 +0100
commitc3d269965d8eae3b043c967959b14377a03125d5 (patch)
tree67db4d7b3f71c1ee27a9c1468cd2149bc3296c4d
parent82696ddc414a24167f4065a953c261aed237178a (diff)
PC test w max perc neighborspc2
-rw-r--r--lazar.rb283
1 files changed, 146 insertions, 137 deletions
diff --git a/lazar.rb b/lazar.rb
index ae3ef4b..9200fb7 100644
--- a/lazar.rb
+++ b/lazar.rb
@@ -63,146 +63,155 @@ class LazarTest < Test::Unit::TestCase
=begin
=end
- ### Regression
- #
- # Nominal / Ordinal Features
- def test_regression_mlr_prop_model
- create_model :dataset_uri => @@regression_training_dataset.uri, :prediction_algorithm => "local_mlr_prop"
+# ### Regression
+# #
+# # Nominal / Ordinal Features
+# def test_regression_mlr_prop_model
+# create_model :dataset_uri => @@regression_training_dataset.uri, :prediction_algorithm => "local_mlr_prop"
+# predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN")
+# assert_equal 0.45, @predictions.first.confidence(@compounds.first).round_to(2)
+# assert_equal 0.62, @predictions.first.value(@compounds.first).round_to(2)
+# assert_equal 253, @predictions.first.neighbors(@compounds.first).size
+# assert_equal 131, @model.features.size
+# end
+#
+# def test_create_regression_model
+# create_model :dataset_uri => @@regression_training_dataset.uri
+# predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN")
+# assert_in_delta @predictions.first.value(@compounds.first), 0.15, 0.2
+# assert_equal 0.453.round_to(3), @predictions.first.confidence(@compounds.first).round_to(3)
+# assert_equal 253, @predictions.first.neighbors(@compounds.first).size
+# cleanup
+# end
+#
+# def test_create_regression_prop_model
+# create_model :dataset_uri => @@regression_training_dataset.uri, :local_svm_kernel => "propositionalized"
+# predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN")
+# assert_equal 0.453.round_to(3), @predictions.first.confidence(@compounds.first).round_to(3)
+# assert_equal 253, @predictions.first.neighbors(@compounds.first).size
+# assert_equal 131, @model.features.size
+# cleanup
+# end
+#
+# # Numeric Features
+# def test_create_regression_prop_pc_model
+# create_model :dataset_uri => @@regression_training_dataset.uri, :local_svm_kernel => "propositionalized", :pc_type => "electronic"
+# predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN")
+# assert_in_delta @predictions.first.value(@compounds.first), 0.53, 0.1
+# assert_equal 0.453.round_to(3), @predictions.first.confidence(@compounds.first).round_to(3)
+# assert_equal 253, @predictions.first.neighbors(@compounds.first).size
+# assert_equal 131, @model.features.size
+# cleanup
+# end
+#
+# def test_regression_mlr_prop_pc_model
+# create_model :dataset_uri => @@regression_training_dataset.uri, :prediction_algorithm => "local_mlr_prop", :pc_type => "electronic"
+# predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN")
+# assert_equal 0.45, @predictions.first.confidence(@compounds.first).round_to(2)
+# assert_equal 0.76, @predictions.first.value(@compounds.first).round_to(2)
+# assert_equal 253, @predictions.first.neighbors(@compounds.first).size
+# assert_equal 131, @model.features.size
+# end
+
+ def test_regression_mlr_prop_pc_model_max_n
+ create_model :dataset_uri => @@regression_training_dataset.uri, :prediction_algorithm => "local_mlr_prop", :pc_type => "electronic", :max_perc_neighbors => "5"
predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN")
- assert_equal 0.45, @predictions.first.confidence(@compounds.first).round_to(2)
- assert_equal 0.62, @predictions.first.value(@compounds.first).round_to(2)
- assert_equal 253, @predictions.first.neighbors(@compounds.first).size
+ assert_equal 0.76, @predictions.first.confidence(@compounds.first).round_to(2)
+ assert_equal 0.59, @predictions.first.value(@compounds.first).round_to(2)
+ assert_equal 24, @predictions.first.neighbors(@compounds.first).size
assert_equal 131, @model.features.size
end
-
- def test_create_regression_model
- create_model :dataset_uri => @@regression_training_dataset.uri
- predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN")
- assert_in_delta @predictions.first.value(@compounds.first), 0.15, 0.2
- assert_equal 0.453.round_to(3), @predictions.first.confidence(@compounds.first).round_to(3)
- assert_equal 253, @predictions.first.neighbors(@compounds.first).size
- cleanup
- end
-
- def test_create_regression_prop_model
- create_model :dataset_uri => @@regression_training_dataset.uri, :local_svm_kernel => "propositionalized"
- predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN")
- assert_equal 0.453.round_to(3), @predictions.first.confidence(@compounds.first).round_to(3)
- assert_equal 253, @predictions.first.neighbors(@compounds.first).size
- assert_equal 131, @model.features.size
- cleanup
- end
-
- # Numeric Features
- def test_create_regression_prop_pc_model
- create_model :dataset_uri => @@regression_training_dataset.uri, :local_svm_kernel => "propositionalized", :pc_type => "electronic"
- predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN")
- assert_in_delta @predictions.first.value(@compounds.first), 0.53, 0.1
- assert_equal 0.453.round_to(3), @predictions.first.confidence(@compounds.first).round_to(3)
- assert_equal 253, @predictions.first.neighbors(@compounds.first).size
- assert_equal 131, @model.features.size
- cleanup
- end
-
- def test_regression_mlr_prop_pc_model
- create_model :dataset_uri => @@regression_training_dataset.uri, :prediction_algorithm => "local_mlr_prop", :pc_type => "electronic"
- predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN")
- assert_equal 0.45, @predictions.first.confidence(@compounds.first).round_to(2)
- assert_equal 0.76, @predictions.first.value(@compounds.first).round_to(2)
- assert_equal 253, @predictions.first.neighbors(@compounds.first).size
- assert_equal 131, @model.features.size
- end
-
-
-
-
- ### Classification
-
- ## Nominal / Ordinal Features
-
- def test_classification_model
- create_model :dataset_uri => @@classification_training_dataset.uri
- # single prediction
- predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN")
- # dataset activity
- predict_compound OpenTox::Compound.from_smiles("CNN")
- # dataset prediction
- predict_dataset OpenTox::Dataset.create_from_csv_file("data/multicolumn.csv", @@subjectid)
- # assertions
- # single prediction
- assert_equal "false", @predictions[0].value(@compounds[0])
- assert_equal 0.2938.round_to(4), @predictions[0].confidence(@compounds[0]).round_to(4)
- assert_equal 16, @predictions[0].neighbors(@compounds[0]).size
- # dataset activity
- assert !@predictions[1].measured_activities(@compounds[1]).empty?
- assert_equal "true", @predictions[1].measured_activities(@compounds[1]).first.to_s
- assert @predictions[1].value(@compounds[1]).nil?
- # dataset prediction
- c = OpenTox::Compound.from_smiles("CC(=Nc1ccc2c(c1)Cc1ccccc21)O")
- assert_equal nil, @predictions[2].value(c)
- assert_equal "true", @predictions[2].measured_activities(c).first.to_s
- c = OpenTox::Compound.from_smiles("c1ccccc1NN")
- assert_equal "false", @predictions[2].value(c)
- assert_equal 0.2938.round_to(4) , @predictions[2].confidence(c).round_to(4)
- # model
- assert_equal 41, @model.features.size
- cleanup
- end
-
-
- def test_classification_svm_model
- create_model :dataset_uri => @@classification_training_dataset.uri, :prediction_algorithm => "local_svm_classification"
- predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN")
- predict_dataset OpenTox::Dataset.create_from_csv_file("data/multicolumn.csv", @@subjectid)
-
- assert_equal "false", @predictions[0].value(@compounds[0])
- assert_equal 0.3952, @predictions[0].confidence(@compounds[0]).round_to(4)
- assert_equal 16, @predictions[0].neighbors(@compounds[0]).size
-
- c = OpenTox::Compound.from_smiles("c1ccccc1NN")
- assert_equal 4, @predictions[1].compounds.size
- assert_equal "false", @predictions[1].value(c)
-
- assert_equal 41, @model.features.size
- cleanup
- end
-
- def test_classification_svm_prop_model
- create_model :dataset_uri => @@classification_training_dataset.uri, :prediction_algorithm => "local_svm_classification", :local_svm_kernel => "propositionalized"
- predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN")
- predict_dataset OpenTox::Dataset.create_from_csv_file("data/multicolumn.csv", @@subjectid)
-
- assert_equal "false", @predictions[0].value(@compounds[0])
- assert_equal 0.3952, @predictions[0].confidence(@compounds[0]).round_to(4)
- assert_equal 16, @predictions[0].neighbors(@compounds[0]).size
-
- c = OpenTox::Compound.from_smiles("c1ccccc1NN")
- assert_equal 4, @predictions[1].compounds.size
- assert_equal "false", @predictions[1].value(c)
-
- assert_equal 41, @model.features.size
- cleanup
- end
-
-
- ## Numeric Features
-
- def test_classification_svm_prop_pc_model
- create_model :dataset_uri => @@classification_training_dataset.uri, :prediction_algorithm => "local_svm_classification", :local_svm_kernel => "propositionalized", :pc_type => "electronic"
- predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN")
- predict_dataset OpenTox::Dataset.create_from_csv_file("data/multicolumn.csv", @@subjectid)
-
- assert_equal "false", @predictions[0].value(@compounds[0])
- assert_equal 0.3952, @predictions[0].confidence(@compounds[0]).round_to(4)
- assert_equal 16, @predictions[0].neighbors(@compounds[0]).size
-
- c = OpenTox::Compound.from_smiles("c1ccccc1NN")
- assert_equal 4, @predictions[1].compounds.size
- assert_equal "false", @predictions[1].value(c)
-
- assert_equal 41, @model.features.size
- cleanup
- end
+#
+#
+#
+#
+# ### Classification
+#
+# ## Nominal / Ordinal Features
+#
+# def test_classification_model
+# create_model :dataset_uri => @@classification_training_dataset.uri
+# # single prediction
+# predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN")
+# # dataset activity
+# predict_compound OpenTox::Compound.from_smiles("CNN")
+# # dataset prediction
+# predict_dataset OpenTox::Dataset.create_from_csv_file("data/multicolumn.csv", @@subjectid)
+# # assertions
+# # single prediction
+# assert_equal "false", @predictions[0].value(@compounds[0])
+# assert_equal 0.2938.round_to(4), @predictions[0].confidence(@compounds[0]).round_to(4)
+# assert_equal 16, @predictions[0].neighbors(@compounds[0]).size
+# # dataset activity
+# assert !@predictions[1].measured_activities(@compounds[1]).empty?
+# assert_equal "true", @predictions[1].measured_activities(@compounds[1]).first.to_s
+# assert @predictions[1].value(@compounds[1]).nil?
+# # dataset prediction
+# c = OpenTox::Compound.from_smiles("CC(=Nc1ccc2c(c1)Cc1ccccc21)O")
+# assert_equal nil, @predictions[2].value(c)
+# assert_equal "true", @predictions[2].measured_activities(c).first.to_s
+# c = OpenTox::Compound.from_smiles("c1ccccc1NN")
+# assert_equal "false", @predictions[2].value(c)
+# assert_equal 0.2938.round_to(4) , @predictions[2].confidence(c).round_to(4)
+# # model
+# assert_equal 41, @model.features.size
+# cleanup
+# end
+#
+#
+# def test_classification_svm_model
+# create_model :dataset_uri => @@classification_training_dataset.uri, :prediction_algorithm => "local_svm_classification"
+# predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN")
+# predict_dataset OpenTox::Dataset.create_from_csv_file("data/multicolumn.csv", @@subjectid)
+#
+# assert_equal "false", @predictions[0].value(@compounds[0])
+# assert_equal 0.3952, @predictions[0].confidence(@compounds[0]).round_to(4)
+# assert_equal 16, @predictions[0].neighbors(@compounds[0]).size
+#
+# c = OpenTox::Compound.from_smiles("c1ccccc1NN")
+# assert_equal 4, @predictions[1].compounds.size
+# assert_equal "false", @predictions[1].value(c)
+#
+# assert_equal 41, @model.features.size
+# cleanup
+# end
+#
+# def test_classification_svm_prop_model
+# create_model :dataset_uri => @@classification_training_dataset.uri, :prediction_algorithm => "local_svm_classification", :local_svm_kernel => "propositionalized"
+# predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN")
+# predict_dataset OpenTox::Dataset.create_from_csv_file("data/multicolumn.csv", @@subjectid)
+#
+# assert_equal "false", @predictions[0].value(@compounds[0])
+# assert_equal 0.3952, @predictions[0].confidence(@compounds[0]).round_to(4)
+# assert_equal 16, @predictions[0].neighbors(@compounds[0]).size
+#
+# c = OpenTox::Compound.from_smiles("c1ccccc1NN")
+# assert_equal 4, @predictions[1].compounds.size
+# assert_equal "false", @predictions[1].value(c)
+#
+# assert_equal 41, @model.features.size
+# cleanup
+# end
+#
+#
+# ## Numeric Features
+#
+# def test_classification_svm_prop_pc_model
+# create_model :dataset_uri => @@classification_training_dataset.uri, :prediction_algorithm => "local_svm_classification", :local_svm_kernel => "propositionalized", :pc_type => "electronic"
+# predict_compound OpenTox::Compound.from_smiles("c1ccccc1NN")
+# predict_dataset OpenTox::Dataset.create_from_csv_file("data/multicolumn.csv", @@subjectid)
+#
+# assert_equal "false", @predictions[0].value(@compounds[0])
+# assert_equal 0.3952, @predictions[0].confidence(@compounds[0]).round_to(4)
+# assert_equal 16, @predictions[0].neighbors(@compounds[0]).size
+#
+# c = OpenTox::Compound.from_smiles("c1ccccc1NN")
+# assert_equal 4, @predictions[1].compounds.size
+# assert_equal "false", @predictions[1].value(c)
+#
+# assert_equal 41, @model.features.size
+# cleanup
+# end