Sha256: 1192c0f3fee694a93874b0eb748e9b66b042b6d8ad7db04c57f173ded93f10fc

Contents?: true

Size: 365 Bytes

Versions: 5

Compression:

Stored size: 365 Bytes

Contents

module XLearn
  class FM < Model
    def initialize(**options)
      @model_type = "fm"
      super
    end

    # shape is [i, k]
    # for v_{i}
    def latent_factors
      factor = []
      read_txt do |line|
        if line.start_with?("v_")
          factor << line.split(": ").last.split(" ").map(&:to_f)
        end
      end
      factor
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
xlearn-0.1.5 lib/xlearn/fm.rb
xlearn-0.1.4 lib/xlearn/fm.rb
xlearn-0.1.3 lib/xlearn/fm.rb
xlearn-0.1.2 lib/xlearn/fm.rb
xlearn-0.1.1 lib/xlearn/fm.rb