daru_lite 0.3.3 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +60 -0
  3. data/README.md +1 -1
  4. data/lib/daru_lite/category.rb +1 -1
  5. data/lib/daru_lite/data_frame/duplicatable.rb +7 -1
  6. data/lib/daru_lite/data_frame/fetchable.rb +1 -1
  7. data/lib/daru_lite/data_frame/iterable.rb +5 -2
  8. data/lib/daru_lite/data_frame/sortable.rb +13 -5
  9. data/lib/daru_lite/dataframe.rb +52 -11
  10. data/lib/daru_lite/date_time/index.rb +2 -2
  11. data/lib/daru_lite/index/categorical_index.rb +62 -0
  12. data/lib/daru_lite/index/multi_index.rb +24 -6
  13. data/lib/daru_lite/maths/statistics/dataframe.rb +9 -5
  14. data/lib/daru_lite/maths/statistics/vector.rb +1 -1
  15. data/lib/daru_lite/version.rb +1 -1
  16. data/lib/daru_lite.rb +1 -0
  17. metadata +54 -284
  18. data/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
  19. data/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  20. data/.github/dependabot.yml +0 -11
  21. data/.github/workflows/ci.yml +0 -33
  22. data/.gitignore +0 -10
  23. data/.rspec +0 -2
  24. data/.rubocop.yml +0 -27
  25. data/.rubocop_todo.yml +0 -139
  26. data/CONTRIBUTING.md +0 -47
  27. data/Gemfile +0 -2
  28. data/Rakefile +0 -69
  29. data/ReleasePolicy.md +0 -20
  30. data/benchmarks/TradeoffData.csv +0 -65
  31. data/benchmarks/csv_reading.rb +0 -22
  32. data/benchmarks/dataframe_creation.rb +0 -39
  33. data/benchmarks/db_loading.rb +0 -33
  34. data/benchmarks/duplicating.rb +0 -45
  35. data/benchmarks/group_by.rb +0 -32
  36. data/benchmarks/joining.rb +0 -52
  37. data/benchmarks/row_access.rb +0 -41
  38. data/benchmarks/row_assign.rb +0 -36
  39. data/benchmarks/sorting.rb +0 -51
  40. data/benchmarks/statistics.rb +0 -28
  41. data/benchmarks/vector_access.rb +0 -31
  42. data/benchmarks/vector_assign.rb +0 -42
  43. data/benchmarks/where_clause.rb +0 -48
  44. data/benchmarks/where_vs_filter.rb +0 -28
  45. data/daru_lite.gemspec +0 -54
  46. data/daru_lite_test-shm +0 -0
  47. data/daru_lite_test-wal +0 -0
  48. data/images/README.md +0 -5
  49. data/images/con0.png +0 -0
  50. data/images/con1.png +0 -0
  51. data/images/init0.png +0 -0
  52. data/images/init1.png +0 -0
  53. data/images/man0.png +0 -0
  54. data/images/man1.png +0 -0
  55. data/images/man2.png +0 -0
  56. data/images/man3.png +0 -0
  57. data/images/man4.png +0 -0
  58. data/images/man5.png +0 -0
  59. data/images/man6.png +0 -0
  60. data/profile/_base.rb +0 -23
  61. data/profile/df_to_a.rb +0 -10
  62. data/profile/filter.rb +0 -13
  63. data/profile/joining.rb +0 -13
  64. data/profile/sorting.rb +0 -12
  65. data/profile/vector_each_with_index.rb +0 -9
  66. data/profile/vector_new.rb +0 -9
  67. data/spec/accessors/array_wrapper_spec.rb +0 -3
  68. data/spec/category_spec.rb +0 -1741
  69. data/spec/core/group_by_spec.rb +0 -655
  70. data/spec/core/merge_spec.rb +0 -179
  71. data/spec/core/query_spec.rb +0 -347
  72. data/spec/daru_lite_spec.rb +0 -22
  73. data/spec/data_frame/aggregatable_example.rb +0 -65
  74. data/spec/data_frame/buildable_example.rb +0 -109
  75. data/spec/data_frame/calculatable_example.rb +0 -135
  76. data/spec/data_frame/convertible_example.rb +0 -180
  77. data/spec/data_frame/duplicatable_example.rb +0 -111
  78. data/spec/data_frame/fetchable_example.rb +0 -481
  79. data/spec/data_frame/filterable_example.rb +0 -456
  80. data/spec/data_frame/indexable_example.rb +0 -221
  81. data/spec/data_frame/iterable_example.rb +0 -465
  82. data/spec/data_frame/joinable_example.rb +0 -131
  83. data/spec/data_frame/missable_example.rb +0 -47
  84. data/spec/data_frame/pivotable_example.rb +0 -297
  85. data/spec/data_frame/queryable_example.rb +0 -92
  86. data/spec/data_frame/setable_example.rb +0 -482
  87. data/spec/data_frame/sortable_example.rb +0 -350
  88. data/spec/dataframe_spec.rb +0 -1306
  89. data/spec/date_time/data_spec.rb +0 -197
  90. data/spec/date_time/date_time_index_helper_spec.rb +0 -72
  91. data/spec/date_time/index_spec.rb +0 -588
  92. data/spec/date_time/offsets_spec.rb +0 -465
  93. data/spec/extensions/which_dsl_spec.rb +0 -38
  94. data/spec/fixtures/bank2.dat +0 -200
  95. data/spec/fixtures/boolean_converter_test.csv +0 -5
  96. data/spec/fixtures/countries.json +0 -7794
  97. data/spec/fixtures/duplicates.csv +0 -32
  98. data/spec/fixtures/eciresults.html +0 -394
  99. data/spec/fixtures/empties.dat +0 -2
  100. data/spec/fixtures/empty_rows_test.csv +0 -17
  101. data/spec/fixtures/macau.html +0 -3691
  102. data/spec/fixtures/macd_data.csv +0 -150
  103. data/spec/fixtures/matrix_test.csv +0 -100
  104. data/spec/fixtures/moneycontrol.html +0 -6812
  105. data/spec/fixtures/music_data.tsv +0 -2501
  106. data/spec/fixtures/repeated_fields.csv +0 -7
  107. data/spec/fixtures/sales-funnel.csv +0 -18
  108. data/spec/fixtures/scientific_notation.csv +0 -4
  109. data/spec/fixtures/string_converter_test.csv +0 -5
  110. data/spec/fixtures/strings.dat +0 -2
  111. data/spec/fixtures/test_xls.xls +0 -0
  112. data/spec/fixtures/test_xls_2.xls +0 -0
  113. data/spec/fixtures/url_test.txt~ +0 -0
  114. data/spec/fixtures/valid_markup.html +0 -62
  115. data/spec/fixtures/wiki_climate.html +0 -1243
  116. data/spec/fixtures/wiki_table_info.html +0 -631
  117. data/spec/formatters/table_formatter_spec.rb +0 -137
  118. data/spec/helpers_spec.rb +0 -8
  119. data/spec/index/categorical_index_spec.rb +0 -221
  120. data/spec/index/index_spec.rb +0 -438
  121. data/spec/index/multi_index_spec.rb +0 -713
  122. data/spec/io/io_spec.rb +0 -357
  123. data/spec/io/sql_data_source_spec.rb +0 -48
  124. data/spec/iruby/dataframe_spec.rb +0 -170
  125. data/spec/iruby/helpers_spec.rb +0 -49
  126. data/spec/iruby/multi_index_spec.rb +0 -37
  127. data/spec/iruby/vector_spec.rb +0 -105
  128. data/spec/maths/arithmetic/dataframe_spec.rb +0 -148
  129. data/spec/maths/arithmetic/vector_spec.rb +0 -165
  130. data/spec/maths/statistics/dataframe_spec.rb +0 -178
  131. data/spec/maths/statistics/vector_spec.rb +0 -756
  132. data/spec/monkeys_spec.rb +0 -42
  133. data/spec/shared/vector_display_spec.rb +0 -213
  134. data/spec/spec_helper.rb +0 -87
  135. data/spec/support/database_helper.rb +0 -29
  136. data/spec/support/matchers.rb +0 -5
  137. data/spec/vector/aggregatable_example.rb +0 -27
  138. data/spec/vector/calculatable_example.rb +0 -82
  139. data/spec/vector/convertible_example.rb +0 -126
  140. data/spec/vector/duplicatable_example.rb +0 -48
  141. data/spec/vector/fetchable_example.rb +0 -463
  142. data/spec/vector/filterable_example.rb +0 -165
  143. data/spec/vector/indexable_example.rb +0 -201
  144. data/spec/vector/iterable_example.rb +0 -111
  145. data/spec/vector/joinable_example.rb +0 -25
  146. data/spec/vector/missable_example.rb +0 -88
  147. data/spec/vector/queryable_example.rb +0 -91
  148. data/spec/vector/setable_example.rb +0 -300
  149. data/spec/vector/sortable_example.rb +0 -242
  150. data/spec/vector_spec.rb +0 -599
