Sha256: 7af9b762319d119d800e8f30c439bc2767f4917348f5876b10377cf3b5cf4172

Contents?: true

Size: 1.4 KB

Versions: 15

Compression:

Stored size: 1.4 KB

Contents

require "spec_helper"

describe "A Parameter has accessors for" do
  before do
    @p = Libsvm::SvmParameter.new
  end
  it "int svm_type" do
    SvmType::C_SVC.should == 0
    @p.svm_type = SvmType::C_SVC
    @p.svm_type.should == SvmType::C_SVC
  end

  it "int kernel_type" do
    KernelType::RBF.should == 2
    @p.kernel_type = KernelType::RBF
    @p.kernel_type.should == KernelType::RBF
  end

  it "int degree" do
    @p.degree = 99
    @p.degree.should == 99
  end

  it "double gamma" do
    @p.gamma = 0.33
    @p.gamma.should == 0.33
  end

  it "double coef0" do
    @p.coef0 = 0.99
    @p.coef0.should == 0.99
  end

  it "double cache_size" do
    @p.cache_size = 0.77
    @p.cache_size.should == 0.77
  end

  it "double eps" do
    @p.eps = 0.111
    @p.eps.should == 0.111
    @p.eps = 0.112
    @p.eps.should == 0.112
  end

  it "double C" do
    @p.c = 3.141
    @p.c.should == 3.141
  end

  it "can set and read weights (weight, weight_label, nr_weight members from struct)" do
    @p.label_weights = {1=> 1.2, 3=>0.2, 5=>0.888}
    @p.label_weights.should == {1=> 1.2, 3=>0.2, 5=>0.888}
  end


  it "double nu" do
    @p.nu = 1.1
    @p.nu.should == 1.1
  end

  it "double p" do
    @p.p = 0.123
    @p.p.should == 0.123
  end

  it "int shrinking" do
    @p.shrinking = 22
    @p.shrinking.should == 22
  end

  it "int probability" do
    @p.probability = 35
    @p.probability.should == 35
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rb-libsvm-1.3.1 spec/parameter_spec.rb
rb-libsvm-1.3.0 spec/parameter_spec.rb
rb-libsvm-1.2.0 spec/parameter_spec.rb
rb-libsvm-1.1.5 spec/parameter_spec.rb
rb-libsvm-1.1.4 spec/parameter_spec.rb
rb-libsvm-1.1.3 spec/parameter_spec.rb
rb-libsvm-1.1.2 spec/parameter_spec.rb
rb-libsvm-1.1.1 spec/parameter_spec.rb
rb-libsvm-1.1.0 spec/parameter_spec.rb
rb-libsvm-1.0.11 spec/parameter_spec.rb
rb-libsvm-1.0.10 spec/parameter_spec.rb
rb-libsvm-1.0.9 spec/parameter_spec.rb
rb-libsvm-1.0.8 spec/parameter_spec.rb
rb-libsvm-1.0.7 spec/parameter_spec.rb
rb-libsvm-1.0.6 spec/parameter_spec.rb