Sha256: 8a3f06ae5de4544892af3314152ef3dff674e52dc185516c4099246ded63a91a

Contents?: true

Size: 538 Bytes

Versions: 5

Compression:

Stored size: 538 Bytes

Contents

require 'spec_helper'

describe "Create examples" do
  it "from a hash" do
    example = { 11 => 0.11, 21 => 0.21, 101 => 0.99 }.to_example.sort_by(&:index)
    expect(example).to eq(Node.features({11 => 0.11, 21 => 0.21, 101 => 0.99 }).sort_by(&:index))
  end

  describe "from an array of tuples" do
    it "can create example from array of pairs" do
      example = [ [11, 0.11], [21, 0.21], [101, 0.99] ].to_example
      expect(example).to eq(Node.features({11 => 0.11, 21 => 0.21, 101 => 0.99 }).sort_by(&:index))
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rb-libsvm-1.4.4 spec/core_ext_spec.rb
rb-libsvm-1.4.3 spec/core_ext_spec.rb
rb-libsvm-1.4.2 spec/core_ext_spec.rb
rb-libsvm-1.4.1 spec/core_ext_spec.rb
rb-libsvm-1.4.0 spec/core_ext_spec.rb