data/.rubocop.yml DELETED
@@ -1,27 +0,0 @@
1
- inherit_from: .rubocop_todo.yml
2
-
3
- AllCops:
4
- Include:
5
- - 'lib/**/*'
6
- Exclude:
7
- - 'daru_lite.gemspec'
8
- - 'Rakefile'
9
- - 'Gemfile'
10
- - 'Guardfile'
11
- - '**/*.erb'
12
- - 'spec/*'
13
- - 'spec/**/*'
14
- - 'vendor/**/*'
15
- - 'benchmarks/*'
16
- - 'profile/*'
17
- - 'tmp/*'
18
- DisplayCopNames: true
19
- TargetRubyVersion: 3.4
20
- NewCops: enable
21
-
22
- plugins:
23
- - rubocop-performance
24
- - rubocop-rspec
25
-
26
- Style/FrozenStringLiteralComment:
27
- EnforcedStyle: never
data/.rubocop_todo.yml DELETED
@@ -1,139 +0,0 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2024-03-03 13:59:21 UTC using RuboCop version 1.60.2.
4
- # The point is for the user to remove these configuration records
5
- # one by one as the offenses are removed from the code base.
6
- # Note that changes in the inspected code, or installation of new
7
- # versions of RuboCop, may require this file to be generated again.
8
-
9
- # Offense count: 1
10
- # This cop supports safe autocorrection (--autocorrect).
11
- # Configuration parameters: EnforcedStyle, IndentationWidth.
12
- # SupportedStyles: aligned, indented
13
- Layout/LineEndStringConcatenationIndentation:
14
- Exclude:
15
- - 'lib/daru_lite/data_frame/indexable.rb'
16
-
17
- # Offense count: 1
18
- # Configuration parameters: AllowComments.
19
- Lint/EmptyClass:
20
- Exclude:
21
- - 'lib/daru_lite/accessors/mdarray_wrapper.rb'
22
-
23
- # Offense count: 5
24
- # Configuration parameters: AllowedParentClasses.
25
- Lint/MissingSuper:
26
- Exclude:
27
- - 'lib/daru_lite/date_time/offsets.rb'
28
- - 'lib/daru_lite/index/categorical_index.rb'
29
- - 'lib/daru_lite/index/index.rb'
30
- - 'lib/daru_lite/index/multi_index.rb'
31
-
32
- # Offense count: 5
33
- # This cop supports safe autocorrection (--autocorrect).
34
- # Configuration parameters: CheckForMethodsWithNoSideEffects.
35
- Lint/Void:
36
- Exclude:
37
- - 'lib/daru_lite/category.rb'
38
- - 'lib/daru_lite/data_frame/indexable.rb'
39
- - 'lib/daru_lite/vector.rb'
40
-
41
- # Offense count: 41
42
- # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
43
- Metrics/AbcSize:
44
- Max: 34
45
-
46
- # Offense count: 5
47
- # Configuration parameters: CountComments, CountAsOne.
48
- Metrics/ClassLength:
49
- Max: 188
50
-
51
- # Offense count: 6
52
- # Configuration parameters: AllowedMethods, AllowedPatterns.
53
- Metrics/CyclomaticComplexity:
54
- Max: 9
55
-
56
- # Offense count: 60
57
- # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
58
- Metrics/MethodLength:
59
- Max: 15
60
-
61
- # Offense count: 4
62
- # Configuration parameters: CountComments, CountAsOne.
63
- Metrics/ModuleLength:
64
- Max: 190
65
-
66
- # Offense count: 4
67
- # Configuration parameters: AllowedMethods, AllowedPatterns.
68
- Metrics/PerceivedComplexity:
69
- Max: 10
70
-
71
- # Offense count: 66
72
- # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
73
- # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
74
- Naming/MethodParameterName:
75
- Enabled: false
76
-
77
- # Offense count: 5
78
- # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
79
- # NamePrefix: is_, has_, have_
80
- # ForbiddenPrefixes: is_, has_, have_
81
- # AllowedMethods: is_a?
82
- # MethodDefinitionMacros: define_method, define_singleton_method
83
- Naming/PredicatePrefix:
84
- Exclude:
85
- - 'spec/**/*'
86
- - 'lib/daru_lite/data_frame/missable.rb'
87
- - 'lib/daru_lite/data_frame/queryable.rb'
88
- - 'lib/daru_lite/vector.rb'
89
-
90
- # Offense count: 5
91
- Security/MarshalLoad:
92
- Exclude:
93
- - 'lib/daru_lite/data_frame/i_o_able.rb'
94
- - 'lib/daru_lite/date_time/index.rb'
95
- - 'lib/daru_lite/index/index.rb'
96
- - 'lib/daru_lite/io/io.rb'
97
- - 'lib/daru_lite/vector.rb'
98
-
99
- # Offense count: 2
100
- Style/ClassVars:
101
- Exclude:
102
- - 'lib/daru_lite.rb'
103
-
104
- # Offense count: 58
105
- # Configuration parameters: AllowedConstants.
106
- Style/Documentation:
107
- Enabled: false
108
-
109
- # Offense count: 7
110
- # This cop supports unsafe autocorrection (--autocorrect-all).
111
- Style/MapToHash:
112
- Exclude:
113
- - 'lib/daru_lite/category.rb'
114
- - 'lib/daru_lite/core/group_by.rb'
115
- - 'lib/daru_lite/data_frame/convertible.rb'
116
- - 'lib/daru_lite/data_frame/duplicatable.rb'
117
- - 'lib/daru_lite/data_frame/fetchable.rb'
118
- - 'lib/daru_lite/data_frame/joinable.rb'
119
- - 'lib/daru_lite/dataframe.rb'
120
-
121
- # Offense count: 1
122
- Style/MultilineBlockChain:
123
- Exclude:
124
- - 'lib/daru_lite/formatters/table.rb'
125
-
126
- # Offense count: 9
127
- # Configuration parameters: AllowedMethods.
128
- # AllowedMethods: respond_to_missing?
129
- Style/OptionalBooleanParameter:
130
- Exclude:
131
- - 'lib/daru_lite/data_frame/convertible.rb'
132
- - 'lib/daru_lite/maths/statistics/vector.rb'
133
- - 'lib/daru_lite/vector.rb'
134
-
135
- # Offense count: 1
136
- # This cop supports unsafe autocorrection (--autocorrect-all).
137
- Style/RedundantSelfAssignment:
138
- Exclude:
139
- - 'lib/daru_lite/data_frame/joinable.rb'
data/CONTRIBUTING.md DELETED
@@ -1,47 +0,0 @@
1
- # Contributing guide
2
-
3
- ## Installing daru development dependencies
4
-
5
- To install dependencies, execute the following commands:
6
-
7
- ``` bash
8
- sudo apt-get update -qq
9
- sudo apt-get install libmagickwand-dev imagemagick
10
- bundle install
11
- ```
12
-
13
- And run the test suite (should be all green with pending tests):
14
-
15
- `bundle exec rspec`
16
-
17
- While preparing your pull requests, don't forget to check your code with Rubocop:
18
-
19
- `bundle exec rubocop`
20
-
21
- [Optional] Install all Ruby versions which Daru currently supports with `rake spec setup`.
22
-
23
-
24
- ## Basic Development Flow
25
-
26
- 1. Create a new branch with `git checkout -b <branch_name>`.
27
- 2. Make your changes. Write tests covering every case how your feature will be used. If creating new files for tests, refer to the 'Testing' section [below](#Testing).
28
- 3. Try out these changes with `rake pry`.
29
- 4. Run the test suite with `rake spec`. (Alternatively you can use `guard` as described [here](https://github.com/SciRuby/daru/blob/master/CONTRIBUTING.md#testing). Also run Rubocop coding style guidelines with `rake cop`.
30
- 5. Commit the changes with `git commit -am "briefly describe what you did"` and submit pull request.
31
-
32
- [Optional] You can run rspec for all Ruby versions at once with `rake spec run all`. But remember to first have all Ruby versions installed with `ruby spec setup`.
33
-
34
-
35
- ## Testing
36
-
37
- Daru has automatic testing with Guard. Just execute the following code before you start editting a file and any change you make will trigger the appropriate tests-
38
-
39
- ```
40
- guard
41
- ```
42
-
43
- **NOTE**: Please make sure that you place test for your file at the same level and with same itermediatary directories. For example if code file lies in `lib/xyz/abc.rb` then its corresponding test should lie in `spec/xyz/abc_spec.rb`. This is to ensure correct working of Guard.
44
-
45
- ## Daru internals
46
-
47
- To get an overview of certain internals of daru and their implementation, go over [this blog post](http://v0dro.github.io/blog/2015/08/16/elaboration-on-certain-internals-of-daru/).
data/Gemfile DELETED
@@ -1,2 +0,0 @@
1
- source 'https://rubygems.org'
2
- gemspec
data/Rakefile DELETED
@@ -1,69 +0,0 @@
1
- require 'rspec/core/rake_task'
2
- require 'bundler/gem_tasks'
3
-
4
- lib_folder = File.expand_path("../lib", __FILE__)
5
-
6
- RUBIES = ['ruby-2.0.0-p643', 'ruby-2.1.5', 'ruby-2.2.1', 'ruby-2.3.0']
7
-
8
- def spec_run_all
9
- RUBIES.each do |ruby_v|
10
- puts "\n Using #{ruby_v}\n\n"
11
- command = "$rvm_path/wrappers/#{ruby_v}/rake summary"
12
- run command
13
- end
14
- end
15
-
16
- task :spec do
17
- case ARGV[1]
18
- when 'setup'
19
- spec_setup
20
- when 'run'
21
- spec_run_all if ARGV[2] == 'all'
22
- when nil
23
- run 'rspec spec'
24
- end
25
- end
26
-
27
- # Stubs
28
- task :setup
29
- task :run
30
- task :all
31
-
32
- def spec_setup
33
- RUBIES.each do |ruby_v|
34
- puts "Installing #{ruby_v}..."
35
- run "rvm install #{ruby_v}"
36
- path = "$rvm_path/wrappers/#{ruby_v}"
37
- run "#{path}/gem install bundler"
38
- run "#{path}/bundle install"
39
- end
40
- end
41
-
42
- #task all: [:cop, :run_all]
43
-
44
- task :summary do
45
- run 'rspec spec/ -r ./.rspec_formatter.rb -f SimpleFormatter' rescue nil
46
- end
47
-
48
- #RSpec::Core::RakeTask.new(:spec)
49
-
50
- task :default => :spec
51
-
52
- task :console do |task|
53
- cmd = [ 'irb', "-r '#{lib_folder}/daru_lite.rb'" ]
54
- run *cmd
55
- end
56
-
57
- task :cop do |task|
58
- run 'rubocop' rescue nil
59
- end
60
-
61
- task :pry do |task|
62
- cmd = [ 'pry', "-r '#{lib_folder}/daru_lite.rb'" ]
63
- run *cmd
64
- end
65
-
66
- def run *cmd
67
- sh(cmd.join(" "))
68
- end
69
-
data/ReleasePolicy.md DELETED
@@ -1,20 +0,0 @@
1
- # Gem Release Policy
2
-
3
- Applicable to Daru > 0.1.6
4
-
5
- ## Versioning
6
-
7
- Daru follows semantic versioning whereby the version number is always in the form MAJOR.MINOR.PATCH
8
-
9
- * Patch bump = Bug fixes
10
- * Minor bump = New features but backwards compatible
11
- * Major bump = API breaking changes
12
-
13
- For Major and Minor bumps release candidates should be released around 2 weeks prior to the bump and are indicated by MAJOR.MINOR.0.rc.
14
-
15
- For more information see the full semantic versioning specification at http://semver.org/.
16
-
17
- ## Release Timing
18
-
19
- Patch releases should be done after every fix of a major bug (as tagged in the github issue tracker).
20
- Major releases should be kept to the minimum.
@@ -1,65 +0,0 @@
1
- "Group","Treatment","Replicate","RelativeFitness"
2
- "BKB","Tube",1,0.869962555792838
3
- "BKB","Tube",2,1.00036299125423
4
- "BKB","Tube",3,0.982935090384188
5
- "BAC","Tube",1,0.810391635206191
6
- "BAC","Tube",2,0.795106571577928
7
- "JDK","Tube",1,0.849203581734814
8
- "JDK","Tube",2,0.917636977577209
9
- "JDK","Tube",3,0.905323024195181
10
- "ETH","Tube",1,0.930820887284085
11
- "ETH","Tube",2,0.958183317853959
12
- "ETH","Tube",3,0.91428823286218
13
- "SWI","Tube",1,0.918513532826773
14
- "SWI","Tube",2,0.909023164202865
15
- "SWI","Tube",3,0.928404818223812
16
- "PPP","Tube",1,0.990500457882474
17
- "PPP","Tube",2,0.97156464183624
18
- "PPP","Tube",3,0.948766905642272
19
- "ECO","Tube",1,0.996870763277447
20
- "ECO","Tube",2,0.976750424056972
21
- "ECO","Tube",3,0.939479247244218
22
- "DOS","Tube",1,0.9461642789306
23
- "DOS","Tube",2,0.951056617451754
24
- "DOS","Tube",3,0.939563175900147
25
- "FIT","Tube",1,0.942215594296048
26
- "FIT","Tube",2,0.926698027408171
27
- "FIT","Tube",3,1.00031750759377
28
- "HHE","Tube",1,0.944414164259624
29
- "HHE","Tube",2,0.95194592074032
30
- "HHE","Tube",3,0.922485751593779
31
- "H2W","Tube",1,0.915304498822462
32
- "H2W","Tube",2,0.853906227834699
33
- "H2W","Tube",3,0.938698147417512
34
- "BKB","Dish",1,1.15254427639376
35
- "BKB","Dish",2,1.28708514998039
36
- "BKB","Dish",3,1.50741545998468
37
- "BAC","Dish",2,1.65223419104399
38
- "BAC","Dish",3,1.61502230247434
39
- "JDK","Dish",1,1.5102682623396
40
- "JDK","Dish",2,1.58270078151532
41
- "JDK","Dish",3,1.54715152852448
42
- "ETH","Dish",1,1.61281555981988
43
- "ETH","Dish",2,1.36445572541848
44
- "ETH","Dish",3,1.47155233724852
45
- "SWI","Dish",1,1.36255560722945
46
- "SWI","Dish",2,1.51569228710501
47
- "SWI","Dish",3,1.47714121664773
48
- "PPP","Dish",1,1.50896917413568
49
- "PPP","Dish",2,1.58138592886817
50
- "PPP","Dish",3,1.55356839081014
51
- "ECO","Dish",1,1.69927564777656
52
- "ECO","Dish",2,1.45605668065038
53
- "ECO","Dish",3,1.52825762511041
54
- "DOS","Dish",1,1.59453120031454
55
- "DOS","Dish",2,1.58132511409296
56
- "DOS","Dish",3,1.58558683941181
57
- "FIT","Dish",1,1.01468578343171
58
- "FIT","Dish",2,0.955220815085047
59
- "FIT","Dish",3,1.03597298511451
60
- "HHE","Dish",1,1.49399422139513
61
- "HHE","Dish",2,1.32980278545457
62
- "HHE","Dish",3,1.4505220676174
63
- "H2W","Dish",1,1.52460143511286
64
- "H2W","Dish",2,1.53958247554139
65
- "H2W","Dish",3,1.51149897493835
@@ -1,22 +0,0 @@
1
- # Date - 28 june 2016. daru version - 0.1.3.1
2
- # Compare speed of Ruby stdlib CSV and DataFrame.from_csv.
3
-
4
- require 'benchmark'
5
- require 'csv'
6
- require 'daru_lite'
7
-
8
- Benchmark.bm do |x|
9
- x.report("Ruby CSV") do
10
- CSV.read("TradeoffData.csv")
11
- end
12
-
13
- x.report("DataFrame.from_csv") do
14
- DaruLite::DataFrame.from_csv("TradeoffData.csv")
15
- end
16
- end
17
-
18
- # FIXME: Improve this. It's 4 times slower than Ruby CSV reading!!
19
-
20
- # user system total real
21
- # Ruby CSV 0.010000 0.000000 0.010000 ( 0.002385)
22
- # DataFrame.from_csv 0.000000 0.000000 0.000000 ( 0.008225)
@@ -1,39 +0,0 @@
1
- $:.unshift File.expand_path("../../lib", __FILE__)
2
-
3
- require 'benchmark'
4
- require 'daru_lite'
5
-
6
- Benchmark.bm do |x|
7
- x.report("Create with Arrays and clone") do
8
- df = DaruLite::DataFrame.new({
9
- a: 100000.times.map { rand },
10
- b: 100000.times.map { rand },
11
- c: 100000.times.map { rand }
12
- })
13
- end
14
-
15
- x.report("Create with Vectors and clone") do
16
- df = DaruLite::DataFrame.new({
17
- a: DaruLite::Vector.new(100000.times.map { rand }),
18
- b: DaruLite::Vector.new(100000.times.map { rand }),
19
- c: DaruLite::Vector.new(100000.times.map { rand })
20
- })
21
- end
22
-
23
- x.report("Create with Vector and dont clone") do
24
- df = DaruLite::DataFrame.new({
25
- a: DaruLite::Vector.new(100000.times.map { rand }),
26
- b: DaruLite::Vector.new(100000.times.map { rand }),
27
- c: DaruLite::Vector.new(100000.times.map { rand })
28
- }, clone: false)
29
- end
30
-
31
- x.report("Create by row from Arrays") do
32
- end
33
- end
34
-
35
- # ===== Benchmarks =====
36
- # user system total real
37
- # Create with Arrays and clone 0.940000 0.010000 0.950000 ( 0.959851)
38
- # Create with Vectors and clone 1.950000 0.020000 1.970000 ( 1.966835)
39
- # Create with Vector and dont clone 1.170000 0.000000 1.170000 ( 1.177132)
@@ -1,33 +0,0 @@
1
- $:.unshift File.expand_path("../../lib", __FILE__)
2
-
3
- require 'benchmark'
4
- require 'daru_lite'
5
- require 'sqlite3'
6
- require 'active_record'
7
-
8
- db_name = 'daru_lite_test.sqlite'
9
- FileUtils.rm(db_name) if File.file?(db_name)
10
-
11
- SQLite3::Database.new(db_name).tap do |db|
12
- db.execute "create table accounts(id integer, name varchar, age integer, primary key(id))"
13
-
14
- values = 1.upto(100_000).map { |i| %!(#{i},"name_#{i}",#{rand(100)})! }.join(",")
15
- db.execute "insert into accounts values #{values}"
16
- end
17
-
18
- ActiveRecord::Base.establish_connection("sqlite3:#{db_name}")
19
- ActiveRecord::Base.connection
20
-
21
- class Account < ActiveRecord::Base; end
22
-
23
- Benchmark.bm do |x|
24
- x.report("DataFrame.from_sql") do
25
- DaruLite::DataFrame.from_sql(ActiveRecord::Base.connection, "SELECT * FROM accounts")
26
- end
27
-
28
- x.report("DataFrame.from_activerecord") do
29
- DaruLite::DataFrame.from_activerecord(Account.all)
30
- end
31
- end
32
-
33
- FileUtils.rm(db_name)
@@ -1,45 +0,0 @@
1
- $:.unshift File.expand_path("../../lib", __FILE__)
2
-
3
- require 'benchmark'
4
- require 'daru_lite'
5
-
6
- # Check scaling
7
- base_n = 10000
8
- 0.upto(2) do |iscale|
9
- n = base_n * 2**iscale
10
-
11
- df_h = ('a'..'z').map { |v| v.to_sym }.reduce({}) do |h, v|
12
- h[v] = DaruLite::Vector.new(1.upto(n).to_a)
13
- h
14
- end
15
-
16
- df = DaruLite::DataFrame.new(df_h)
17
-
18
- Benchmark.bm do |bm|
19
- bm.report("dupe (n=#{n})") do
20
- df.dup
21
- end
22
- end
23
- end
24
-
25
- # ===== Benchmarks =====
26
- # System: iMac Late 2013 3.5GHz Core i7
27
- #
28
- # user system total real
29
- #dupe (n=10000) 0.590000 0.020000 0.610000 ( 0.613648)
30
- # user system total real
31
- #dupe (n=20000) 1.170000 0.040000 1.210000 ( 1.236629)
32
- # user system total real
33
- #dupe (n=40000) 2.390000 0.070000 2.460000 ( 2.511199)
34
-
35
-
36
-
37
-
38
- # ===== Prior Benchmarks (Daru 0.1.2 - 2707559369c03894a8394714820aabf116b99b20 - 2016-04-25) =====
39
- # Note that the n here is 100x smaller than above
40
- # user system total real
41
- #dupe (n=100) 0.220000 0.000000 0.220000 ( 0.227924)
42
- # user system total real
43
- #dupe (n=200) 0.850000 0.000000 0.850000 ( 0.856591)
44
- # user system total real
45
- #dupe (n=400) 3.370000 0.020000 3.390000 ( 3.428211)
@@ -1,32 +0,0 @@
1
- $:.unshift File.expand_path("../../lib", __FILE__)
2
-
3
- require 'benchmark'
4
- require 'daru_lite'
5
-
6
- data = DaruLite::DataFrame.from_csv 'TradeoffData.csv'
7
-
8
- Benchmark.bm do |x|
9
- x.report("Single column grouping") do
10
- @single = data.group_by(['Treatment'])
11
- end
12
-
13
- x.report("Multi-column grouping") do
14
- @multi = data.group_by(['Group', 'Treatment'])
15
- end
16
-
17
- x.report("Single mean") do
18
- @single.mean
19
- end
20
-
21
- x.report("Multi mean") do
22
- @multi.mean
23
- end
24
- end
25
-
26
- # ===== Benchmarks =====
27
- #
28
- # user system total real
29
- # Single column grouping 0.000000 0.000000 0.000000 (0.000340)
30
- # Multi-column grouping 0.000000 0.000000 0.000000 (0.000855)
31
- # Single mean 0.000000 0.000000 0.000000 (0.001208)
32
- # Multi mean 0.000000 0.000000 0.000000 (0.004892)
@@ -1,52 +0,0 @@
1
- $:.unshift File.expand_path("../../lib", __FILE__)
2
-
3
- require 'benchmark'
4
- require 'daru_lite'
5
-
6
- # Check scaling
7
- base_n = 10000
8
- 0.upto(2) do |iscale|
9
- n = base_n * 2**iscale
10
- keys = (1..(n)).to_a
11
- base_data = { idx: 1.upto(n).to_a, keys: 1.upto(n).map { |v| keys[Random.rand(n)]}}
12
- lookup_hash = keys.map { |k| [k, k * 100]}.to_h
13
-
14
- base_data_df = DaruLite::DataFrame.new(base_data)
15
- lookup_df = DaruLite::DataFrame.new({ keys: lookup_hash.keys, values: lookup_hash.values })
16
-
17
- Benchmark.bm do |bm|
18
- bm.report("Inner join (n=#{n})") do
19
- base_data_df.join(lookup_df, on: [:keys], how: :inner)
20
- end
21
-
22
- bm.report("Outer join (n=#{n})") do
23
- base_data_df.join(lookup_df, on: [:keys], how: :outer)
24
- end
25
- end
26
- end
27
-
28
- # ===== Benchmarks =====
29
- # System: MacBook Pro Mid 2014 3GHz Core i7
30
- #
31
- # user system total real
32
- #Inner join (n=10000) 0.170000 0.000000 0.170000 ( 0.182254)
33
- #Outer join (n=10000) 0.200000 0.000000 0.200000 ( 0.203022)
34
- # user system total real
35
- #Inner join (n=20000) 0.380000 0.000000 0.380000 ( 0.387600)
36
- #Outer join (n=20000) 0.410000 0.000000 0.410000 ( 0.415644)
37
- # user system total real
38
- #Inner join (n=40000) 0.720000 0.010000 0.730000 ( 0.743787)
39
- #Outer join (n=40000) 0.810000 0.010000 0.820000 ( 0.840871)
40
-
41
-
42
- # ===== Prior Benchmarks (Daru 0.1.2 - prior to sorted merge algorithm) =====
43
- # Note that the n here is 10x smaller than above
44
- # user system total real
45
- #Inner join (n=1000) 0.170000 0.010000 0.180000 ( 0.175585)
46
- #Outer join (n=1000) 0.990000 0.000000 0.990000 ( 1.004305)
47
- # user system total real
48
- #Inner join (n=2000) 0.440000 0.010000 0.450000 ( 0.446748)
49
- #Outer join (n=2000) 3.880000 0.010000 3.890000 ( 3.926399)
50
- # user system total real
51
- #Inner join (n=4000) 1.670000 0.010000 1.680000 ( 1.680742)
52
- #Outer join (n=4000) 15.640000 0.060000 15.700000 ( 15.855202)
@@ -1,41 +0,0 @@
1
- $:.unshift File.expand_path("../../lib", __FILE__)
2
-
3
- require 'benchmark'
4
- require 'daru_lite'
5
-
6
- df = DaruLite::DataFrame.new({
7
- a: 100000.times.map { rand },
8
- b: 100000.times.map { rand },
9
- c: 100000.times.map { rand }
10
- })
11
-
12
- Benchmark.bm do |x|
13
- x.report("Access single row") do
14
- df.row[50]
15
- end
16
-
17
- x.report("Access rows by comma") do
18
- df.row[*(5..40000).to_a.shuffle]
19
- end
20
-
21
- x.report("Individual rows") do
22
- rows = []
23
- index = (5..40000).to_a.shuffle
24
- index.each do |a|
25
- rows << df.row[a].to_a
26
- end
27
-
28
- DaruLite::DataFrame.rows(rows, order: [:a,:b,:c], index: index)
29
- end
30
-
31
- x.report("Access rows by range") do
32
- df.row[5..40000]
33
- end
34
- end
35
-
36
- # ==== Benchmarks ====
37
- # user system total real
38
- # Access single row 0.000000 0.000000 0.000000 ( 0.000059)
39
- # Access rows by comma 1.410000 0.010000 1.420000 ( 1.420426)
40
- # Individual rows 1.480000 0.000000 1.480000 ( 1.488531)
41
- # Access rows by range 1.440000 0.010000 1.450000 ( 1.436750)
@@ -1,36 +0,0 @@
1
- $:.unshift File.expand_path("../../lib", __FILE__)
2
-
3
- require 'benchmark'
4
- require 'daru_lite'
5
-
6
- df = DaruLite::DataFrame.new({
7
- a: 100000.times.map { rand },
8
- b: 100000.times.map { rand },
9
- c: 100000.times.map { rand }
10
- })
11
-
12
- Benchmark.bm do |x|
13
- x.report("Set a single row with Array") do
14
- df.row[5] = [55,22,65]
15
- end
16
-
17
- x.report("Set a single row with DaruLite::Vector") do
18
- df.row[3456] = DaruLite::Vector.new([3,54,11], index: [:b,:e,:a])
19
- end
20
-
21
- x.report("Create a new row with Array") do
22
- df.row[100001] = [34,66,11]
23
- end
24
-
25
- x.report("Create a new row with DaruLite::Vector") do
26
- df.row[100005] = DaruLite::Vector.new([34,66,11], index: [:a,:b,:t])
27
- end
28
- end
29
-
30
- # ==== Benchmarks ====
31
- #
32
- # user system total real
33
- # Set a single row with Array 0.600000 0.000000 0.600000 ( 0.604718)
34
- # Set a single row with DaruLite::Vector 0.600000 0.000000 0.600000 ( 0.598599)
35
- # Create a new row with Array 0.840000 0.010000 0.850000 ( 0.858349)
36
- # Create a new row with DaruLite::Vector 0.950000 0.000000 0.950000 ( 0.950725)