Created
August 7, 2016 04:08
-
-
Save lokeshh/8fed775e53ee12c296e9fd3d39f6d8ea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'statsample' | |
| require 'benchmark' | |
| n = 10000 | |
| df = Daru::DataFrame.new({ | |
| a: Statsample::Shorthand.rnorm(n), | |
| b: Statsample::Shorthand.rnorm(n), | |
| c: Statsample::Shorthand.rnorm(n), | |
| d: Statsample::Shorthand.rnorm(n), | |
| }) | |
| df[:y] = df.a * 3 + df.b * 5 + df.c * -2 + df.d * 2 | |
| p df.head 5 | |
| p df.vectors | |
| Benchmark.bm do |x| | |
| x.report do | |
| Statsample::Regression.multiple df, :y | |
| end | |
| x.report do | |
| Statsample::GLM.compute df, :y, :normal, algorithm: :mle | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| user system total real | |
| 0.870000 0.010000 0.880000 ( 0.869864) | |
| 21.940000 0.030000 21.970000 ( 21.985580) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment