diff options
author | Christoph Helma <helma@in-silico.ch> | 2016-04-21 15:06:10 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2016-04-21 15:06:10 +0200 |
commit | 6890687df6de0a6eaa3d35c6be66639614ea2ef2 (patch) | |
tree | c863c5857d8716d35eb3a22efd3da24c5f27b968 /lib/validation-statistics.rb | |
parent | 75b70425ae8699464a18529eb7bf35a216c06243 (diff) | |
parent | 4ebd80fee52c04bd36781f846eae60019918345d (diff) |
probabilities branch merged
Diffstat (limited to 'lib/validation-statistics.rb')
-rw-r--r-- | lib/validation-statistics.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/validation-statistics.rb b/lib/validation-statistics.rb index 570b2d4..c6b2a07 100644 --- a/lib/validation-statistics.rb +++ b/lib/validation-statistics.rb @@ -15,21 +15,21 @@ module OpenTox if pred[:value] == m if pred[:value] == accept_values[0] confusion_matrix[0][0] += 1 - weighted_confusion_matrix[0][0] += pred[:confidence] + weighted_confusion_matrix[0][0] += pred[:probabilities][pred[:value]] nr_instances += 1 elsif pred[:value] == accept_values[1] confusion_matrix[1][1] += 1 - weighted_confusion_matrix[1][1] += pred[:confidence] + weighted_confusion_matrix[1][1] += pred[:probabilities][pred[:value]] nr_instances += 1 end elsif pred[:value] != m if pred[:value] == accept_values[0] confusion_matrix[0][1] += 1 - weighted_confusion_matrix[0][1] += pred[:confidence] + weighted_confusion_matrix[0][1] += pred[:probabilities][pred[:value]] nr_instances += 1 elsif pred[:value] == accept_values[1] confusion_matrix[1][0] += 1 - weighted_confusion_matrix[1][0] += pred[:confidence] + weighted_confusion_matrix[1][0] += pred[:probabilities][pred[:value]] nr_instances += 1 end end @@ -47,14 +47,15 @@ module OpenTox confidence_sum += c end end - accuracy = (weighted_confusion_matrix[0][0]+weighted_confusion_matrix[1][1])/confidence_sum.to_f + accuracy = (confusion_matrix[0][0]+confusion_matrix[1][1])/nr_instances.to_f + weighted_accuracy = (weighted_confusion_matrix[0][0]+weighted_confusion_matrix[1][1])/confidence_sum.to_f $logger.debug "Accuracy #{accuracy}" { :accept_values => accept_values, :confusion_matrix => confusion_matrix, :weighted_confusion_matrix => weighted_confusion_matrix, :accuracy => accuracy, - :weighted_accuracy => (weighted_confusion_matrix[0][0]+weighted_confusion_matrix[1][1])/confidence_sum.to_f, + :weighted_accuracy => weighted_accuracy, :true_rate => true_rate, :predictivity => predictivity, :finished_at => Time.now |