Class: Eps::PMML::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/eps/pmml/loader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pmml) ⇒ Loader

Returns a new instance of Loader.



6
7
8
9
10
11
# File 'lib/eps/pmml/loader.rb', line 6

def initialize(pmml)
  if pmml.is_a?(String)
    pmml = Nokogiri::XML(pmml) { |config| config.strict }
  end
  @data = pmml
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



4
5
6
# File 'lib/eps/pmml/loader.rb', line 4

def data
  @data
end

Instance Method Details

#loadObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/eps/pmml/loader.rb', line 13

def load
  if data.css("Segmentation").any?
    lightgbm
  elsif data.css("RegressionModel").any?
    linear_regression
  elsif data.css("NaiveBayesModel").any?
    naive_bayes
  else
    raise "Unknown model"
  end
end