bio-band 0.1.1 → 0.1.2
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/VERSION +1 -1
 - data/bio-band.gemspec +4 -2
 - data/features/step_definitions/weka_clustering.rb +4 -0
 - data/features/weka_clustering.feature +1 -0
 - data/lib/bio-band/apache/stat/regression.rb +1 -0
 - data/lib/bio-band/weka.rb +11 -10
 - data/lib/bio-band/weka/classifiers/evaluation.rb +2 -1
 - data/lib/bio-band/weka/classifiers/rules/rules.rb +32 -0
 - data/lib/bio-band/weka/classifiers/rules/rules_utils.rb +45 -0
 - data/lib/bio-band/weka/classifiers/trees/trees.rb +1 -0
 - data/lib/bio-band/weka/clusterers/clusterers.rb +11 -0
 - data/lib/bio-band/weka/clusterers/clusterers_utils.rb +9 -0
 - metadata +4 -2
 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            0.1. 
     | 
| 
      
 1 
     | 
    
         
            +
            0.1.2
         
     | 
    
        data/bio-band.gemspec
    CHANGED
    
    | 
         @@ -5,11 +5,11 @@ 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       7 
7 
     | 
    
         
             
              s.name = "bio-band"
         
     | 
| 
       8 
     | 
    
         
            -
              s.version = "0.1. 
     | 
| 
      
 8 
     | 
    
         
            +
              s.version = "0.1.2"
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         
     | 
| 
       11 
11 
     | 
    
         
             
              s.authors = ["arrigonialberto86"]
         
     | 
| 
       12 
     | 
    
         
            -
              s.date = "2013-07- 
     | 
| 
      
 12 
     | 
    
         
            +
              s.date = "2013-07-30"
         
     | 
| 
       13 
13 
     | 
    
         
             
              s.description = "Data mining and machine learning algorithms for JRuby "
         
     | 
| 
       14 
14 
     | 
    
         
             
              s.email = "arrigonialberto86@gmail.com"
         
     | 
| 
       15 
15 
     | 
    
         
             
              s.executables = ["bio-band"]
         
     | 
| 
         @@ -62,6 +62,8 @@ Gem::Specification.new do |s| 
     | 
|
| 
       62 
62 
     | 
    
         
             
                "lib/bio-band/weka/classifiers/functions/functions_utils.rb",
         
     | 
| 
       63 
63 
     | 
    
         
             
                "lib/bio-band/weka/classifiers/lazy/lazy.rb",
         
     | 
| 
       64 
64 
     | 
    
         
             
                "lib/bio-band/weka/classifiers/lazy/lazy_utils.rb",
         
     | 
| 
      
 65 
     | 
    
         
            +
                "lib/bio-band/weka/classifiers/rules/rules.rb ",
         
     | 
| 
      
 66 
     | 
    
         
            +
                "lib/bio-band/weka/classifiers/rules/rules_utils.rb",
         
     | 
| 
       65 
67 
     | 
    
         
             
                "lib/bio-band/weka/classifiers/trees/trees.rb",
         
     | 
| 
       66 
68 
     | 
    
         
             
                "lib/bio-band/weka/classifiers/trees/trees_utils.rb",
         
     | 
| 
       67 
69 
     | 
    
         
             
                "lib/bio-band/weka/clusterers/clusterers.rb",
         
     | 
    
        data/lib/bio-band/weka.rb
    CHANGED
    
    | 
         @@ -1,11 +1,12 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'bio-band/weka/db/db'
         
     | 
| 
       2 
     | 
    
         
            -
            require 'bio-band/weka/filters/unsupervised/attribute/attribute 
     | 
| 
       3 
     | 
    
         
            -
            require 'bio-band/weka/filters/unsupervised/instance/instance 
     | 
| 
       4 
     | 
    
         
            -
            require 'bio-band/weka/filters/supervised/instance/instance 
     | 
