summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2016-11-10 12:24:08 +0100
committerChristoph Helma <helma@in-silico.ch>2016-11-10 12:24:08 +0100
commit85ef2c4982f72c811d5e9fa4ce22e238c512fe6e (patch)
tree04234e83f2d702f368cd409adddd01a247d7a1c7
parent9e7b36613e98601de7b2ceb2d4442e11f1ae868a (diff)
parent347ef2891876af871e101f9a9efc643e5f28da4c (diff)
Merge branch 'development' of github.com:opentox/lazar into development
-rw-r--r--lib/model.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/model.rb b/lib/model.rb
index 6a5e614..549cbd2 100644
--- a/lib/model.rb
+++ b/lib/model.rb
@@ -421,6 +421,28 @@ module OpenTox
prediction_model
end
+ def self.create dir: dir, algorithms: algorithms
+ training_dataset = Dataset.where(:name => "Protein Corona Fingerprinting Predicts the Cellular Interaction of Gold and Silver Nanoparticles").first
+ unless training_dataset
+ Import::Enanomapper.import dir
+ training_dataset = Dataset.where(name: "Protein Corona Fingerprinting Predicts the Cellular Interaction of Gold and Silver Nanoparticles").first
+ end
+ prediction_model = self.new(
+ :endpoint => "log2(Net cell association)",
+ :source => "https://data.enanomapper.net/",
+ :species => "A549 human lung epithelial carcinoma cells",
+ :unit => "log2(ug/Mg)"
+ )
+ prediction_feature = Feature.where(name: "log2(Net cell association)", category: "TOX").first
+ model = Model::LazarRegression.create(prediction_feature: prediction_feature, training_dataset: training_dataset, algorithms: algorithms)
+ prediction_model[:model_id] = model.id
+ repeated_cv = Validation::RepeatedCrossValidation.create model
+ prediction_model[:repeated_crossvalidation_id] = Validation::RepeatedCrossValidation.create(model).id
+ #prediction_model[:leave_one_out_validation_id] = Validation::LeaveOneOut.create(model).id
+ prediction_model.save
+ prediction_model
+ end
+
end
end