summaryrefslogtreecommitdiff
path: root/lib/leave-one-out-validation.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2016-03-15 17:40:40 +0100
committerChristoph Helma <helma@in-silico.ch>2016-03-15 17:40:40 +0100
commit7c3bd90c26dfeea2db3cf74a1cefc23d8dece7c0 (patch)
tree045d18b43e30ef3bf9a548230e45986b591535a6 /lib/leave-one-out-validation.rb
parent0c5d2e678908a2d4aea43efbedbedc2c0439be30 (diff)
validation tests pass
Diffstat (limited to 'lib/leave-one-out-validation.rb')
-rw-r--r--lib/leave-one-out-validation.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/leave-one-out-validation.rb b/lib/leave-one-out-validation.rb
index 9db10c6..2cd13db 100644
--- a/lib/leave-one-out-validation.rb
+++ b/lib/leave-one-out-validation.rb
@@ -18,7 +18,7 @@ module OpenTox
predictions.select!{|p| p[:database_activities] and !p[:database_activities].empty?}
loo.nr_instances = predictions.size
predictions.select!{|p| p[:value]} # remove unpredicted
- loo.predictions = predictions.sort{|a,b| b[:confidence] <=> a[:confidence]}
+ loo.predictions = predictions#.sort{|a,b| b[:confidence] <=> a[:confidence]}
loo.nr_unpredicted = loo.nr_instances - loo.predictions.size
loo.statistics
loo.save
@@ -126,8 +126,8 @@ module OpenTox
field :rmse, type: Float, default: 0.0
field :mae, type: Float, default: 0
- field :weighted_rmse, type: Float, default: 0
- field :weighted_mae, type: Float, default: 0
+ #field :weighted_rmse, type: Float, default: 0
+ #field :weighted_mae, type: Float, default: 0
field :r_squared, type: Float
field :correlation_plot_id, type: BSON::ObjectId
field :confidence_plot_id, type: BSON::ObjectId
@@ -143,10 +143,10 @@ module OpenTox
measured_values << activity
error = Math.log10(pred[:value])-Math.log10(activity)
self.rmse += error**2
- self.weighted_rmse += pred[:confidence]*error**2
+ #self.weighted_rmse += pred[:confidence]*error**2
self.mae += error.abs
- self.weighted_mae += pred[:confidence]*error.abs
- confidence_sum += pred[:confidence]
+ #self.weighted_mae += pred[:confidence]*error.abs
+ #confidence_sum += pred[:confidence]
end
end
if pred[:database_activities].empty?
@@ -160,9 +160,9 @@ module OpenTox
r = R.eval("r").to_ruby
self.mae = self.mae/predictions.size
- self.weighted_mae = self.weighted_mae/confidence_sum
+ #self.weighted_mae = self.weighted_mae/confidence_sum
self.rmse = Math.sqrt(self.rmse/predictions.size)
- self.weighted_rmse = Math.sqrt(self.weighted_rmse/confidence_sum)
+ #self.weighted_rmse = Math.sqrt(self.weighted_rmse/confidence_sum)
self.r_squared = r**2
self.finished_at = Time.now
save