| 
       5 
     | 
    
         
            -
            require 'bio-band/weka/filters/supervised/attribute/attribute 
     | 
| 
       6 
     | 
    
         
            -
            require 'bio-band/weka/classifiers/bayes/bayes 
     | 
| 
       7 
     | 
    
         
            -
            require 'bio-band/weka/classifiers/evaluation 
     | 
| 
       8 
     | 
    
         
            -
            require 'bio-band/weka/classifiers/functions/functions 
     | 
| 
       9 
     | 
    
         
            -
            require 'bio-band/weka/classifiers/trees/trees 
     | 
| 
       10 
     | 
    
         
            -
            require 'bio-band/weka/classifiers/lazy/lazy 
     | 
| 
       11 
     | 
    
         
            -
            require 'bio-band/weka/ 
     | 
| 
      
 2 
     | 
    
         
            +
            require 'bio-band/weka/filters/unsupervised/attribute/attribute'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'bio-band/weka/filters/unsupervised/instance/instance'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'bio-band/weka/filters/supervised/instance/instance'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'bio-band/weka/filters/supervised/attribute/attribute'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'bio-band/weka/classifiers/bayes/bayes'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'bio-band/weka/classifiers/evaluation'
         
     | 
| 
      
 8 
     | 
    
         
            +
            require 'bio-band/weka/classifiers/functions/functions'
         
     | 
| 
      
 9 
     | 
    
         
            +
            require 'bio-band/weka/classifiers/trees/trees'
         
     | 
| 
      
 10 
     | 
    
         
            +
            require 'bio-band/weka/classifiers/lazy/lazy'
         
     | 
| 
      
 11 
     | 
    
         
            +
            require 'bio-band/weka/classifiers/rules/rules'
         
     | 
| 
      
 12 
     | 
    
         
            +
            require 'bio-band/weka/clusterers/clusterers'
         
     | 
| 
         @@ -0,0 +1,32 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            $:.unshift File.dirname(__FILE__)
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'rules_utils'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module Weka
         
     | 
| 
      
 5 
     | 
    
         
            +
            	module Classifier
         
     | 
| 
      
 6 
     | 
    
         
            +
            		module Rules
         
     | 
| 
      
 7 
     | 
    
         
            +
                  java_import "weka.classifiers.rules.DecisionTable" 
         
     | 
| 
      
 8 
     | 
    
         
            +
                  java_import "weka.classifiers.rules.DTNB"
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  class DecisionTable
         
     | 
| 
      
 11 
     | 
    
         
            +
                    include Rules_utils
         
     | 
| 
      
 12 
     | 
    
         
            +
                    class Base < DecisionTable
         
     | 
| 
      
 13 
     | 
    
         
            +
                      def initialize
         
     | 
| 
      
 14 
     | 
    
         
            +
                        super
         
     | 
| 
      
 15 
     | 
    
         
            +
                        init_rules
         
     | 
| 
      
 16 
     | 
    
         
            +
                      end
         
     | 
| 
      
 17 
     | 
    
         
            +
                    end
         
     | 
| 
      
 18 
     | 
    
         
            +
                  end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                  class DTNB
         
     | 
| 
      
 21 
     | 
    
         
            +
                    include Rules_utils
         
     | 
| 
      
 22 
     | 
    
         
            +
                    class Base < DTNB
         
     | 
| 
      
 23 
     | 
    
         
            +
                      def initialize
         
     | 
| 
      
 24 
     | 
    
         
            +
                        super
         
     | 
| 
      
 25 
     | 
    
         
            +
                        init_rules
         
     | 
| 
      
 26 
     | 
    
         
            +
                      end
         
     | 
| 
      
 27 
     | 
    
         
            +
                    end
         
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                end
         
     | 
| 
      
 31 
     | 
    
         
            +
              end
         
     | 
| 
      
 32 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,45 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #This module is used by the 'rules' classifiers from 'rules.rb' 
         
     | 
