Sha256: b361d228335406f7072f3d3c3601dde669e7158f35d1cc0f100ddbf3d303846b

Contents?: true

Size: 1.91 KB

Versions: 5

Compression:

Stored size: 1.91 KB

Contents

module VowpalWabbit
  module FFI
    extend ::FFI::Library

    begin
      ffi_lib VowpalWabbit.ffi_lib
    rescue LoadError => e
      raise e if ENV["VOWPALWABBIT_DEBUG"]
      raise LoadError, "Could not find Vowpal Wabbit"
    end

    # https://github.com/VowpalWabbit/vowpal_wabbit/blob/master/vowpalwabbit/vwdll.h
    # keep same order

    attach_function :VW_InitializeA, %i[string], :pointer
    attach_function :VW_InitializeWithModel, %i[string pointer size_t], :pointer
    attach_function :VW_SeedWithModel, %i[pointer string], :pointer
    attach_function :VW_Finish_Passes, %i[pointer], :void
    attach_function :VW_Finish, %i[pointer], :void
    attach_function :VW_ImportExample, %i[pointer string pointer size_t], :pointer
    attach_function :VW_ReadExampleA, %i[pointer string], :pointer
    attach_function :VW_StartParser, %i[pointer], :void
    attach_function :VW_EndParser, %i[pointer], :void
    attach_function :VW_GetExample, %i[pointer], :pointer
    attach_function :VW_FinishExample, %i[pointer pointer], :void
    attach_function :VW_GetLabel, %i[pointer], :float
    attach_function :VW_GetFeatureNumber, %i[pointer], :size_t
    attach_function :VW_GetFeatures, %i[pointer pointer pointer], :pointer
    attach_function :VW_HashSpaceA, %i[pointer string], :size_t
    attach_function :VW_Learn, %i[pointer pointer], :float
    attach_function :VW_Predict, %i[pointer pointer], :float
    attach_function :VW_PredictCostSensitive, %i[pointer pointer], :float
    attach_function :VW_Get_Weight, %i[pointer size_t size_t], :float
    attach_function :VW_Set_Weight, %i[pointer size_t size_t float], :void
    attach_function :VW_Num_Weights, %i[pointer], :size_t
    attach_function :VW_Get_Stride, %i[pointer], :size_t
    attach_function :VW_SaveModel, %i[pointer], :void
    attach_function :VW_CopyModelData, %i[pointer pointer pointer pointer], :void
    attach_function :VW_FreeIOBuf, %i[pointer], :void
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vowpalwabbit-0.2.0 lib/vowpalwabbit/ffi.rb
vowpalwabbit-0.1.3 lib/vowpalwabbit/ffi.rb
vowpalwabbit-0.1.2 lib/vowpalwabbit/ffi.rb
vowpalwabbit-0.1.1 lib/vowpalwabbit/ffi.rb
vowpalwabbit-0.1.0 lib/vowpalwabbit/ffi.rb