ubuntu@ip-172-31-51-75:~$ irb
2.3.0 :001 > require 'daru'
Install the reportbuilder gem version ~>1.4 for using reportbuilder functions.
Install the spreadsheet gem version ~>1.1.1 for using spreadsheet functions.
NameError: uninitialized constant Daru::Accessors::ArrayWrapper::Forwardable
from /home/ubuntu/.rvm/gems/ruby-2.3.0/gems/daru-0.1.4/lib/daru/accessors/array_wrapper.rb:6:in `<class:ArrayWrapper>'
from /home/ubuntu/.rvm/gems/ruby-2.3.0/gems/daru-0.1.4/lib/daru/accessors/array_wrapper.rb:4:in `<module:Accessors>'
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 'ruby-prof' | |
| n = 100000 | |
| dv = Daru::Vector.new 1..n | |
| RubyProf.start | |
| 100.times { dv.reject_values nil } | |
| result = RubyProf.stop | |
| printer = RubyProf::GraphHtmlPrinter.new(result) | |
| printer.print(File.open('cache.html', 'w')) | |
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 '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 |
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 'benchmark' | |
| n = 100000 | |
| dv = Daru::Vector.new 1..n | |
| # For current branch | |
| Benchmark.bm do |x| | |
| x.report do | |
| 100.times { dv[0] = nil } | |
| end |
This file has been truncated, but you can view the full file.
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
| 200000 24 | |
| 1 1 1 0 0 0 0 0 1 1 0 1 0 0 1 1 1 1 0 0 1 1 1 1 | |
| 0 1 1 0 0 1 1 0 0 1 0 1 1 1 1 1 1 0 1 0 1 1 0 1 | |
| 0 1 1 1 0 0 0 0 0 0 0 1 0 0 1 0 1 1 1 0 0 1 0 1 | |
| 1 1 1 0 1 0 1 1 1 0 1 1 1 1 1 0 1 0 0 1 1 0 0 0 | |
| 0 1 0 0 1 1 1 0 1 0 1 1 0 0 1 1 1 1 1 0 0 1 0 0 | |
| 0 1 0 0 1 0 1 0 0 0 0 1 0 0 1 1 1 0 1 1 0 1 0 1 | |
| 0 0 0 1 1 0 0 0 1 1 0 1 1 0 1 0 1 0 1 0 0 0 0 0 | |
| 0 0 0 0 1 0 0 0 0 1 1 1 1 1 0 1 1 1 0 1 1 0 0 0 | |
| 1 1 1 0 0 1 1 0 0 1 0 0 0 1 1 1 1 1 1 1 1 0 0 1 |
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 'benchmark' | |
| require 'matrix' | |
| require 'nmatrix' | |
| class Matrix | |
| public :"[]=", :set_element, :set_component | |
| end | |
| m = Matrix.zero 1000 ; | |
| n = NMatrix.new [1000, 1000], [0]*10**6 |
#language en = @PAGE@ = Please describe your City here.
== Teams == Please manually add a link to your team page below after creating it:
- Team1
- Team2
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 'daru' | |
| require 'benchmark' | |
| # Vector :b is not required here. Taking it only to compare the performance | |
| # with second dataframe which also has two columns. | |
| df1 = Daru::DataFrame.new({ | |
| a: [1, 2, 3]*1000, | |
| b: [1, 2, 3]*1000}, | |
| index: Daru::CategoricalIndex.new([:a, :b, :c, :d, :e, :f]*500) |
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
| array([[ 0.40576443, 0.17155695, 0. , 0. , 0. , | |
| 0. , 0. , 0. , 0. , 0. , | |
| 0. ], | |
| [ 0.20288222, 0.34311389, 0.17489069, 0.08206331, 0.0530504 , | |
| 0.03926702, 0.03141361, 0.0265252 , 0.02344666, 0.02186134, | |
| 0.02300929], | |
| [ 0.10144111, 0.17155695, 0.34978139, 0.16412661, 0.0795756 , | |
| 0.05235602, 0.03926702, 0.03183024, 0.02735444, 0.02498438, | |
| 0.02588545], | |
| [ 0.06762741, 0.08577847, 0.17489069, 0.32825322, 0.15915119, |
Support for categorical data is important for any data analysis tool. This summer I added categorical data support to:
- to easily analyze categorical data in Daru
- visualize categorical data
- support regression with categorical variable in Statsample and Statsample-GLM
Here's my project page.
Lets talk about each of them in detail.