Sha256: c20a2cc9dec1597ae50260b5dac01a73be891d12bd37dd4cddef0e09f75a2555

Contents?: true

Size: 515 Bytes

Versions: 2

Compression:

Stored size: 515 Bytes

Contents

#!/usr/bin/env ruby
# -*- coding: utf-8 -*-

module Recommendation
  class Supervisor
    def initialize(params = {})
      @table = params
    end

    def table
      @table
    end

    def train(params = {})
      @table.merge!(params)
    end

    def transform_table
      new_table = {}
      @table.each do |key, value|
        value.each do |new_key, new_value|
          new_table[new_key] ||= Hash.new
          new_table[new_key][key] = new_value
        end
      end
      new_table
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
recommendation-0.2.0 lib/recommendation/supervisor.rb
recommendation-0.1.3 lib/recommendation/supervisor.rb