Sha256: c0b5d6eb36e0d87037ecd1f6ffc6125254a8342c1dfb8475b453308dfe3ee9c4
Contents?: true
Size: 832 Bytes
Versions: 2
Compression:
Stored size: 832 Bytes
Contents
#!/usr/bin/ruby $:.unshift(File.dirname(__FILE__)+'/../lib/') require 'statsample' require 'benchmark' samples=10000 a=samples.times.collect {rand}.to_scale b=samples.times.collect {rand}.to_scale c=samples.times.collect {rand}.to_scale d=samples.times.collect {rand}.to_scale ds={'a'=>a,'b'=>b,'c'=>c,'d'=>d}.to_dataset ds['y']=ds.collect{|row| row['a']*5+row['b']*3+row['c']*2+row['d']*1+rand()} Benchmark.bm(7) do |x| rb=ReportBuilder.new("Multiple Regression Engines") if Statsample.has_gsl? x.report("GSL:") { lr=Statsample::Regression::Multiple::GslEngine.new(ds,'y',:name=>"Multiple Regression using GSL") rb.add(lr.summary) } end x.report("Ruby:") { lr=Statsample::Regression::Multiple::RubyEngine.new(ds,'y',:name=>"Multiple Regression using RubyEngine") rb.add(lr.summary) } puts rb.to_text end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
statsample-0.7.0 | demo/multiple_regression.rb |
statsample-0.6.7 | demo/multiple_regression.rb |