Class: Ai4r::Classifiers::CategoryNode

Inherits:
Object
  • Object
show all
Defined in:
lib/ai4r/classifiers/id3.rb

Overview

:nodoc: all

Instance Method Summary collapse

Constructor Details

#initialize(label, value) ⇒ Object

Parameters:

  • label (Object)
  • value (Object)


637
638
639
640
# File 'lib/ai4r/classifiers/id3.rb', line 637

def initialize(label, value)
  @label = label
  @value = value
end

Instance Method Details

#get_rulesObject

Returns:

  • (Object)


650
651
652
# File 'lib/ai4r/classifiers/id3.rb', line 650

def get_rules
  [["#{@label}='#{@value}'"]]
end

#to_graphviz(id, lines, parent = nil, edge_label = nil) ⇒ Object

Parameters:

  • id (Object)
  • lines (Object)
  • parent (Object) (defaults to: nil)
  • edge_label (Object) (defaults to: nil)

Returns:

  • (Object)


664
665
666
667
668
669
# File 'lib/ai4r/classifiers/id3.rb', line 664

def to_graphviz(id, lines, parent = nil, edge_label = nil)
  my_id = id
  lines << "  node#{my_id} [label=\"#{@value}\", shape=box]"
  lines << "  node#{parent} -> node#{my_id} [label=\"#{edge_label}\"]" if parent
  my_id
end

#to_hObject

Returns:

  • (Object)


655
656
657
# File 'lib/ai4r/classifiers/id3.rb', line 655

def to_h
  @value
end

#value(_data, _classifier = nil) ⇒ Object

Parameters:

  • data (Object)
  • classifier (Object)

Returns:

  • (Object)


645
646
647
# File 'lib/ai4r/classifiers/id3.rb', line 645

def value(_data, _classifier = nil)
  @value
end