Module: Core::Type

Defined in:
lib/ruby-band/core/type/instance.rb,
lib/ruby-band/core/type/attribute.rb,
lib/ruby-band/core/type/instances.rb,
lib/ruby-band/core/type/apache_matrices.rb

Defined Under Namespace

Classes: Apache_matrix, Apache_matrix_block, Attribute, Instance, Instances

Class Method Summary collapse

Class Method Details

.create_date_attr(name_of_attr, format) ⇒ Object

Return an Date Attribute class object

  • Args :

    • name_of_attr -> a String, the name of the attribute

    • format -> The format of the attribute



25
26
27
28
# File 'lib/ruby-band/core/type/attribute.rb', line 25

def self.create_date_attr(name_of_attr,format)
	date = Attribute.new(name_of_attr,format)
	return date
end

.create_instances(name, attributes) ⇒ Object

Create an Instances object

  • Args :

    • name -> A name for the Instances object

    • attributes -> An array containing Attribute objects



346
347
348
349
350
# File 'lib/ruby-band/core/type/instances.rb', line 346

def Type.create_instances(name,attributes)
  attributes_vector = FastVector.new
  attributes.each {|value| attributes_vector.addElement(value)}
  return Instances.new(name,attributes_vector,0)
end

.create_nominal_attr(name_of_attr, values_list) ⇒ Object

Return a Nominal Attribute class object

  • Args :

    • name_of_attr -> a String, the name of the attribute

    • values_list -> An array, the list of nominal values



34
35
36
37
38
39
# File 'lib/ruby-band/core/type/attribute.rb', line 34

def self.create_nominal_attr(name_of_attr,values_list)
	labels = FastVector.new
	values_list.each {|value| labels.addElement(value)}
	nominal = Attribute.new(name_of_attr,labels)  
	return nominal
end

.create_numeric_attr(name_of_attr) ⇒ Object

Return an Numeric Attribute class object

  • Args :

    • name_of_attr -> a String, the name of the attribute



16
17
18
19
# File 'lib/ruby-band/core/type/attribute.rb', line 16

def self.create_numeric_attr(name_of_attr)
	numeric = Attribute.new name_of_attr
	return numeric
end

.create_string_attr(name_of_attr) ⇒ Object

Return a String Attribute class object

  • Args :

    • name_of_attr -> a String, the name of the attribute



44
45
46
47
48
# File 'lib/ruby-band/core/type/attribute.rb', line 44

def self.create_string_attr(name_of_attr)
    construct = Attribute.java_class.constructor(Java::java.lang.String,Java::weka.core.FastVector)
    string = construct.new_instance(name_of_attr,nil).to_java
	return string
end