summaryrefslogtreecommitdiff
path: root/lib/model.rb
diff options
context:
space:
mode:
authorhelma@in-silico.ch <helma@in-silico.ch>2018-10-30 21:11:04 +0100
committerhelma@in-silico.ch <helma@in-silico.ch>2018-10-30 21:11:04 +0100
commit2d4ce39cb1b489e26b0d6d96026054566a4f77b9 (patch)
tree84de198d7c9113fbefef97ef4aa8acd5594b4129 /lib/model.rb
parentd61f78093f4ddf03c27a2c8ae0bab9c1f10c80f5 (diff)
dataset merge
Diffstat (limited to 'lib/model.rb')
-rw-r--r--lib/model.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/model.rb b/lib/model.rb
index 6d5cf7b..f50fcd7 100644
--- a/lib/model.rb
+++ b/lib/model.rb
@@ -487,6 +487,16 @@ module OpenTox
end
# TODO from_pubchem_aid
+ def self.from_dataset training_dataset: , prediction_feature: , species: , endpoint:
+ model_validation = Model::Validation.create species: species, endpoint: endpoint
+ p "create model"
+ model = Lazar.create training_dataset: training_dataset, prediction_feature: prediction_feature
+ model_validation[:model_id] = model.id
+ p "create_crossvalidations"
+ model_validation[:repeated_crossvalidation_id] = OpenTox::Validation::RepeatedCrossValidation.create(model).id # full class name required
+ model_validation.save
+ model_validation
+ end
# Create and validate a lazar model from a csv file with training data and a json file with metadata
# @param [File] CSV file with two columns. The first line should contain either SMILES or InChI (first column) and the endpoint (second column). The first column should contain either the SMILES or InChI of the training compounds, the second column the training compounds toxic activities (qualitative or quantitative). Use -log10 transformed values for regression datasets. Add metadata to a JSON file with the same basename containing the fields "species", "endpoint", "source" and "unit" (regression only). You can find example training data at https://github.com/opentox/lazar-public-data.