Class: HybridForest::Trees::Split

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/hybridforest/trees/split.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(feature, info_gain: 0, subsets: [Rover::DataFrame.new, Rover::DataFrame.new], value: nil) ⇒ Split

Returns a new instance of Split.



10
11
12
13
14
15
# File 'lib/hybridforest/trees/split.rb', line 10

def initialize(feature, info_gain: 0, subsets: [Rover::DataFrame.new, Rover::DataFrame.new], value: nil)
  @feature = feature
  @value = value
  @subsets = subsets
  @info_gain = info_gain
end

Instance Attribute Details

#featureObject (readonly)

Returns the value of attribute feature.



6
7
8
# File 'lib/hybridforest/trees/split.rb', line 6

def feature
  @feature
end

#info_gainObject (readonly)

Returns the value of attribute info_gain.



6
7
8
# File 'lib/hybridforest/trees/split.rb', line 6

def info_gain
  @info_gain
end

#subsetsObject (readonly)

Returns the value of attribute subsets.



6
7
8
# File 'lib/hybridforest/trees/split.rb', line 6

def subsets
  @subsets
end

#valueObject (readonly)

Returns the value of attribute value.



6
7
8
# File 'lib/hybridforest/trees/split.rb', line 6

def value
  @value
end

Instance Method Details

#<=>(other) ⇒ Object



17
18
19
# File 'lib/hybridforest/trees/split.rb', line 17

def <=>(other)
  info_gain <=> other.info_gain
end

#binary?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/hybridforest/trees/split.rb', line 21

def binary?
  value ? true : false
end

#multiway?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/hybridforest/trees/split.rb', line 25

def multiway?
  !binary?
end