Sha256: ae8f475e16d8981b9c44a2435780d57b9b5905bcd21b48e2762e8b96f2df1fe4

Contents?: true

Size: 724 Bytes

Versions: 40

Compression:

Stored size: 724 Bytes

Contents

module Tomoto
  class DMR
    def self.new(tw: :one, min_cf: 0, min_df: 0, rm_top: 0, k: 1, alpha: 0.1, eta: 0.01, sigma: 1.0, alpha_epsilon: 1e-10, seed: nil)
      model = _new(to_tw(tw), k, alpha, sigma, eta, alpha_epsilon, seed || -1)
      model.instance_variable_set(:@min_cf, min_cf)
      model.instance_variable_set(:@min_df, min_df)
      model.instance_variable_set(:@rm_top, rm_top)
      init_params(model, binding)
    end

    def add_doc(doc, metadata: "")
      _add_doc(prepare_doc(doc), metadata)
    end

    def lambdas
      if f == 0
        []
      else
        k.times.map { |i| _lambdas(i) }
      end
    end

    def alpha
      lambdas.map { |v| v.map { |v2| Math.exp(v2) } }
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
tomoto-0.5.1-x86_64-linux lib/tomoto/dmr.rb
tomoto-0.5.1-x86_64-darwin lib/tomoto/dmr.rb
tomoto-0.5.1-arm64-darwin lib/tomoto/dmr.rb
tomoto-0.5.1-aarch64-linux lib/tomoto/dmr.rb
tomoto-0.5.1 lib/tomoto/dmr.rb
tomoto-0.5.0-x86_64-linux lib/tomoto/dmr.rb
tomoto-0.5.0-x86_64-darwin lib/tomoto/dmr.rb
tomoto-0.5.0-arm64-darwin lib/tomoto/dmr.rb
tomoto-0.5.0-aarch64-linux lib/tomoto/dmr.rb
tomoto-0.5.0 lib/tomoto/dmr.rb
tomoto-0.4.1-x86_64-linux lib/tomoto/dmr.rb
tomoto-0.4.1-x86_64-darwin lib/tomoto/dmr.rb
tomoto-0.4.1-arm64-darwin lib/tomoto/dmr.rb
tomoto-0.4.1-aarch64-linux lib/tomoto/dmr.rb
tomoto-0.4.1 lib/tomoto/dmr.rb
tomoto-0.4.0-x86_64-linux lib/tomoto/dmr.rb
tomoto-0.4.0-x86_64-darwin lib/tomoto/dmr.rb
tomoto-0.4.0-arm64-darwin lib/tomoto/dmr.rb
tomoto-0.4.0-aarch64-linux lib/tomoto/dmr.rb
tomoto-0.4.0 lib/tomoto/dmr.rb