nimbus 0.5 → 0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/nimbus/configuration.rb +0 -6
- data/lib/nimbus/tree.rb +2 -3
- data/spec/fixtures/config.yml +0 -1
- metadata +2 -2
data/lib/nimbus/configuration.rb
CHANGED
@@ -8,7 +8,6 @@ module Nimbus
|
|
8
8
|
:forest_size,
|
9
9
|
:tree_SNP_sample_size,
|
10
10
|
:tree_SNP_total_count,
|
11
|
-
:tree_max_branches,
|
12
11
|
:tree_node_min_size,
|
13
12
|
:loss_function_discrete,
|
14
13
|
:loss_function_continuous,
|
@@ -24,7 +23,6 @@ module Nimbus
|
|
24
23
|
:forest_size => 500,
|
25
24
|
:tree_SNP_sample_size => 60,
|
26
25
|
:tree_SNP_total_count => 200,
|
27
|
-
:tree_max_branches => 2000,
|
28
26
|
:tree_node_min_size => 5,
|
29
27
|
|
30
28
|
:loss_function_discrete => 'majority_class',
|
@@ -48,7 +46,6 @@ module Nimbus
|
|
48
46
|
@forest_size = DEFAULTS[:forest_size]
|
49
47
|
@tree_SNP_sample_size = DEFAULTS[:tree_SNP_sample_size]
|
50
48
|
@tree_SNP_total_count = DEFAULTS[:tree_SNP_total_count]
|
51
|
-
@tree_max_branches = DEFAULTS[:tree_max_branches]
|
52
49
|
@tree_node_min_size = DEFAULTS[:tree_node_min_size]
|
53
50
|
@loss_function_discrete = DEFAULTS[:loss_function_discrete]
|
54
51
|
@loss_function_continuous = DEFAULTS[:loss_function_continuous]
|
@@ -62,7 +59,6 @@ module Nimbus
|
|
62
59
|
{
|
63
60
|
:snp_sample_size => @tree_SNP_sample_size,
|
64
61
|
:snp_total_count => @tree_SNP_total_count,
|
65
|
-
:tree_max_branches => @tree_max_branches,
|
66
62
|
:tree_node_min_size => @tree_node_min_size
|
67
63
|
}
|
68
64
|
end
|
@@ -98,7 +94,6 @@ module Nimbus
|
|
98
94
|
@forest_size = user_config_params['forest']['forest_size'].to_i if user_config_params['forest']['forest_size']
|
99
95
|
@tree_SNP_total_count = user_config_params['forest']['SNP_total_count'].to_i if user_config_params['forest']['SNP_total_count']
|
100
96
|
@tree_SNP_sample_size = user_config_params['forest']['SNP_sample_size_mtry'].to_i if user_config_params['forest']['SNP_sample_size_mtry']
|
101
|
-
@tree_max_branches = user_config_params['forest']['max_branches'].to_i if user_config_params['forest']['max_branches']
|
102
97
|
@tree_node_min_size = user_config_params['forest']['node_min_size'].to_i if user_config_params['forest']['node_min_size']
|
103
98
|
end
|
104
99
|
|
@@ -169,7 +164,6 @@ module Nimbus
|
|
169
164
|
Nimbus.message "* Forest size: #{@forest_size} trees"
|
170
165
|
Nimbus.message "* Total SNP count: #{@tree_SNP_total_count}"
|
171
166
|
Nimbus.message "* SNPs sample size (mtry): #{@tree_SNP_sample_size}"
|
172
|
-
Nimbus.message "* Maximum number of branches per tree: #{@tree_max_branches}"
|
173
167
|
Nimbus.message "* Minimun node size in tree: #{@tree_node_min_size}"
|
174
168
|
Nimbus.message "*" * 50
|
175
169
|
|
data/lib/nimbus/tree.rb
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
module Nimbus
|
2
2
|
|
3
3
|
class Tree
|
4
|
-
attr_accessor :snp_sample_size, :snp_total_count, :node_min_size, :
|
4
|
+
attr_accessor :snp_sample_size, :snp_total_count, :node_min_size, :structure, :predictions
|
5
5
|
attr_accessor :individuals, :id_to_fenotype
|
6
6
|
|
7
7
|
def initialize(options)
|
8
8
|
@snp_total_count = options[:snp_total_count]
|
9
9
|
@snp_sample_size = options[:snp_sample_size]
|
10
10
|
@node_min_size = options[:tree_node_min_size]
|
11
|
-
@max_branches = options[:tree_max_branches]
|
12
11
|
end
|
13
12
|
|
14
13
|
def seed(all_individuals, individuals_sample, ids_fenotypes)
|
@@ -57,7 +56,7 @@ module Nimbus
|
|
57
56
|
def self.traverse(tree_structure, data)
|
58
57
|
return tree_structure if tree_structure.is_a? Numeric
|
59
58
|
raise Nimbus::TreeError, "Forest data has invalid structure. Please check your forest data (file)." if !(tree_structure.is_a?(Hash) && tree_structure.keys.size == 1)
|
60
|
-
return self.traverse( tree_structure.values.first[ data[tree_structure.keys.first].to_i ], data)
|
59
|
+
return self.traverse( tree_structure.values.first[ data[tree_structure.keys.first].to_i - 1 ], data)
|
61
60
|
end
|
62
61
|
|
63
62
|
|
data/spec/fixtures/config.yml
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.6"
|
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-22 00:00:00 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rspec
|