summaryrefslogtreecommitdiff
path: root/create_prediction_models.rb
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2017-02-07 14:05:17 +0000
committergebele <gebele@in-silico.ch>2017-02-07 14:05:17 +0000
commitd8b69f89bf99a62aa15a2b828b63fe4ccfd8e9ad (patch)
tree28cf8bd689ba43d012cf678fde34ebeafdddf589 /create_prediction_models.rb
re-init
Diffstat (limited to 'create_prediction_models.rb')
-rw-r--r--create_prediction_models.rb66
1 files changed, 66 insertions, 0 deletions
diff --git a/create_prediction_models.rb b/create_prediction_models.rb
new file mode 100644
index 0000000..0ec5e25
--- /dev/null
+++ b/create_prediction_models.rb
@@ -0,0 +1,66 @@
+ENV["LAZAR_ENV"] = "development"
+require_relative '../lazar/lib/lazar'
+#require 'lazar'
+include OpenTox
+#$mongo.database.drop
+#$gridfs = $mongo.database.fs # recreate GridFS indexes
+
+=begin
+# classification models
+Dir["classification/*csv"].each do |file|
+ unless file.match(/hamster/)
+ Model::Prediction.from_csv_file file
+ end
+end
+
+# regression models
+Dir["regression/*log10.csv"].each do |file|
+ Model::Prediction.from_csv_file file
+end
+=end
+
+## nano-lazar
+=begin
+
+# creates 3 models: one with physchem, one with proteomics, one with fingerprints
+feature_categories = ["fingerprint", "P-CHEM", "Proteomics"]
+
+feature_categories.each do |category|
+ if category == "fingerprint"
+ algorithms = {
+ :descriptors => { :method => "fingerprint", :type => "MP2D", },
+ :feature_selection => nil,
+ :similarity => {
+ :method => "Algorithm::Similarity.tanimoto",
+ :min => 0.1
+ }
+ }
+
+ OpenTox::Model::Validation.from_enanomapper algorithms: algorithms
+ else
+ algorithms = {
+ :descriptors => {
+ :method => "properties",
+ :categories => (category.is_a?(Array) ? [category].flatten : [category]),
+ },
+ :similarity => {
+ :method => "Algorithm::Similarity.weighted_cosine",
+ :min => 0.5
+ },
+ :prediction => {
+ :method => "Algorithm::Caret.rf",
+ },
+ :feature_selection => {
+ :method => "Algorithm::FeatureSelection.correlation_filter",
+ },
+ }
+
+ OpenTox::Model::Validation.from_enanomapper algorithms: algorithms
+ end
+end
+=end
+
+# save
+
+#`mongodump -h 127.0.0.1 -d development`
+#`mongorestore --host 127.0.0.1`