nimbus 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/nimbus.rb +1 -1
- data/lib/nimbus/configuration.rb +1 -1
- data/lib/nimbus/forest.rb +4 -1
- data/spec/nimbus_spec.rb +1 -2
- metadata +2 -2
data/lib/nimbus.rb
CHANGED
data/lib/nimbus/configuration.rb
CHANGED
@@ -142,7 +142,7 @@ module Nimbus
|
|
142
142
|
Nimbus.message "* Nimbus configured with the following parameters: "
|
143
143
|
Nimbus.message "* Forest size: #{@forest_size} trees"
|
144
144
|
Nimbus.message "* Total SNP count: #{@tree_SNP_total_count}"
|
145
|
-
Nimbus.message "* SNPs sample size (mtry): #{@
|
145
|
+
Nimbus.message "* SNPs sample size (mtry): #{@tree_SNP_sample_size}"
|
146
146
|
Nimbus.message "* Maximum number of branches per tree: #{@tree_max_branches}"
|
147
147
|
Nimbus.message "* Minimun node size in tree: #{@tree_node_min_size}"
|
148
148
|
Nimbus.message "*" * 50
|
data/lib/nimbus/forest.rb
CHANGED
@@ -9,6 +9,7 @@ module Nimbus
|
|
9
9
|
@options = config
|
10
10
|
@size = config.forest_size
|
11
11
|
@predictions = {}
|
12
|
+
@times_predicted =[]
|
12
13
|
raise Nimbus::ForestError, "Forest size parameter (#{@size}) is invalid. You need at least one tree." if @size < 1
|
13
14
|
end
|
14
15
|
|
@@ -46,15 +47,17 @@ module Nimbus
|
|
46
47
|
preds.each_pair.each{|id, value|
|
47
48
|
if @predictions[id].nil?
|
48
49
|
@predictions[id] = value
|
50
|
+
@times_predicted[id] = 1.0
|
49
51
|
else
|
50
52
|
@predictions[id] += value
|
53
|
+
@times_predicted[id] += 1
|
51
54
|
end
|
52
55
|
}
|
53
56
|
end
|
54
57
|
|
55
58
|
def average_predictions
|
56
59
|
@predictions.each_pair{|id, value|
|
57
|
-
@predictions[id] = (@predictions[id] / @
|
60
|
+
@predictions[id] = (@predictions[id] / @times_predicted[id]).round(5)
|
58
61
|
}
|
59
62
|
end
|
60
63
|
|
data/spec/nimbus_spec.rb
CHANGED
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.3"
|
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-19 00:00:00 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rspec
|