Sha256: 816e51682fd1ac104de54a1e8ae1c964f12b067e6d0ff0ed4a12706f1976282d

Contents?: true

Size: 1.02 KB

Versions: 9

Compression:

Stored size: 1.02 KB

Contents

require 'weka/core/converters'

module Weka
  module Core
    class Loader
      java_import 'java.io.File'

      class << self
        def load_arff(file)
          load_with(Converters::ArffLoader, file: file)
        end

        def load_csv(file)
          load_with(Converters::CSVLoader, file: file)
        end

        def load_json(file)
          load_with(Converters::JSONLoader, file: file)
        end

        # Takes either a *.names or a *.data file and loads the respective other
        # file from the same directory automatically.
        # Returns a Weka::Core::Instances object.
        #
        # See http://www.cs.washington.edu/dm/vfml/appendixes/c45.htm for more
        # information about the C4.5 file format.
        def load_c45(file)
          load_with(Converters::C45Loader, file: file)
        end

        private

        def load_with(loader_class, file:)
          loader        = loader_class.new
          loader.source = File.new(file)
          loader.data_set
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
weka-0.8.0-java lib/weka/core/loader.rb
weka-0.7.4-java lib/weka/core/loader.rb
weka-0.7.3-java lib/weka/core/loader.rb
weka-0.7.2-java lib/weka/core/loader.rb
weka-0.7.1-java lib/weka/core/loader.rb
weka-0.7.0-java lib/weka/core/loader.rb
weka-0.6.0-java lib/weka/core/loader.rb
weka-0.5.0-java lib/weka/core/loader.rb
weka-0.4.0-java lib/weka/core/loader.rb