summaryrefslogtreecommitdiff
path: root/TD50/CV_ds_pctype_algo_rseed_RAT_ttv.rb
diff options
context:
space:
mode:
authorDavid Vorgrimmler <vorgrimmlerdavid@gmx.de>2012-03-30 16:38:02 +0200
committerDavid Vorgrimmler <vorgrimmlerdavid@gmx.de>2012-03-30 16:38:02 +0200
commit086e1d1ebf5da4a8b49b314371c12aa614acf73b (patch)
treee5de3eee52e6265b4ac8242fc82504343b7f0ab8 /TD50/CV_ds_pctype_algo_rseed_RAT_ttv.rb
parent6b1b0442c1ca4a46f1ed0f35832660e1e5021be6 (diff)
Backup of TD50 MOU/RAT report results
All csv files (data, feature ds), install instructions and scripts for ttv(befor ports have to be set correct, csv uploaded and dataset.yaml modified).
Diffstat (limited to 'TD50/CV_ds_pctype_algo_rseed_RAT_ttv.rb')
-rw-r--r--TD50/CV_ds_pctype_algo_rseed_RAT_ttv.rb69
1 files changed, 69 insertions, 0 deletions
diff --git a/TD50/CV_ds_pctype_algo_rseed_RAT_ttv.rb b/TD50/CV_ds_pctype_algo_rseed_RAT_ttv.rb
new file mode 100644
index 0000000..2c4b48d
--- /dev/null
+++ b/TD50/CV_ds_pctype_algo_rseed_RAT_ttv.rb
@@ -0,0 +1,69 @@
+# Do a 10-fold crossvalidation
+# # Author: Andreas Maunz, David Vorgrimmler
+# # @params: Dataset_name(see dataset_nestle.yaml), pc_type(electronic,cpsa or constitutional ... or nil to disable), prediction_algorithm(local_mlr_prop or local_svm_regression ...)
+
+if ARGV.size != 4
+ puts "Args: ds_name, pc_type, algo, random_seed"
+ puts ARGV.size
+ exit
+end
+
+ds_file = "datasets.yaml"
+pwd=`pwd`
+path = "#{pwd.chop}/#{ds_file}"
+if File.exists?(path)
+ puts "#{ds_file} exists"
+else
+ puts "#{ds_file} does not exist."
+ exit
+end
+
+require 'rubygems'
+require 'opentox-ruby'
+require 'yaml'
+
+subjectid = nil
+
+ds_name = ARGV[0] # e.g. MOU
+pc_type = ARGV[1] # e.g. electronic,cpsa or nil to disable
+algo = ARGV[2] # e.g. local_svm_regression, local_mlr_prop
+r_seed = ARGV[3] # 1, 2, ..., 10
+
+ds = YAML::load_file("datasets.yaml")
+#ds_uri = ds[ds_name]["dataset"]
+#ds_test_target_uri = ds[ds_name]["dataset"]
+ds_test_uri = ds[ds_name]["test"]
+ds_training_uri = ds[ds_name]["training"]
+pc_ds_uri = ds[ds_name][pc_type]
+
+algo_params = "prediction_algorithm=#{algo}"
+algo_params += ";pc_type=#{pc_type}" unless pc_type == "nil"
+algo_params += ";feature_dataset_uri=#{pc_ds_uri}" unless pc_type == "nil"
+#algo_params += ";min_sim=0.3"
+#algo_params += ";min_chisq_significance=0.9"
+#algo_params += ";min_frequency=6"
+#algo_params += ";feature_type=trees"
+
+puts algo_params.to_yaml
+
+prediction_feature = OpenTox::Dataset.find(ds_training_uri).features.keys.first
+
+
+# Ready
+cv_args = {}
+#cv_args[:dataset_uri] = ds_uri
+cv_args[:test_dataset_uri] = ds_test_uri
+cv_args[:training_dataset_uri] = ds_training_uri
+#cv_args[:test_target_dataset_uri] = ds_test_target_uri
+cv_args[:prediction_feature] = prediction_feature
+cv_args[:algorithm_uri] = "http://toxcreate3.in-silico.ch:8086/algorithm/lazar"
+cv_args[:algorithm_params] = algo_params
+#cv_args[:stratified] = false
+#cv_args[:random_seed] = r_seed
+puts cv_args.to_yaml
+
+ttv = OpenTox::RestClientWrapper.post( File.join(CONFIG[:services]["opentox-validation"],"training_test_validation"), cv_args )
+puts ttv
+
+vr = OpenTox::ValidationReport.create( ttv , subjectid).uri
+puts vr