Sha256: a431f3a711bf8f1f8935d71095feebfdd851c0b4ae58062c2d0ae8c07c2477ff

Contents?: true

Size: 534 Bytes

Versions: 2

Compression:

Stored size: 534 Bytes

Contents

require 'spec_helper'

describe "Create examples" do
  describe "from a hash" do
    example = { 11 => 0.11, 21 => 0.21, 101 => 0.99 }.to_example.sort_by(&:index)
    example.should == 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
      example.should == Node.features({11 => 0.11, 21 => 0.21, 101 => 0.99 }).sort_by(&:index)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rb-libsvm-1.3.1 spec/core_ext_spec.rb
rb-libsvm-1.3.0 spec/core_ext_spec.rb