bio-band 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bio-band.gemspec +4 -2
- data/features/support/env.rb +1 -1
- data/lib/bio-band/apache.rb +1 -0
- data/lib/bio-band/apache/stat/correlation.rb +42 -0
- data/lib/bio-band/apache/stat/regression.rb +21 -0
- data/lib/bio-band/weka.rb +11 -11
- data/lib/bio-band/weka/classifiers/bayes/bayes.rb +5 -15
- data/lib/bio-band/weka/classifiers/bayes/bayes_utils.rb +7 -0
- data/lib/bio-band/weka/classifiers/functions/functions.rb +1 -3
- data/lib/bio-band/weka/classifiers/functions/functions_utils.rb +6 -0
- data/lib/bio-band/weka/classifiers/lazy/lazy.rb +1 -3
- data/lib/bio-band/weka/classifiers/lazy/lazy_utils.rb +6 -0
- data/lib/bio-band/weka/classifiers/trees/trees.rb +3 -9
- data/lib/bio-band/weka/classifiers/trees/trees_utils.rb +6 -0
- data/lib/bio-band/weka/clusterers/clusterers.rb +2 -4
- data/lib/bio-band/weka/clusterers/clusterers_utils.rb +5 -0
- metadata +4 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
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.1"
|
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-27"
|
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"]
|
@@ -44,7 +44,9 @@ Gem::Specification.new do |s|
|
|
44
44
|
"features/weka_pipeline.feature",
|
45
45
|
"lib/bio-band.rb",
|
46
46
|
"lib/bio-band/apache.rb",
|
47
|
+
"lib/bio-band/apache/stat/correlation.rb",
|
47
48
|
"lib/bio-band/apache/stat/inference.rb",
|
49
|
+
"lib/bio-band/apache/stat/regression.rb",
|
48
50
|
"lib/bio-band/core.rb",
|
49
51
|
"lib/bio-band/core/parser/parser.rb",
|
50
52
|
"lib/bio-band/core/type/apache_matrices.rb",
|
data/features/support/env.rb
CHANGED
data/lib/bio-band/apache.rb
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'java'
|
2
|
+
|
3
|
+
module Apache
|
4
|
+
module Stat
|
5
|
+
module Correlation
|
6
|
+
|
7
|
+
java_import "org.apache.commons.math3.stat.correlation.Covariance"
|
8
|
+
java_import "org.apache.commons.math3.stat.correlation.PearsonsCorrelation"
|
9
|
+
java_import "org.apache.commons.math3.stat.correlation.SpearmansCorrelation"
|
10
|
+
|
11
|
+
# Calculate covariance between two Numeric arrays
|
12
|
+
# * *Args* :
|
13
|
+
# - +Array1+ -> must be a RubyArray.
|
14
|
+
# - +Array2+ -> must be a RubyArray.
|
15
|
+
def self.covariance(array_1,array_2)
|
16
|
+
obj = Covariance.new
|
17
|
+
result = obj.covariance(array_1.to_java(:double),array_2.to_java(:double))
|
18
|
+
result
|
19
|
+
end
|
20
|
+
|
21
|
+
# Calculate Pearson correlation between two Numeric arrays
|
22
|
+
# * *Args* :
|
23
|
+
# - +Array1+ -> must be a RubyArray.
|
24
|
+
# - +Array2+ -> must be a RubyArray.
|
25
|
+
def self.pearson_correlation(array_1,array_2)
|
26
|
+
obj = PearsonsCorrelation.new
|
27
|
+
result = obj.correlation(array_1.to_java(:double),array_2.to_java(:double))
|
28
|
+
result
|
29
|
+
end
|
30
|
+
|
31
|
+
# Calculate Spearman correlation between two Numeric arrays
|
32
|
+
# * *Args* :
|
33
|
+
# - +Array1+ -> must be a RubyArray.
|
34
|
+
# - +Array2+ -> must be a RubyArray.
|
35
|
+
def self.spearman_correlation(array_1,array_2)
|
36
|
+
obj = SpearmansCorrelation.new
|
37
|
+
result = obj.correlation(array_1.to_java(:double),array_2.to_java(:double))
|
38
|
+
result
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'java'
|
2
|
+
|
3
|
+
module Apache
|
4
|
+
module Stat
|
5
|
+
module Regression
|
6
|
+
java_import "org.apache.commons.math3.stat.regression.SimpleRegression"
|
7
|
+
|
8
|
+
# Create a simple regression model on the input data
|
9
|
+
# * *Args* :
|
10
|
+
# - +vector+ -> must be a multidimensional array
|
11
|
+
def self.simple_regression(vector)
|
12
|
+
data = Core::Utils.bidimensional_to_double vector
|
13
|
+
obj = SimpleRegression.new
|
14
|
+
obj.addData(data)
|
15
|
+
return obj
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/bio-band/weka.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
3
|
-
require '
|
4
|
-
require '
|
5
|
-
require '
|
6
|
-
require '
|
7
|
-
require '
|
8
|
-
require '
|
9
|
-
require '
|
10
|
-
require '
|
11
|
-
require '
|
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'
|
@@ -15,9 +15,7 @@ module Weka
|
|
15
15
|
class Base < NaiveBayes
|
16
16
|
def initialize
|
17
17
|
super
|
18
|
-
|
19
|
-
self.class.data.setClassIndex(self.class.class_index) if self.class.class_index
|
20
|
-
buildClassifier(self.class.data)
|
18
|
+
init_classifier
|
21
19
|
end
|
22
20
|
end
|
23
21
|
end
|
@@ -27,9 +25,7 @@ module Weka
|
|
27
25
|
class Base < AODE
|
28
26
|
def initialize
|
29
27
|
super
|
30
|
-
|
31
|
-
self.class.data.setClassIndex(self.class.class_index) if self.class.class_index
|
32
|
-
buildClassifier(self.class.data)
|
28
|
+
init_classifier
|
33
29
|
end
|
34
30
|
end
|
35
31
|
end
|
@@ -39,9 +35,7 @@ module Weka
|
|
39
35
|
class Base < BayesianLogisticRegression
|
40
36
|
def initialize
|
41
37
|
super
|
42
|
-
|
43
|
-
self.class.data.setClassIndex(self.class.class_index) if self.class.class_index
|
44
|
-
buildClassifier(self.class.data)
|
38
|
+
init_classifier
|
45
39
|
end
|
46
40
|
end
|
47
41
|
end
|
@@ -51,9 +45,7 @@ module Weka
|
|
51
45
|
class Base < ComplementNaiveBayes
|
52
46
|
def initialize
|
53
47
|
super
|
54
|
-
|
55
|
-
self.class.data.setClassIndex(self.class.class_index) if self.class.class_index
|
56
|
-
buildClassifier(self.class.data)
|
48
|
+
init_classifier
|
57
49
|
end
|
58
50
|
end
|
59
51
|
end
|
@@ -63,9 +55,7 @@ module Weka
|
|
63
55
|
class Base < WAODE
|
64
56
|
def initialize
|
65
57
|
super
|
66
|
-
|
67
|
-
self.class.data.setClassIndex(self.class.class_index) if self.class.class_index
|
68
|
-
buildClassifier(self.class.data)
|
58
|
+
init_classifier
|
69
59
|
end
|
70
60
|
end
|
71
61
|
end
|
@@ -1,8 +1,15 @@
|
|
1
1
|
#This module is used by the Bayesian classifiers from 'bayes.rb'
|
2
2
|
#to inherit the following methods (instance and class methods)
|
3
3
|
module Bayes_utils
|
4
|
+
|
4
5
|
java_import "weka.core.Utils"
|
5
6
|
|
7
|
+
def init_classifier
|
8
|
+
set_options(self.class.options) if self.class.options
|
9
|
+
self.class.data.setClassIndex(self.class.class_index) if self.class.class_index
|
10
|
+
buildClassifier(self.class.data)
|
11
|
+
end
|
12
|
+
|
6
13
|
#Instance methods list
|
7
14
|
def self.included(base)
|
8
15
|
base.extend(ClassMethods)
|
@@ -11,9 +11,7 @@ module Weka
|
|
11
11
|
class Base < LinearRegression
|
12
12
|
def initialize
|
13
13
|
super
|
14
|
-
|
15
|
-
self.class.data.setClassIndex(self.class.class_index) if self.class.class_index
|
16
|
-
buildClassifier(self.class.data)
|
14
|
+
init_function
|
17
15
|
end
|
18
16
|
end
|
19
17
|
end
|
@@ -3,6 +3,12 @@
|
|
3
3
|
module Functions_utils
|
4
4
|
java_import "weka.core.Utils"
|
5
5
|
|
6
|
+
def init_function
|
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
|
+
|
6
12
|
#Instance methods list
|
7
13
|
def self.included(base)
|
8
14
|
base.extend(ClassMethods)
|
@@ -12,9 +12,7 @@ module Weka
|
|
12
12
|
class Base < KStar
|
13
13
|
def initialize
|
14
14
|
super
|
15
|
-
|
16
|
-
self.class.data.setClassIndex(self.class.class_index) if self.class.class_index
|
17
|
-
buildClassifier(self.class.data)
|
15
|
+
init_lazy
|
18
16
|
end
|
19
17
|
end
|
20
18
|
end
|
@@ -3,6 +3,12 @@
|
|
3
3
|
module Lazy_utils
|
4
4
|
java_import "weka.core.Utils"
|
5
5
|
|
6
|
+
def init_lazy
|
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
|
+
|
6
12
|
#Instance methods list
|
7
13
|
def self.included(base)
|
8
14
|
base.extend(ClassMethods)
|
@@ -12,9 +12,7 @@ module Weka
|
|
12
12
|
class Base < FT
|
13
13
|
def initialize
|
14
14
|
super
|
15
|
-
|
16
|
-
self.class.data.setClassIndex(self.class.class_index) if self.class.class_index
|
17
|
-
buildClassifier(self.class.data)
|
15
|
+
init_tree
|
18
16
|
end
|
19
17
|
end
|
20
18
|
end
|
@@ -24,9 +22,7 @@ module Weka
|
|
24
22
|
class Base < J48
|
25
23
|
def initialize
|
26
24
|
super
|
27
|
-
|
28
|
-
self.class.data.setClassIndex(self.class.class_index) if self.class.class_index
|
29
|
-
buildClassifier(self.class.data)
|
25
|
+
init_tree
|
30
26
|
end
|
31
27
|
end
|
32
28
|
end
|
@@ -36,9 +32,7 @@ module Weka
|
|
36
32
|
class Base < RandomForest
|
37
33
|
def initialize
|
38
34
|
super
|
39
|
-
|
40
|
-
self.class.data.setClassIndex(self.class.class_index) if self.class.class_index
|
41
|
-
buildClassifier(self.class.data)
|
35
|
+
init_tree
|
42
36
|
end
|
43
37
|
end
|
44
38
|
end
|
@@ -3,6 +3,12 @@
|
|
3
3
|
module Trees_utils
|
4
4
|
java_import "weka.core.Utils"
|
5
5
|
|
6
|
+
def init_tree
|
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
|
+
|
6
12
|
#Instance methods list
|
7
13
|
def self.included(base)
|
8
14
|
base.extend(ClassMethods)
|
@@ -11,8 +11,7 @@ module Weka
|
|
11
11
|
class Base < SimpleKMeans
|
12
12
|
def initialize
|
13
13
|
super
|
14
|
-
|
15
|
-
buildClusterer(self.class.data)
|
14
|
+
init_clusterer
|
16
15
|
end
|
17
16
|
end
|
18
17
|
end
|
@@ -22,8 +21,7 @@ module Weka
|
|
22
21
|
class Base < FarthestFirst
|
23
22
|
def initialize
|
24
23
|
super
|
25
|
-
|
26
|
-
buildClusterer(self.class.data)
|
24
|
+
init_clusterer
|
27
25
|
end
|
28
26
|
end
|
29
27
|
end
|
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.1
|
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-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: shoulda
|
@@ -236,7 +236,9 @@ files:
|
|
236
236
|
- features/weka_pipeline.feature
|
237
237
|
- lib/bio-band.rb
|
238
238
|
- lib/bio-band/apache.rb
|
239
|
+
- lib/bio-band/apache/stat/correlation.rb
|
239
240
|
- lib/bio-band/apache/stat/inference.rb
|
241
|
+
- lib/bio-band/apache/stat/regression.rb
|
240
242
|
- lib/bio-band/core.rb
|
241
243
|
- lib/bio-band/core/parser/parser.rb
|
242
244
|
- lib/bio-band/core/type/apache_matrices.rb
|