| 
      
 2 
     | 
    
         
            +
            #to inherit the following methods (instance and class methods)
         
     | 
| 
      
 3 
     | 
    
         
            +
            module Rules_utils
         
     | 
| 
      
 4 
     | 
    
         
            +
            	java_import "weka.core.Utils"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              def init_rules
         
     | 
| 
      
 7 
     | 
    
         
            +
                set_options(self.class.options) if self.class.options 
         
     | 
| 
      
 8 
     | 
    
         
            +
                self.class.data.setClassIndex(self.class.class_index) if self.class.class_index
         
     | 
| 
      
 9 
     | 
    
         
            +
                buildClassifier(self.class.data)
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            	#Instance methods list
         
     | 
| 
      
 13 
     | 
    
         
            +
              def self.included(base)
         
     | 
| 
      
 14 
     | 
    
         
            +
                base.extend(ClassMethods)
         
     | 
| 
      
 15 
     | 
    
         
            +
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              def set_options(options)
         
     | 
| 
      
 18 
     | 
    
         
            +
              	options_inst = Utils.splitOptions(options)
         
     | 
| 
      
 19 
     | 
    
         
            +
            		setOptions(options_inst)
         
     | 
| 
      
 20 
     | 
    
         
            +
              end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            	def list_options
         
     | 
| 
      
 23 
     | 
    
         
            +
            		listOptions.each {|key| puts "#{key.synopsis} #{key.description}"}
         
     | 
| 
      
 24 
     | 
    
         
            +
            	end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            	def description
         
     | 
| 
      
 27 
     | 
    
         
            +
                puts globalInfo
         
     | 
| 
      
 28 
     | 
    
         
            +
            	end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            	#Class methods module
         
     | 
| 
      
 31 
     | 
    
         
            +
            	module ClassMethods
         
     | 
| 
      
 32 
     | 
    
         
            +
            		
         
     | 
| 
      
 33 
     | 
    
         
            +
            		def self.classifier_attr_accessor(*args)
         
     | 
| 
      
 34 
     | 
    
         
            +
            	    args.each do |arg|
         
     | 
| 
      
 35 
     | 
    
         
            +
            	      #Here's the getter
         
     | 
| 
      
 36 
     | 
    
         
            +
            	      self.class_eval("def #{arg};@#{arg};end")
         
     | 
| 
      
 37 
     | 
    
         
            +
            	      #Here's the setter
         
     | 
| 
      
 38 
     | 
    
         
            +
            	      self.class_eval("def set_#{arg}(val);@#{arg}=val;end")
         
     | 
| 
      
 39 
     | 
    
         
            +
            	  	end
         
     | 
| 
      
 40 
     | 
    
         
            +
              	end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            		classifier_attr_accessor :options,:data,:class_index
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            	end
         
     | 
| 
      
 45 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -5,6 +5,17 @@ module Weka 
     | 
|
| 
       5 
5 
     | 
    
         
             
            	module Clusterer
         
     | 
| 
       6 
6 
     | 
    
         
             
                java_import 'weka.clusterers.SimpleKMeans'
         
     | 
| 
       7 
7 
     | 
    
         
             
                java_import 'weka.clusterers.FarthestFirst'
         
     | 
| 
      
 8 
     | 
    
         
            +
                java_import 'weka.clusterers.EM'
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                class EM
         
     | 
| 
      
 11 
     | 
    
         
            +
                  include Clusterer_utils
         
     | 
| 
      
 12 
     | 
    
         
            +
                  class Base < EM
         
     | 
| 
      
 13 
     | 
    
         
            +
                    def initialize
         
     | 
| 
      
 14 
     | 
    
         
            +
                      super
         
     | 
| 
      
 15 
     | 
    
         
            +
                      init_clusterer
         
     | 
| 
      
 16 
     | 
    
         
            +
                    end
         
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
       8 
