lib/xlearn/fm.rb in xlearn-0.1.0 vs lib/xlearn/fm.rb in xlearn-0.1.1

- old
+ new

@@ -2,7 +2,19 @@ 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