Sha256: 87d6e77c7490cd734abc968fca86a8a59cb99c316537d8080c7f7f27201d9099

Contents?: true

Size: 1.33 KB

Versions: 4

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

describe Reputation::Functions::GeneralisedLogisticCurve do

  it_should_behave_like "any function"

  describe "instance method" do
    describe "'f'" do
      it "should have an adjustable gradient" do
        function_1 = Reputation::Functions::GeneralisedLogisticCurve.new(
          :a => 0,
          :k => 1,
          :b => 1.5,
          :v => 0.5,
          :q => 0.5,
          :m => 0.5
        )
        function_2 = Reputation::Functions::GeneralisedLogisticCurve.new(
          :a => 0,
          :k => 1,
          :b => 0.5,
          :v => 0.1,
          :q => 0.5,
          :m => 15
        )
        function_3 = Reputation::Functions::GeneralisedLogisticCurve.new(
          :a => 0,
          :k => 1,
          :b => 0.5,
          :v => 1.0,
          :q => 0.5,
          :m => 15
        )
                
        function_1.f(0).should be_close(0.23, 0.05)
        function_2.f(0).should be_close(0, 0.05)
        function_3.f(0).should be_close(0, 0.05)
        
        function_1.f(5).should be_close(0.99, 0.05)
        function_2.f(5).should be_close(0, 0.05)
        function_3.f(5).should be_close(0, 0.05)
        
        function_1.f(20).should be_close(1, 0.05)
        function_2.f(20).should be_close(0.66, 0.05)
        function_3.f(20).should be_close(0.96, 0.05)
      end
    end
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
reputation-0.0.5 spec/functions/generalised_logistic_curve_spec.rb
reputation-0.0.4 spec/functions/generalised_logistic_curve_spec.rb
reputation-0.0.3 spec/functions/generalised_logistic_curve_spec.rb
reputation-0.0.2 spec/functions/generalised_logistic_curve_spec.rb