ruby-band 0.1.11
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/.travis.yml +3 -0
- data/Gemfile +30 -0
- data/Gemfile.lock +119 -0
- data/Jarfile +9 -0
- data/Jarfile.lock +10 -0
- data/LICENSE.txt +22 -0
- data/README.md +321 -0
- data/README.rdoc +70 -0
- data/Rakefile +66 -0
- data/VERSION +1 -0
- data/band_server/client.rb +35 -0
- data/band_server/client_alt.rb +35 -0
- data/band_server/first_dataset.csv +15 -0
- data/band_server/second_dataset.csv +15 -0
- data/band_server/simple_server.rb +90 -0
- data/band_server/third_dataset.csv +15 -0
- data/band_server/uploads/first_dataset.csv +15 -0
- data/band_server/uploads/second_dataset.csv +15 -0
- data/band_server/uploads/third_dataset.csv +15 -0
- data/bin/ruby-band +83 -0
- data/ext/mkrf_conf.rb +74 -0
- data/features/create_dataset.feature +12 -0
- data/features/step_definitions/create_dataset.rb +39 -0
- data/features/step_definitions/weka_classifiers.rb +43 -0
- data/features/step_definitions/weka_clustering.rb +34 -0
- data/features/step_definitions/weka_filters.rb +32 -0
- data/features/step_definitions/weka_parsers.rb +46 -0
- data/features/step_definitions/weka_pipeline.rb +41 -0
- data/features/support/env.rb +3 -0
- data/features/weka_classifiers.feature +16 -0
- data/features/weka_clustering.feature +15 -0
- data/features/weka_filters.feature +12 -0
- data/features/weka_parsers.feature +18 -0
- data/features/weka_pipeline.feature +14 -0
- data/lib/ruby-band.rb +12 -0
- data/lib/ruby-band/apache.rb +2 -0
- data/lib/ruby-band/apache/stat/correlation.rb +42 -0
- data/lib/ruby-band/apache/stat/inference.rb +151 -0
- data/lib/ruby-band/apache/stat/regression.rb +22 -0
- data/lib/ruby-band/core.rb +6 -0
- data/lib/ruby-band/core/parser/parser.rb +27 -0
- data/lib/ruby-band/core/type/apache_matrices.rb +35 -0
- data/lib/ruby-band/core/type/attribute.rb +53 -0
- data/lib/ruby-band/core/type/instance.rb +10 -0
- data/lib/ruby-band/core/type/instances.rb +361 -0
- data/lib/ruby-band/core/type/utils.rb +31 -0
- data/lib/ruby-band/weka.rb +14 -0
- data/lib/ruby-band/weka/attribute_selection/attribute_selection_utils.rb +20 -0
- data/lib/ruby-band/weka/attribute_selection/evaluators.rb +58 -0
- data/lib/ruby-band/weka/attribute_selection/search.rb +52 -0
- data/lib/ruby-band/weka/classifiers/bayes/bayes.rb +86 -0
- data/lib/ruby-band/weka/classifiers/bayes/bayes_utils.rb +82 -0
- data/lib/ruby-band/weka/classifiers/evaluation.rb +13 -0
- data/lib/ruby-band/weka/classifiers/functions/functions.rb +177 -0
- data/lib/ruby-band/weka/classifiers/functions/functions_utils.rb +78 -0
- data/lib/ruby-band/weka/classifiers/lazy/lazy.rb +86 -0
- data/lib/ruby-band/weka/classifiers/lazy/lazy_utils.rb +83 -0
- data/lib/ruby-band/weka/classifiers/mi/mi.rb +191 -0
- data/lib/ruby-band/weka/classifiers/mi/mi_utils.rb +80 -0
- data/lib/ruby-band/weka/classifiers/rules/rules.rb +190 -0
- data/lib/ruby-band/weka/classifiers/rules/rules_utils.rb +81 -0
- data/lib/ruby-band/weka/classifiers/trees/trees.rb +110 -0
- data/lib/ruby-band/weka/classifiers/trees/trees_utils.rb +85 -0
- data/lib/ruby-band/weka/clusterers/clusterers.rb +99 -0
- data/lib/ruby-band/weka/clusterers/clusterers_utils.rb +86 -0
- data/lib/ruby-band/weka/db/DatabaseUtils_mysql +280 -0
- data/lib/ruby-band/weka/db/DatabaseUtils_postgresql +594 -0
- data/lib/ruby-band/weka/db/db.rb +74 -0
- data/lib/ruby-band/weka/filters/supervised/attribute/attribute.rb +55 -0
- data/lib/ruby-band/weka/filters/supervised/instance/instance.rb +17 -0
- data/lib/ruby-band/weka/filters/supervised/supervised_utils.rb +38 -0
- data/lib/ruby-band/weka/filters/unsupervised/attribute/attribute.rb +90 -0
- data/lib/ruby-band/weka/filters/unsupervised/instance/instance.rb +48 -0
- data/lib/ruby-band/weka/filters/unsupervised/unsupervised_utils.rb +38 -0
- data/resources/ReutersGrain-test.arff +611 -0
- data/resources/ReutersGrain-train.arff +1561 -0
- data/resources/weather.csv +15 -0
- data/resources/weather.numeric.arff +23 -0
- data/ruby-band.gemspec +178 -0
- data/spec/ruby-band_spec.rb +7 -0
- data/spec/spec_helper.rb +12 -0
- data/test/helper.rb +18 -0
- data/test/test_apacheCorrelation.rb +22 -0
- data/test/test_apacheInference.rb +46 -0
- data/test/test_ruby-band.rb +9 -0
- metadata +426 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'java'
|
2
|
+
|
3
|
+
module Core
|
4
|
+
module Utils
|
5
|
+
|
6
|
+
# Convert a bidimensional RubyArray to a java double [][]
|
7
|
+
def Utils.bidimensional_to_double(ruby_array)
|
8
|
+
ruby_array.to_java Java::double[]
|
9
|
+
end
|
10
|
+
|
11
|
+
def Utils.bidimensional_to_long(ruby_array)
|
12
|
+
ruby_array.to_java Java::long[]
|
13
|
+
end
|
14
|
+
|
15
|
+
def Utils.double_to_a(java_array)
|
16
|
+
ruby_array = []
|
17
|
+
java_array.each {|val| ruby_array << val}
|
18
|
+
ruby_array
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class Array
|
25
|
+
def is_2d?
|
26
|
+
self.each do |item|
|
27
|
+
return true if item.is_a? Array
|
28
|
+
end
|
29
|
+
return false
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'ruby-band/weka/db/db'
|
2
|
+
require 'ruby-band/weka/filters/unsupervised/attribute/attribute'
|
3
|
+
require 'ruby-band/weka/filters/unsupervised/instance/instance'
|
4
|
+
require 'ruby-band/weka/filters/supervised/instance/instance'
|
5
|
+
require 'ruby-band/weka/filters/supervised/attribute/attribute'
|
6
|
+
require 'ruby-band/weka/classifiers/bayes/bayes'
|
7
|
+
require 'ruby-band/weka/classifiers/evaluation'
|
8
|
+
require 'ruby-band/weka/classifiers/functions/functions'
|
9
|
+
require 'ruby-band/weka/classifiers/trees/trees'
|
10
|
+
require 'ruby-band/weka/classifiers/lazy/lazy'
|
11
|
+
require 'ruby-band/weka/classifiers/rules/rules'
|
12
|
+
require 'ruby-band/weka/clusterers/clusterers'
|
13
|
+
require 'ruby-band/weka/attribute_selection/evaluators'
|
14
|
+
require 'ruby-band/weka/attribute_selection/search'
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Attribute_selection_Utils
|
2
|
+
java_import "weka.core.Utils"
|
3
|
+
|
4
|
+
#Instance methods list
|
5
|
+
def options_list
|
6
|
+
listOptions.map {|key| "#{key.synopsis} #{key.description}"}.join("\n")
|
7
|
+
end
|
8
|
+
|
9
|
+
#Set options for an evaluator or a search algorithm
|
10
|
+
def select_options(options_string)
|
11
|
+
options = Utils.splitOptions(options_string)
|
12
|
+
set_options(options)
|
13
|
+
end
|
14
|
+
|
15
|
+
#Return a short description for the selected evalutator object or search algorithm
|
16
|
+
def description
|
17
|
+
globalInfo
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
$:.unshift File.dirname(__FILE__)
|
2
|
+
require 'attribute_selection_utils'
|
3
|
+
|
4
|
+
module Weka
|
5
|
+
module Attribute_selection
|
6
|
+
module Evaluator
|
7
|
+
#This module contains evaluators from the 'weka.attributeSelection' packages
|
8
|
+
java_import 'weka.attributeSelection.CfsSubsetEval'
|
9
|
+
java_import 'weka.attributeSelection.ChiSquaredAttributeEval'
|
10
|
+
java_import 'weka.attributeSelection.ClassifierSubsetEval'
|
11
|
+
java_import 'weka.attributeSelection.ConsistencySubsetEval'
|
12
|
+
java_import 'weka.attributeSelection.CostSensitiveAttributeEval'
|
13
|
+
java_import 'weka.attributeSelection.CostSensitiveSubsetEval'
|
14
|
+
java_import 'weka.attributeSelection.FilteredAttributeEval'
|
15
|
+
java_import 'weka.attributeSelection.FilteredSubsetEval'
|
16
|
+
java_import 'weka.attributeSelection.GainRatioAttributeEval'
|
17
|
+
java_import 'weka.attributeSelection.SVMAttributeEval'
|
18
|
+
|
19
|
+
class CfsSubsetEval
|
20
|
+
include Attribute_selection_Utils
|
21
|
+
# java_alias :use_options , :setOptions, [Java::Java.lang.String[]]
|
22
|
+
end
|
23
|
+
|
24
|
+
class ChiSquaredAttributeEval
|
25
|
+
include Attribute_selection_Utils
|
26
|
+
end
|
27
|
+
|
28
|
+
class ClassifierSubsetEval
|
29
|
+
include Attribute_selection_Utils
|
30
|
+
end
|
31
|
+
|
32
|
+
class ConsistencySubsetEval
|
33
|
+
include Attribute_selection_Utils
|
34
|
+
end
|
35
|
+
|
36
|
+
class CostSensitiveSubsetEval
|
37
|
+
include Attribute_selection_Utils
|
38
|
+
end
|
39
|
+
|
40
|
+
class FilteredAttributeEval
|
41
|
+
include Attribute_selection_Utils
|
42
|
+
end
|
43
|
+
|
44
|
+
class FilteredSubsetEval
|
45
|
+
include Attribute_selection_Utils
|
46
|
+
end
|
47
|
+
|
48
|
+
class GainRatioAttributeEval
|
49
|
+
include Attribute_selection_Utils
|
50
|
+
end
|
51
|
+
|
52
|
+
class SVMAttributeEval
|
53
|
+
include Attribute_selection_Utils
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
$:.unshift File.dirname(__FILE__)
|
2
|
+
require 'attribute_selection_utils'
|
3
|
+
|
4
|
+
module Weka
|
5
|
+
module Attribute_selection
|
6
|
+
#This module contains search algorithms from the 'weka.attributeSelection' packages
|
7
|
+
module Search
|
8
|
+
|
9
|
+
java_import 'weka.attributeSelection.GreedyStepwise'
|
10
|
+
java_import 'weka.attributeSelection.RankSearch'
|
11
|
+
java_import 'weka.attributeSelection.Ranker'
|
12
|
+
java_import 'weka.attributeSelection.ExhaustiveSearch'
|
13
|
+
java_import 'weka.attributeSelection.GeneticSearch'
|
14
|
+
java_import 'weka.attributeSelection.RaceSearch'
|
15
|
+
java_import 'weka.attributeSelection.RandomSearch'
|
16
|
+
java_import 'weka.attributeSelection.ScatterSearchV1'
|
17
|
+
|
18
|
+
class GreedyStepwise
|
19
|
+
include Attribute_selection_Utils
|
20
|
+
end
|
21
|
+
|
22
|
+
class Ranker
|
23
|
+
include Attribute_selection_Utils
|
24
|
+
end
|
25
|
+
|
26
|
+
class RankSearch
|
27
|
+
include Attribute_selection_Utils
|
28
|
+
end
|
29
|
+
|
30
|
+
class ExhaustiveSearch
|
31
|
+
include Attribute_selection_Utils
|
32
|
+
end
|
33
|
+
|
34
|
+
class GeneticSearch
|
35
|
+
include Attribute_selection_Utils
|
36
|
+
end
|
37
|
+
|
38
|
+
class RaceSearch
|
39
|
+
include Attribute_selection_Utils
|
40
|
+
end
|
41
|
+
|
42
|
+
class RandomSearch
|
43
|
+
include Attribute_selection_Utils
|
44
|
+
end
|
45
|
+
|
46
|
+
class ScatterSearchV1
|
47
|
+
include Attribute_selection_Utils
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
$:.unshift File.dirname(__FILE__)
|
2
|
+
require 'bayes_utils'
|
3
|
+
|
4
|
+
module Weka
|
5
|
+
module Classifier
|
6
|
+
#This module stores the classifiers from the 'weka.classifiers.bayes' package
|
7
|
+
module Bayes
|
8
|
+
java_import "weka.classifiers.bayes.NaiveBayes"
|
9
|
+
java_import "weka.classifiers.bayes.BayesianLogisticRegression"
|
10
|
+
java_import "weka.classifiers.bayes.AODE"
|
11
|
+
java_import "weka.classifiers.bayes.ComplementNaiveBayes"
|
12
|
+
java_import "weka.classifiers.bayes.WAODE"
|
13
|
+
|
14
|
+
class NaiveBayes
|
15
|
+
include Bayes_utils
|
16
|
+
class Base < NaiveBayes
|
17
|
+
def initialize(&block)
|
18
|
+
super
|
19
|
+
if block_given?
|
20
|
+
init_instance_classifier(&block)
|
21
|
+
else
|
22
|
+
init_classifier
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class AODE
|
29
|
+
include Bayes_utils
|
30
|
+
class Base < AODE
|
31
|
+
def initialize(&block)
|
32
|
+
super
|
33
|
+
if block_given?
|
34
|
+
init_instance_classifier(&block)
|
35
|
+
else
|
36
|
+
init_classifier
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
class BayesianLogisticRegression
|
43
|
+
include Bayes_utils
|
44
|
+
class Base < BayesianLogisticRegression
|
45
|
+
def initialize(&block)
|
46
|
+
super
|
47
|
+
if block_given?
|
48
|
+
init_instance_classifier(&block)
|
49
|
+
else
|
50
|
+
init_classifier
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
class ComplementNaiveBayes
|
57
|
+
include Bayes_utils
|
58
|
+
class Base < ComplementNaiveBayes
|
59
|
+
def initialize(&block)
|
60
|
+
super
|
61
|
+
if block_given?
|
62
|
+
init_instance_classifier(&block)
|
63
|
+
else
|
64
|
+
init_classifier
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
class WAODE
|
71
|
+
include Bayes_utils
|
72
|
+
class Base < WAODE
|
73
|
+
def initialize(&block)
|
74
|
+
super
|
75
|
+
if block_given?
|
76
|
+
init_instance_classifier(&block)
|
77
|
+
else
|
78
|
+
init_classifier
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
#This module is used by the Bayesian classifiers from 'bayes.rb'
|
2
|
+
#to inherit the following methods (instance and class methods)
|
3
|
+
module Bayes_utils
|
4
|
+
|
5
|
+
java_import "weka.core.Utils"
|
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
|
+
|
13
|
+
def init_instance_classifier(&block)
|
14
|
+
self.instance_eval(&block)
|
15
|
+
@dataset.setClassIndex(@class_index)
|
16
|
+
build_classifier(@dataset)
|
17
|
+
end
|
18
|
+
|
19
|
+
# set data for instance classifier
|
20
|
+
def set_data(data)
|
21
|
+
@dataset = data
|
22
|
+
end
|
23
|
+
|
24
|
+
# set class index for the input dataset
|
25
|
+
def set_class_index(class_index)
|
26
|
+
@class_index = class_index
|
27
|
+
end
|
28
|
+
|
29
|
+
#Instance methods list
|
30
|
+
def self.included(base)
|
31
|
+
base.extend(ClassMethods)
|
32
|
+
end
|
33
|
+
|
34
|
+
# set classifier options
|
35
|
+
def set_options(options)
|
36
|
+
options_inst = Utils.splitOptions(options)
|
37
|
+
setOptions(options_inst)
|
38
|
+
end
|
39
|
+
|
40
|
+
def list_options
|
41
|
+
listOptions.map {|key| "#{key.synopsis} #{key.description}"}.join("\n")
|
42
|
+
end
|
43
|
+
|
44
|
+
# return the description reported in the Weka Java doc
|
45
|
+
def description
|
46
|
+
globalInfo
|
47
|
+
end
|
48
|
+
|
49
|
+
# perform crossvalidation on a trained classifier
|
50
|
+
#ARGV:
|
51
|
+
#fold -> 'int' value
|
52
|
+
def cross_validate(fold)
|
53
|
+
if self.class.data
|
54
|
+
eval = Weka::Classifier::Evaluation.new self.class.data
|
55
|
+
eval.crossValidateModel(self.class.ancestors[2].new, self.class.data, fold.to_java(:int), Random.new(1))
|
56
|
+
eval.summary
|
57
|
+
else
|
58
|
+
eval = Weka::Classifier::Evaluation.new @dataset
|
59
|
+
eval.crossValidateModel(self.class.ancestors[1].new, @dataset, fold.to_java(:int), Random.new(1))
|
60
|
+
eval.summary
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
#Class methods module
|
65
|
+
module ClassMethods
|
66
|
+
|
67
|
+
def self.classifier_attr_accessor(*args)
|
68
|
+
args.each do |arg|
|
69
|
+
#Here's the getter
|
70
|
+
self.class_eval("def #{arg};@#{arg};end")
|
71
|
+
#Here's the setter
|
72
|
+
self.class_eval("def set_#{arg}(val);@#{arg}=val;end")
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
classifier_attr_accessor :options,:data,:class_index
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
|
@@ -0,0 +1,177 @@
|
|
1
|
+
$:.unshift File.dirname(__FILE__)
|
2
|
+
require 'functions_utils'
|
3
|
+
|
4
|
+
module Weka
|
5
|
+
module Classifier
|
6
|
+
#This module stores the classifiers from the 'weka.classifiers.functions' package
|
7
|
+
module Functions
|
8
|
+
java_import 'weka.classifiers.functions.LinearRegression'
|
9
|
+
java_import 'weka.classifiers.functions.PLSClassifier'
|
10
|
+
java_import 'weka.classifiers.functions.RBFNetwork'
|
11
|
+
java_import 'weka.classifiers.functions.GaussianProcesses'
|
12
|
+
java_import 'weka.classifiers.functions.LeastMedSq'
|
13
|
+
java_import 'weka.classifiers.functions.LibSVM'
|
14
|
+
java_import 'weka.classifiers.functions.SMO'
|
15
|
+
java_import 'weka.classifiers.functions.SMOreg'
|
16
|
+
java_import 'weka.classifiers.functions.SPegasos'
|
17
|
+
java_import 'weka.classifiers.functions.VotedPerceptron'
|
18
|
+
java_import 'weka.classifiers.functions.Winnow'
|
19
|
+
|
20
|
+
|
21
|
+
class LeastMedSq
|
22
|
+
include Functions_utils
|
23
|
+
class Base < LeastMedSq
|
24
|
+
def initialize(&block)
|
25
|
+
super
|
26
|
+
if block_given?
|
27
|
+
init_instance_classifier(&block)
|
28
|
+
else
|
29
|
+
init_classifier
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class LibSVM
|
36
|
+
include Functions_utils
|
37
|
+
class Base < LibSVM
|
38
|
+
def initialize(&block)
|
39
|
+
super
|
40
|
+
if block_given?
|
41
|
+
init_instance_classifier(&block)
|
42
|
+
else
|
43
|
+
init_classifier
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class LinearRegression
|
50
|
+
include Functions_utils
|
51
|
+
class Base < LinearRegression
|
52
|
+
def initialize(&block)
|
53
|
+
super
|
54
|
+
if block_given?
|
55
|
+
init_instance_classifier(&block)
|
56
|
+
else
|
57
|
+
init_classifier
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
class PLSClassifier
|
64
|
+
include Functions_utils
|
65
|
+
class Base < PLSClassifier
|
66
|
+
def initialize(&block)
|
67
|
+
super
|
68
|
+
if block_given?
|
69
|
+
init_instance_classifier(&block)
|
70
|
+
else
|
71
|
+
init_classifier
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
class RBFNetwork
|
78
|
+
include Functions_utils
|
79
|
+
class Base < RBFNetwork
|
80
|
+
def initialize(&block)
|
81
|
+
super
|
82
|
+
if block_given?
|
83
|
+
init_instance_classifier(&block)
|
84
|
+
else
|
85
|
+
init_classifier
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
class SMO
|
92
|
+
include Functions_utils
|
93
|
+
class Base < SMO
|
94
|
+
def initialize(&block)
|
95
|
+
super
|
96
|
+
if block_given?
|
97
|
+
init_instance_classifier(&block)
|
98
|
+
else
|
99
|
+
init_classifier
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
class SMOreg
|
106
|
+
include Functions_utils
|
107
|
+
class Base < SMOreg
|
108
|
+
def initialize(&block)
|
109
|
+
super
|
110
|
+
if block_given?
|
111
|
+
init_instance_classifier(&block)
|
112
|
+
else
|
113
|
+
init_classifier
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
class SPegasos
|
120
|
+
include Functions_utils
|
121
|
+
class Base < SPegasos
|
122
|
+
def initialize(&block)
|
123
|
+
super
|
124
|
+
if block_given?
|
125
|
+
init_instance_classifier(&block)
|
126
|
+
else
|
127
|
+
init_classifier
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
class GaussianProcesses
|
134
|
+
include Functions_utils
|
135
|
+
class Base < GaussianProcesses
|
136
|
+
def initialize(&block)
|
137
|
+
super
|
138
|
+
if block_given?
|
139
|
+
init_instance_classifier(&block)
|
140
|
+
else
|
141
|
+
init_classifier
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
class VotedPerceptron
|
148
|
+
include Functions_utils
|
149
|
+
class Base < VotedPerceptron
|
150
|
+
def initialize(&block)
|
151
|
+
super
|
152
|
+
if block_given?
|
153
|
+
init_instance_classifier(&block)
|
154
|
+
else
|
155
|
+
init_classifier
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
class Winnow
|
162
|
+
include Functions_utils
|
163
|
+
class Base < Winnow
|
164
|
+
def initialize(&block)
|
165
|
+
super
|
166
|
+
if block_given?
|
167
|
+
init_instance_classifier(&block)
|
168
|
+
else
|
169
|
+
init_classifier
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|