nimbus 0.8 → 0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/nimbus/loss_functions.rb +4 -0
- data/lib/nimbus/tree.rb +5 -5
- metadata +2 -2
data/lib/nimbus/tree.rb
CHANGED
@@ -57,12 +57,12 @@ module Nimbus
|
|
57
57
|
|
58
58
|
def generalization_error_from_oob(oob_ids)
|
59
59
|
return nil if (@structure.nil? || @individuals.nil? || @id_to_fenotype.nil?)
|
60
|
-
|
61
|
-
oob_predictions = {}
|
60
|
+
oob_errors = {}
|
62
61
|
oob_ids.each do |oobi|
|
63
|
-
|
62
|
+
oob_prediction = Tree.traverse @structure, individuals[oobi].snp_list
|
63
|
+
oob_errors[oobi] = Nimbus::LossFunctions.squared_difference oob_prediction, @id_to_fenotype[oobi]
|
64
64
|
end
|
65
|
-
@generalization_error = Nimbus::LossFunctions.
|
65
|
+
@generalization_error = Nimbus::LossFunctions.average oob_ids, oob_errors
|
66
66
|
end
|
67
67
|
|
68
68
|
def estimate_importances(oob_ids)
|
@@ -74,7 +74,7 @@ module Nimbus
|
|
74
74
|
permutated_snp_error = 0.0
|
75
75
|
oob_ids.each_with_index {|oobi, index|
|
76
76
|
permutated_prediction = traverse_with_permutation @structure, individuals[oobi].snp_list, current_snp, individuals[shuffled_ids[index]].snp_list
|
77
|
-
permutated_snp_error += Nimbus::LossFunctions.
|
77
|
+
permutated_snp_error += Nimbus::LossFunctions.squared_difference @id_to_fenotype[oobi], permutated_prediction
|
78
78
|
}
|
79
79
|
@importances[current_snp] = ((permutated_snp_error / oob_individuals_count) - @generalization_error).round(5)
|
80
80
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: nimbus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: "0.
|
5
|
+
version: "0.9"
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- "Juanjo Baz\xC3\xA1n"
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-08-
|
14
|
+
date: 2011-08-24 00:00:00 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rspec
|