From 44e2641783d4d4ef82479b4be3a37b177698fc97 Mon Sep 17 00:00:00 2001 From: gebele Date: Thu, 17 Sep 2015 17:21:42 +0200 Subject: introduced batch prediction --- application.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'application.rb') diff --git a/application.rb b/application.rb index 0214db4..07af20b 100644 --- a/application.rb +++ b/application.rb @@ -208,13 +208,13 @@ post '/predict/?' do input = OpenTox::Dataset.from_csv_file File.join "tmp", params[:fileselect][:filename] dataset = OpenTox::Dataset.find input.id @compounds = dataset.compounds - @models = [] - @predictions = [] + @batch = {} @compounds.each do |compound| + @batch[compound] = [] params[:selection].keys.each do |model_id| model = Model::Prediction.find model_id - @models << model - @predictions << model.predict(compound) + prediction = model.predict(compound) + @batch[compound] << [model, prediction] end end input.delete -- cgit v1.2.3