19 
     | 
    
         | 
| 
       9 
20 
     | 
    
         
             
                class SimpleKMeans
         
     | 
| 
       10 
21 
     | 
    
         
             
                  include Clusterer_utils
         
     | 
| 
         @@ -2,6 +2,7 @@ 
     | 
|
| 
       2 
2 
     | 
    
         
             
            #to inherit the following methods (instance and class methods)
         
     | 
| 
       3 
3 
     | 
    
         
             
            module Clusterer_utils
         
     | 
| 
       4 
4 
     | 
    
         
             
            	java_import "weka.core.Utils"
         
     | 
| 
      
 5 
     | 
    
         
            +
            	java_import "weka.clusterers.ClusterEvaluation"
         
     | 
| 
       5 
6 
     | 
    
         | 
| 
       6 
7 
     | 
    
         
             
            	def init_clusterer
         
     | 
| 
       7 
8 
     | 
    
         
             
                set_options(self.class.options) if self.class.options 
         
     | 
| 
         @@ -36,6 +37,14 @@ module Clusterer_utils 
     | 
|
| 
       36 
37 
     | 
    
         
             
                get_capabilities.to_s
         
     | 
| 
       37 
38 
     | 
    
         
             
              end
         
     | 
| 
       38 
39 
     | 
    
         | 
| 
      
 40 
     | 
    
         
            +
              # 'data' is an Instances class object
         
     | 
| 
      
 41 
     | 
    
         
            +
             	def validate
         
     | 
| 
      
 42 
     | 
    
         
            +
             		eval = ClusterEvaluation.new
         
     | 
| 
      
 43 
     | 
    
         
            +
             		eval.setClusterer(self)
         
     | 
| 
      
 44 
     | 
    
         
            +
             		eval.evaluateClusterer(self.class.data)
         
     | 
| 
      
 45 
     | 
    
         
            +
             		eval.clusterResultsToString
         
     | 
| 
      
 46 
     | 
    
         
            +
             	end 
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
       39 
48 
     | 
    
         
             
            	#Class methods module
         
     | 
| 
       40 
49 
     | 
    
         
             
            	module ClassMethods
         
     | 
| 
       41 
50 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -2,14 +2,14 @@ 
     | 
|
| 
       2 
2 
     | 
    
         
             
            name: bio-band
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
4 
     | 
    
         
             
              prerelease:
         
     | 
| 
       5 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 5 
     | 
    
         
            +
              version: 0.1.2
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
       8 
8 
     | 
    
         
             
            - arrigonialberto86
         
     | 
| 
       9 
9 
     | 
    
         
             
            autorequire:
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2013-07- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2013-07-30 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: shoulda
         
     | 
| 
         @@ -254,6 +254,8 @@ files: 
     | 
|
| 
       254 
254 
     | 
    
         
             
            - lib/bio-band/weka/classifiers/functions/functions_utils.rb
         
     | 
| 
       255 
255 
     | 
    
         
             
            - lib/bio-band/weka/classifiers/lazy/lazy.rb
         
     | 
| 
       256 
256 
     | 
    
         
             
            - lib/bio-band/weka/classifiers/lazy/lazy_utils.rb
         
     | 
| 
      
 257 
     | 
    
         
            +
            - ! 'lib/bio-band/weka/classifiers/rules/rules.rb '
         
     | 
| 
      
 258 
     | 
    
         
            +
            - lib/bio-band/weka/classifiers/rules/rules_utils.rb
         
     | 
| 
       257 
259 
     | 
    
         
             
            - lib/bio-band/weka/classifiers/trees/trees.rb
         
     | 
| 
       258 
260 
     | 
    
         
             
            - lib/bio-band/weka/classifiers/trees/trees_utils.rb
         
     | 
| 
       259 
261 
     | 
    
         
             
            - lib/bio-band/weka/clusterers/clusterers.rb
         
     |