summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2016-07-26 13:21:57 +0200
committerChristoph Helma <helma@in-silico.ch>2016-07-26 13:21:57 +0200
commit7313c5d26b5f3a672dac0494f16cdf0185f6a39f (patch)
treef67c1b0a6c089ff183e195a9b844b0f00396dbd1
parent46c628f1757ce8274a0b277b3ec3306609b38c14 (diff)
NanoPrediction model
-rw-r--r--lib/model.rb37
1 files changed, 36 insertions, 1 deletions
diff --git a/lib/model.rb b/lib/model.rb
index 0432c56..5cf2cdb 100644
--- a/lib/model.rb
+++ b/lib/model.rb
@@ -283,10 +283,45 @@ module OpenTox
prediction_model[:model_id] = model.id
prediction_model[:prediction_feature_id] = prediction_feature.id
prediction_model[:repeated_crossvalidation_id] = Validation::RepeatedCrossValidation.create(model).id
- prediction_model[:leave_one_out_validation_id] = Validation::LeaveOneOut.create(model).id
+ #prediction_model[:leave_one_out_validation_id] = Validation::LeaveOneOut.create(model).id
prediction_model.save
prediction_model
end
+
+ end
+
+ class NanoPrediction < Prediction
+
+ def self.from_json_dump dir, category
+ Import::Enanomapper.import dir
+
+ 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)"
+ )
+ params = {
+ :feature_selection_algorithm => :correlation_filter,
+ :feature_selection_algorithm_parameters => {:category => category},
+ :neighbor_algorithm => "physchem_neighbors",
+ :neighbor_algorithm_parameters => {:min_sim => 0.5},
+ :prediction_algorithm => "OpenTox::Algorithm::Regression.local_physchem_regression",
+ :prediction_algorithm_parameters => {:method => 'rf'}, # random forests
+ }
+ training_dataset = Dataset.find_or_create_by(:name => "Protein Corona Fingerprinting Predicts the Cellular Interaction of Gold and Silver Nanoparticles")
+ prediction_feature = Feature.find_or_create_by(name: "log2(Net cell association)", category: "TOX")
+ #prediction_feature = Feature.find("579621b84de73e267b414e55")
+ prediction_model[:prediction_feature_id] = prediction_feature.id
+ model = Model::LazarRegression.create(prediction_feature, training_dataset, params)
+ 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