From 0813b486bc6b107a6970bae7cfb4ca262d7c5697 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Mon, 12 Dec 2016 13:02:29 +0100 Subject: 5 repeated cvs for enm --- lib/crossvalidation.rb | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'lib/crossvalidation.rb') diff --git a/lib/crossvalidation.rb b/lib/crossvalidation.rb index 5a05955..bcb3ccf 100644 --- a/lib/crossvalidation.rb +++ b/lib/crossvalidation.rb @@ -96,39 +96,6 @@ module OpenTox crossvalidation_ids.collect{|id| CrossValidation.find(id)} end - def correlation_plot format: "png" - #unless correlation_plot_id - feature = Feature.find(crossvalidations.first.model.prediction_feature) - title = feature.name - title += "[#{feature.unit}]" if feature.unit and !feature.unit.blank? - tmpfile = "/tmp/#{id.to_s}_correlation.#{format}" - images = [] - crossvalidations.each_with_index do |cv,i| - x = [] - y = [] - cv.predictions.each do |sid,p| - x << p["measurements"].median - y << p["value"] - end - R.assign "measurement", x - R.assign "prediction", y - R.eval "all = c(measurement,prediction)" - R.eval "range = c(min(all), max(all))" - R.eval "image#{i} = qplot(prediction,measurement,main='#{title} #{i}',xlab='Prediction',ylab='Measurement',asp=1,xlim=range, ylim=range)" - R.eval "image#{i} = image#{i} + geom_abline(intercept=0, slope=1)" - images << "image#{i}" - - R.eval "ggsave(file='/home/ist/lazar/test/tmp#{i}.pdf', plot=image#{i})" - end - R.eval "pdf('#{tmpfile}')" - R.eval "grid.arrange(#{images.join ","},ncol=#{images.size})" - R.eval "dev.off()" - file = Mongo::Grid::File.new(File.read(tmpfile), :filename => "#{id.to_s}_correlation_plot.#{format}") - correlation_plot_id = $gridfs.insert_one(file) - update(:correlation_plot_id => correlation_plot_id) - #end - $gridfs.find_one(_id: correlation_plot_id).data - end end end -- cgit v1.2.3