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 CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "bio-band"
8
- s.version = "0.1.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-27"
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",
@@ -27,4 +27,8 @@ end
27
27
 
28
28
  Then(/^I want to report result statistics$/) do
29
29
  puts @clustered
30
+ end
31
+
32
+ Then(/^I want to use Weka clustering cross\-validation$/) do
33
+ puts @clustered.validate
30
34
  end
@@ -10,5 +10,6 @@ Feature: Weka dataset clustering
10
10
  And I want to set K = "4" as K-means option
11
11
  And I want to perform clustering on the parsed dataset
12
12
  And I want to report result statistics
13
+ And I want to use Weka clustering cross-validation
13
14
 
14
15
 
@@ -13,6 +13,7 @@ module Apache
13
13
  obj = SimpleRegression.new
14
14
  obj.addData(data)
15
15
  return obj
16
+ # add Jruby methods for regression analysis
16
17
  end
17
18
 
18
19
 
@@ -1,11 +1,12 @@
1
1
  require 'bio-band/weka/db/db'
2
- require 'bio-band/weka/filters/unsupervised/attribute/attribute.rb'
3
- require 'bio-band/weka/filters/unsupervised/instance/instance.rb'
4
- require 'bio-band/weka/filters/supervised/instance/instance.rb'
5
- require 'bio-band/weka/filters/supervised/attribute/attribute.rb'
6
- require 'bio-band/weka/classifiers/bayes/bayes.rb'
7
- require 'bio-band/weka/classifiers/evaluation.rb'
8
- require 'bio-band/weka/classifiers/functions/functions.rb'
9
- require 'bio-band/weka/classifiers/trees/trees.rb'
10
- require 'bio-band/weka/classifiers/lazy/lazy.rb'
11
- require 'bio-band/weka/clusterers/clusterers.rb'
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'
@@ -1,12 +1,13 @@
1
1
  module Weka
2
2
  module Classifier
3
3
  java_import 'weka.classifiers.Evaluation'
4
+ java_import 'java.util.Random'
4
5
 
5
6
  class Evaluation
6
7
  def summary
7
8
  puts toSummaryString
8
9
  end
9
-
10
10
  end
11
+
11
12
  end
12
13
  end
@@ -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,7 @@ module Weka
5
5
  module Classifier
6
6
  module Trees
7
7
  java_import 'weka.classifiers.trees.J48'
8
+ java_import 'weka.classifiers.trees.FT'
8
9
  java_import 'weka.classifiers.trees.RandomForest'
9
10
 
10
11
  class FT
@@ -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.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-27 00:00:00.000000000 Z
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