diff options
author | David Vorgrimmler <vorgrimmlerdavid@gmx.de> | 2012-06-08 15:13:10 +0200 |
---|---|---|
committer | David Vorgrimmler <vorgrimmlerdavid@gmx.de> | 2012-06-08 15:13:10 +0200 |
commit | 6da8f4944ddd3164ac1c55847623f41545fa5fc2 (patch) | |
tree | f349dad755a5f78b08baa6079dd3bb0f341137ed | |
parent | e2d670cb86d7b78f69d7f5d24a8cae5d79505e0f (diff) |
Fixed minor bugs.
Set min_frequency if not given and ignore features with nil values.
-rw-r--r-- | lib/algorithm.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/algorithm.rb b/lib/algorithm.rb index 8b6fca5..00f7e4e 100644 --- a/lib/algorithm.rb +++ b/lib/algorithm.rb @@ -94,10 +94,10 @@ module OpenTox end end raise OpenTox::BadRequestError.new "Minimum frequency must be integer [n], or a percentage [n]pc, or a per-mil [n]pm , with n greater 0" if bad_request - if @minfreq.nil? - @minfreq=OpenTox::Algorithm.min_frequency(@training_dataset,per_mil) - LOGGER.debug "min_frequency #{@minfreq} (input was #{per_mil} per-mil)" - end + end + if @minfreq.nil? + @minfreq=OpenTox::Algorithm.min_frequency(@training_dataset,per_mil) + LOGGER.debug "min_frequency #{@minfreq} (input was #{per_mil} per-mil)" end end @@ -110,7 +110,7 @@ module OpenTox entries=@training_dataset.data_entries[compound] entries.each do |feature, values| compound_sizes[compound] || compound_sizes[compound] = [] - compound_sizes[compound] << values.size + compound_sizes[compound] << values.size unless values.size == 0 end compound_sizes[compound].uniq! raise "Inappropriate data for fminer" if compound_sizes[compound].size > 1 |