feldtruby 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +49 -0
- data/Gemfile +4 -0
- data/Rakefile +21 -14
- data/feldtruby.gemspec +22 -0
- data/lib/feldtruby/array.rb +7 -0
- data/lib/feldtruby/minitest_extensions.rb +16 -0
- data/lib/feldtruby/statistics.rb +109 -0
- data/lib/feldtruby/version.rb +3 -0
- data/test/test_array.rb +18 -0
- data/test/test_statistics.rb +86 -0
- metadata +29 -37
- data/.autotest +0 -23
- data/.gemtest +0 -0
- data/Manifest.txt +0 -44
- data/README.txt +0 -59
data/.gitignore
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# rcov or simplecov generated
|
2
|
+
coverage
|
3
|
+
coverage.data
|
4
|
+
|
5
|
+
# rdoc generated
|
6
|
+
rdoc
|
7
|
+
|
8
|
+
# yard generated
|
9
|
+
doc
|
10
|
+
.yardoc
|
11
|
+
|
12
|
+
# bundler
|
13
|
+
.bundle
|
14
|
+
|
15
|
+
# jeweler generated
|
16
|
+
pkg
|
17
|
+
|
18
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
19
|
+
#
|
20
|
+
# * Create a file at ~/.gitignore
|
21
|
+
# * Include files you want ignored
|
22
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
23
|
+
#
|
24
|
+
# After doing this, these files will be ignored in all your git projects,
|
25
|
+
# saving you from having to 'pollute' every project you touch with them
|
26
|
+
#
|
27
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
28
|
+
#
|
29
|
+
# For MacOS:
|
30
|
+
#
|
31
|
+
.DS_Store
|
32
|
+
|
33
|
+
# For TextMate
|
34
|
+
#*.tmproj
|
35
|
+
#tmtags
|
36
|
+
|
37
|
+
# For emacs:
|
38
|
+
#*~
|
39
|
+
#\#*
|
40
|
+
#.\#*
|
41
|
+
|
42
|
+
# For vim:
|
43
|
+
#*.swp
|
44
|
+
|
45
|
+
# For redcar:
|
46
|
+
#.redcar
|
47
|
+
|
48
|
+
# For rubinius:
|
49
|
+
#*.rbc
|
data/Gemfile
ADDED
data/Rakefile
CHANGED
@@ -1,19 +1,26 @@
|
|
1
|
-
|
1
|
+
require "bundler/gem_tasks"
|
2
2
|
|
3
|
-
require '
|
4
|
-
require 'hoe'
|
3
|
+
require 'fileutils'
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
# Hoe.plugin :rcov
|
11
|
-
# Hoe.plugin :rubyforge
|
5
|
+
def psys(str)
|
6
|
+
puts str
|
7
|
+
system str
|
8
|
+
end
|
12
9
|
|
13
|
-
|
10
|
+
desc "Run all tests"
|
11
|
+
task :test do
|
12
|
+
helper_files = Dir["test/**/*helper*.rb"]
|
13
|
+
test_files = Dir["test/**/test*.rb"]
|
14
|
+
require_files = (helper_files + test_files).map {|f| "require \"#{f}\""}.join('; ')
|
15
|
+
psys "ruby -Ilib:. -e '#{require_files}' --"
|
16
|
+
end
|
14
17
|
|
15
|
-
|
16
|
-
|
18
|
+
desc "Clean up intermediate/build files"
|
19
|
+
task :clean do
|
20
|
+
FileUtils.rm_rf "pkg"
|
21
|
+
end
|
17
22
|
|
18
|
-
|
19
|
-
|
23
|
+
desc "Clean the repo of any files that should not be checked in"
|
24
|
+
task :clobber => [:clean]
|
25
|
+
|
26
|
+
task :default => :test
|
data/feldtruby.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'feldtruby/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "feldtruby"
|
8
|
+
gem.version = FeldtRuby::VERSION
|
9
|
+
gem.authors = ["Robert Feldt"]
|
10
|
+
gem.email = ["robert.feldt@gmail.com"]
|
11
|
+
gem.description = %q{Robert Feldt's Common Ruby Code lib}
|
12
|
+
gem.summary = %q{Robert Feldt's Common Ruby Code lib}
|
13
|
+
gem.homepage = "https://github.com/robertfeldt/feldtruby"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_dependency('rinruby')
|
21
|
+
gem.add_dependency('json')
|
22
|
+
end
|
data/lib/feldtruby/array.rb
CHANGED
@@ -37,4 +37,11 @@ class Array
|
|
37
37
|
self << element unless self.include?(element)
|
38
38
|
self
|
39
39
|
end
|
40
|
+
|
41
|
+
# Count elements in array and return as hash mapping elements to their counts.
|
42
|
+
def counts
|
43
|
+
count_hash = Hash.new(0)
|
44
|
+
self.each {|element| count_hash[element] += 1}
|
45
|
+
count_hash
|
46
|
+
end
|
40
47
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'minitest/unit'
|
2
|
+
require 'minitest/spec'
|
3
|
+
require 'feldtruby/statistics'
|
4
|
+
|
5
|
+
module MiniTest::Assertions
|
6
|
+
# Ensure that that are (statistically) the same number of each type
|
7
|
+
# of value in an array.
|
8
|
+
def assert_similar_proportions(values, msg = nil)
|
9
|
+
pvalue = FeldtRuby.probability_of_same_proportions(values)
|
10
|
+
assert(pvalue >= 0.95, msg || "Proportions differ! p-value that they are the same is #{pvalue} (<0.95)")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
module MiniTest::Expectations
|
15
|
+
infect_an_assertion :assert_similar_proportions, :must_have_similar_proportions
|
16
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
require 'rinruby'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
require 'feldtruby/array'
|
5
|
+
require 'feldtruby/array/basic_stats'
|
6
|
+
|
7
|
+
module FeldtRuby
|
8
|
+
|
9
|
+
# RCommunicator uses RinRuby to communicate with an instance of R.
|
10
|
+
# We extend the basic RinRuby by using json to tunnel back and forth.
|
11
|
+
class RCommunicator
|
12
|
+
def initialize
|
13
|
+
# Will stay open until closed or the ruby interpreter exits.
|
14
|
+
# echo = false and interactive = false
|
15
|
+
@r = RinRuby.new(false, false)
|
16
|
+
setup_r()
|
17
|
+
end
|
18
|
+
|
19
|
+
# Include necessary libraries.
|
20
|
+
def setup_r
|
21
|
+
include_library("rjson")
|
22
|
+
end
|
23
|
+
|
24
|
+
# Include a library after ensuring it has been installed
|
25
|
+
def include_library(lib)
|
26
|
+
@r.eval "if(!library(#{lib}, logical.return=TRUE)) {install.packages(\"#{lib}\"); library(#{lib});}"
|
27
|
+
end
|
28
|
+
|
29
|
+
def eval(str)
|
30
|
+
@r.eval str
|
31
|
+
end
|
32
|
+
|
33
|
+
# This represents a hash returned as JSON from R but mapped to a
|
34
|
+
# Ruby object so we can more easily use it as if it was an R object.
|
35
|
+
class Rvalue
|
36
|
+
def initialize(hash)
|
37
|
+
@___h = hash
|
38
|
+
hash.to_a.each do |name, value|
|
39
|
+
ruby_name = ___ruby_name(name)
|
40
|
+
@___h[ruby_name] = @___h[name] if ruby_name != name
|
41
|
+
self.define_singleton_method(ruby_name) {@___h[name]}
|
42
|
+
end
|
43
|
+
end
|
44
|
+
def ___ruby_name(name)
|
45
|
+
name.gsub(".", "_")
|
46
|
+
end
|
47
|
+
def to_h; @___h; end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Call an R method named rmethod with (Ruby) arguments. Returns
|
51
|
+
# an Integer, Float or an Rvalue (if the returned R value is complex).
|
52
|
+
def call(rmethod, *arguments)
|
53
|
+
str, args = "", []
|
54
|
+
arguments.each_with_index do |arg, index|
|
55
|
+
args << (argname = arg_name(index))
|
56
|
+
str += "#{argname} <- fromJSON(\"#{arg.to_json}\");\n"
|
57
|
+
end
|
58
|
+
resname = res_name(1)
|
59
|
+
str += "#{resname} <- toJSON(#{rmethod.to_s}(#{args.join(', ')}));\n"
|
60
|
+
@r.eval str
|
61
|
+
pull_json_variable(resname)
|
62
|
+
end
|
63
|
+
|
64
|
+
# Get the JSON value from a variable in R and parse it back to a Ruby value.
|
65
|
+
def pull_json_variable(variableName)
|
66
|
+
res = @r.pull(variableName)
|
67
|
+
begin
|
68
|
+
Rvalue.new JSON.parse(res)
|
69
|
+
rescue JSON::ParserError
|
70
|
+
# First try to convert to Integer, then Float if it fails.
|
71
|
+
begin
|
72
|
+
Kernel::Integer(res)
|
73
|
+
rescue ArgumentError
|
74
|
+
Kernel::Float(res)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
private
|
80
|
+
|
81
|
+
def res_name(index = 1)
|
82
|
+
arg_name(index, "res")
|
83
|
+
end
|
84
|
+
|
85
|
+
def arg_name(index, prefix = "arg")
|
86
|
+
"#{prefix}_#{index}_#{self.object_id}"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
module Statistics
|
91
|
+
# Calc the probability that the unique values in array (or
|
92
|
+
# hash of counts of the values) have (statistically) equal proportions.
|
93
|
+
def probability_of_same_proportions(aryOrHashOfCounts)
|
94
|
+
counts = (Hash === aryOrHashOfCounts) ? aryOrHashOfCounts : aryOrHashOfCounts.counts
|
95
|
+
vs = counts.values
|
96
|
+
res = RC.call("prop.test", vs, ([vs.sum] * vs.length))
|
97
|
+
res.p_value
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
# Make them available at top level
|
102
|
+
extend Statistics
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
# Create one instance that people can use without having to instantiate.
|
107
|
+
unless defined?(Kernel::RC)
|
108
|
+
Kernel::RC = FeldtRuby::RCommunicator.new
|
109
|
+
end
|
data/test/test_array.rb
CHANGED
@@ -82,4 +82,22 @@ describe "Array extensions" do
|
|
82
82
|
[1,2,3].add_unless_there(3).must_equal [1,2,3]
|
83
83
|
end
|
84
84
|
end
|
85
|
+
|
86
|
+
describe "count_elements" do
|
87
|
+
it "counts elements when only two of them" do
|
88
|
+
counts = [2,1,2,2,1,1,2,1,2].counts
|
89
|
+
counts.keys.sort.must_equal [1,2]
|
90
|
+
counts[1].must_equal 4
|
91
|
+
counts[2].must_equal 5
|
92
|
+
end
|
93
|
+
|
94
|
+
it "counts elements when many different elements and of different types" do
|
95
|
+
counts = [:a, :b, :b, "c", "d", 5, "c", 5, "c", "d", 5, "d", 5, 5, "d"].counts
|
96
|
+
counts[:a].must_equal 1
|
97
|
+
counts[:b].must_equal 2
|
98
|
+
counts["c"].must_equal 3
|
99
|
+
counts["d"].must_equal 4
|
100
|
+
counts[5].must_equal 5
|
101
|
+
end
|
102
|
+
end
|
85
103
|
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'feldtruby/statistics'
|
2
|
+
|
3
|
+
describe "RCommunicator" do
|
4
|
+
describe "RValue" do
|
5
|
+
it "can be used to access individual elements by their key/name" do
|
6
|
+
rv = FeldtRuby::RCommunicator::Rvalue.new({"a" => 1, "b" => "2"})
|
7
|
+
rv.a.must_equal 1
|
8
|
+
rv.b.must_equal "2"
|
9
|
+
end
|
10
|
+
|
11
|
+
it "maps non-ruby method names so they can be used as method names" do
|
12
|
+
rv = FeldtRuby::RCommunicator::Rvalue.new({"p.value" => 0.06})
|
13
|
+
rv.p_value.must_equal 0.06
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "calling simple R functions that returns integers" do
|
18
|
+
it "can call sum, min, max etc" do
|
19
|
+
RC.call("sum", [1,2,3]).must_equal 6
|
20
|
+
RC.call("min", [1,2,3]).must_equal 1
|
21
|
+
RC.call("max", [1,2,3]).must_equal 3
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "calling simple R functions that returns floats" do
|
26
|
+
it "can call sum, min, max etc" do
|
27
|
+
RC.call("sum", [1.2, 3.4]).must_equal 4.6
|
28
|
+
RC.call("min", [1.2, 3.4]).must_equal 1.2
|
29
|
+
RC.call("max", [1.2, 3.4]).must_equal 3.4
|
30
|
+
end
|
31
|
+
|
32
|
+
it "can call also with a symbol for the method name" do
|
33
|
+
RC.call(:mean, [1,2,3]).must_equal 2.0
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "calling R functions that return complex objects" do
|
38
|
+
it "can call prop.test" do
|
39
|
+
res = RC.call("prop.test", [60, 40], [100, 100])
|
40
|
+
res.p_value.must_be_close_to 0.0072
|
41
|
+
cilow, cihigh = res.conf_int
|
42
|
+
cilow.must_be_close_to 0.0542
|
43
|
+
cihigh.must_be_close_to 0.3458
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "Statistics" do
|
49
|
+
include FeldtRuby::Statistics
|
50
|
+
describe "Proportion testing for the count of values" do
|
51
|
+
it "works when counts are explicitly given" do
|
52
|
+
# A proportion test checks if the number/proportion of occurences of objects
|
53
|
+
# differ. It returns the probability that the proportions are the same
|
54
|
+
# given the actual counts.
|
55
|
+
probability_of_same_proportions({:a => 50, :b => 50}).must_be_close_to 1.0000
|
56
|
+
probability_of_same_proportions({:a => 51, :b => 49}).must_be_close_to 0.8875
|
57
|
+
probability_of_same_proportions({:a => 52, :b => 48}).must_be_close_to 0.6714
|
58
|
+
probability_of_same_proportions({:a => 53, :b => 47}).must_be_close_to 0.4795
|
59
|
+
probability_of_same_proportions({:a => 54, :b => 46}).must_be_close_to 0.3222
|
60
|
+
probability_of_same_proportions({:a => 55, :b => 45}).must_be_close_to 0.2031
|
61
|
+
probability_of_same_proportions({:a => 56, :b => 44}).must_be_close_to 0.1198
|
62
|
+
probability_of_same_proportions({:a => 57, :b => 43}).must_be_close_to 0.0659
|
63
|
+
probability_of_same_proportions({:a => 58, :b => 42}).must_be_close_to 0.0339
|
64
|
+
probability_of_same_proportions({:a => 59, :b => 41}).must_be_close_to 0.0162
|
65
|
+
probability_of_same_proportions({:a => 60, :b => 40}).must_be_close_to 0.0072
|
66
|
+
end
|
67
|
+
|
68
|
+
it "works when an array of the actual elements are given" do
|
69
|
+
probability_of_same_proportions(([:a] * 570) + ([:b] * 430)).must_be_close_to 5.091e-10
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
require 'feldtruby/minitest_extensions'
|
75
|
+
|
76
|
+
describe "Test Statistics but with the extensions to MiniTest framework" do
|
77
|
+
it "can use assert_same_proportions" do
|
78
|
+
assert_similar_proportions [1,1,1,1,1, 2,2,2,2,2]
|
79
|
+
# This should fail but I found now way to test it since it uses the MiniTest framework itself...
|
80
|
+
# assert_similar_proportions( [1]*60 + [2]*40 )
|
81
|
+
end
|
82
|
+
|
83
|
+
it "can use must_have_similar_proportions" do
|
84
|
+
[1,1,1,1,1, 2,2,2,2,2].must_have_similar_proportions
|
85
|
+
end
|
86
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feldtruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,64 +9,54 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: rinruby
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
22
|
-
type: :
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '0'
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
31
|
+
name: json
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
none: false
|
34
34
|
requirements:
|
35
|
-
- -
|
35
|
+
- - ! '>='
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: '
|
38
|
-
type: :
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
|
-
- -
|
43
|
+
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: '
|
46
|
-
description:
|
47
|
-
many generally useful Ruby tidbits I have laying around and clean them up into here.
|
48
|
-
Don''t want to rewrite these things again and again... So far this collects a number
|
49
|
-
of generally useful additions to the standard Ruby classes/libs and then includes
|
50
|
-
a simple optimization framework (FeldtRuby::Optimize).
|
51
|
-
|
52
|
-
|
53
|
-
email: robert.feldt ((a)) gmail.com'
|
45
|
+
version: '0'
|
46
|
+
description: Robert Feldt's Common Ruby Code lib
|
54
47
|
email:
|
55
48
|
- robert.feldt@gmail.com
|
56
49
|
executables: []
|
57
50
|
extensions: []
|
58
|
-
extra_rdoc_files:
|
59
|
-
- History.txt
|
60
|
-
- Manifest.txt
|
61
|
-
- README.txt
|
51
|
+
extra_rdoc_files: []
|
62
52
|
files:
|
63
|
-
- .
|
53
|
+
- .gitignore
|
54
|
+
- Gemfile
|
64
55
|
- History.txt
|
65
|
-
- Manifest.txt
|
66
|
-
- README.txt
|
67
56
|
- README.md
|
68
57
|
- Rakefile
|
69
58
|
- TODO
|
59
|
+
- feldtruby.gemspec
|
70
60
|
- lib/feldtruby.rb
|
71
61
|
- lib/feldtruby/array.rb
|
72
62
|
- lib/feldtruby/array/basic_stats.rb
|
@@ -75,6 +65,7 @@ files:
|
|
75
65
|
- lib/feldtruby/file/tempfile.rb
|
76
66
|
- lib/feldtruby/float.rb
|
77
67
|
- lib/feldtruby/math/rand.rb
|
68
|
+
- lib/feldtruby/minitest_extensions.rb
|
78
69
|
- lib/feldtruby/net/html_doc_getter.rb
|
79
70
|
- lib/feldtruby/optimize.rb
|
80
71
|
- lib/feldtruby/optimize/differential_evolution.rb
|
@@ -84,9 +75,11 @@ files:
|
|
84
75
|
- lib/feldtruby/optimize/random_search.rb
|
85
76
|
- lib/feldtruby/optimize/search_space.rb
|
86
77
|
- lib/feldtruby/optimize/stdout_logger.rb
|
78
|
+
- lib/feldtruby/statistics.rb
|
87
79
|
- lib/feldtruby/string/to_iso.rb
|
88
80
|
- lib/feldtruby/time.rb
|
89
81
|
- lib/feldtruby/vector.rb
|
82
|
+
- lib/feldtruby/version.rb
|
90
83
|
- lib/feldtruby/visualization/circos.rb
|
91
84
|
- lib/feldtruby/word_counter.rb
|
92
85
|
- test/helper.rb
|
@@ -94,24 +87,21 @@ files:
|
|
94
87
|
- test/test_array_basic_stats.rb
|
95
88
|
- test/test_array_count_by.rb
|
96
89
|
- test/test_float.rb
|
90
|
+
- test/test_html_doc_getter.rb
|
97
91
|
- test/test_optimize.rb
|
98
92
|
- test/test_optimize_differential_evolution.rb
|
99
93
|
- test/test_optimize_objective.rb
|
100
94
|
- test/test_optimize_populationbasedoptimizer.rb
|
101
95
|
- test/test_optimize_random_search.rb
|
102
96
|
- test/test_optimize_search_space.rb
|
97
|
+
- test/test_statistics.rb
|
103
98
|
- test/test_time.rb
|
104
99
|
- test/test_vector.rb
|
105
|
-
- test/test_html_doc_getter.rb
|
106
100
|
- test/test_word_counter.rb
|
107
|
-
- .gemtest
|
108
101
|
homepage: https://github.com/robertfeldt/feldtruby
|
109
|
-
licenses:
|
110
|
-
- MIT
|
102
|
+
licenses: []
|
111
103
|
post_install_message:
|
112
|
-
rdoc_options:
|
113
|
-
- --main
|
114
|
-
- README.txt
|
104
|
+
rdoc_options: []
|
115
105
|
require_paths:
|
116
106
|
- lib
|
117
107
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -127,12 +117,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
117
|
- !ruby/object:Gem::Version
|
128
118
|
version: '0'
|
129
119
|
requirements: []
|
130
|
-
rubyforge_project:
|
120
|
+
rubyforge_project:
|
131
121
|
rubygems_version: 1.8.24
|
132
122
|
signing_key:
|
133
123
|
specification_version: 3
|
134
124
|
summary: Robert Feldt's Common Ruby Code lib
|
135
125
|
test_files:
|
126
|
+
- test/helper.rb
|
136
127
|
- test/test_array.rb
|
137
128
|
- test/test_array_basic_stats.rb
|
138
129
|
- test/test_array_count_by.rb
|
@@ -144,6 +135,7 @@ test_files:
|
|
144
135
|
- test/test_optimize_populationbasedoptimizer.rb
|
145
136
|
- test/test_optimize_random_search.rb
|
146
137
|
- test/test_optimize_search_space.rb
|
138
|
+
- test/test_statistics.rb
|
147
139
|
- test/test_time.rb
|
148
140
|
- test/test_vector.rb
|
149
141
|
- test/test_word_counter.rb
|
data/.autotest
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# -*- ruby -*-
|
2
|
-
|
3
|
-
require 'autotest/restart'
|
4
|
-
|
5
|
-
# Autotest.add_hook :initialize do |at|
|
6
|
-
# at.extra_files << "../some/external/dependency.rb"
|
7
|
-
#
|
8
|
-
# at.libs << ":../some/external"
|
9
|
-
#
|
10
|
-
# at.add_exception 'vendor'
|
11
|
-
#
|
12
|
-
# at.add_mapping(/dependency.rb/) do |f, _|
|
13
|
-
# at.files_matching(/test_.*rb$/)
|
14
|
-
# end
|
15
|
-
#
|
16
|
-
# %w(TestA TestB).each do |klass|
|
17
|
-
# at.extra_class_map[klass] = "test/test_misc.rb"
|
18
|
-
# end
|
19
|
-
# end
|
20
|
-
|
21
|
-
# Autotest.add_hook :run_command do |at|
|
22
|
-
# system "rake build"
|
23
|
-
# end
|
data/.gemtest
DELETED
File without changes
|
data/Manifest.txt
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
.autotest
|
2
|
-
History.txt
|
3
|
-
Manifest.txt
|
4
|
-
README.txt
|
5
|
-
README.md
|
6
|
-
Rakefile
|
7
|
-
TODO
|
8
|
-
lib/feldtruby.rb
|
9
|
-
lib/feldtruby/array.rb
|
10
|
-
lib/feldtruby/array/basic_stats.rb
|
11
|
-
lib/feldtruby/array/count_by.rb
|
12
|
-
lib/feldtruby/file/file_change_watcher.rb
|
13
|
-
lib/feldtruby/file/tempfile.rb
|
14
|
-
lib/feldtruby/float.rb
|
15
|
-
lib/feldtruby/math/rand.rb
|
16
|
-
lib/feldtruby/net/html_doc_getter.rb
|
17
|
-
lib/feldtruby/optimize.rb
|
18
|
-
lib/feldtruby/optimize/differential_evolution.rb
|
19
|
-
lib/feldtruby/optimize/max_steps_termination_criterion.rb
|
20
|
-
lib/feldtruby/optimize/objective.rb
|
21
|
-
lib/feldtruby/optimize/optimizer.rb
|
22
|
-
lib/feldtruby/optimize/random_search.rb
|
23
|
-
lib/feldtruby/optimize/search_space.rb
|
24
|
-
lib/feldtruby/optimize/stdout_logger.rb
|
25
|
-
lib/feldtruby/string/to_iso.rb
|
26
|
-
lib/feldtruby/time.rb
|
27
|
-
lib/feldtruby/vector.rb
|
28
|
-
lib/feldtruby/visualization/circos.rb
|
29
|
-
lib/feldtruby/word_counter.rb
|
30
|
-
test/helper.rb
|
31
|
-
test/test_array.rb
|
32
|
-
test/test_array_basic_stats.rb
|
33
|
-
test/test_array_count_by.rb
|
34
|
-
test/test_float.rb
|
35
|
-
test/test_optimize.rb
|
36
|
-
test/test_optimize_differential_evolution.rb
|
37
|
-
test/test_optimize_objective.rb
|
38
|
-
test/test_optimize_populationbasedoptimizer.rb
|
39
|
-
test/test_optimize_random_search.rb
|
40
|
-
test/test_optimize_search_space.rb
|
41
|
-
test/test_time.rb
|
42
|
-
test/test_vector.rb
|
43
|
-
test/test_html_doc_getter.rb
|
44
|
-
test/test_word_counter.rb
|
data/README.txt
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
= feldtruby
|
2
|
-
|
3
|
-
* https://github.com/robertfeldt/feldtruby
|
4
|
-
|
5
|
-
== DESCRIPTION:
|
6
|
-
|
7
|
-
Robert Feldt's Common Ruby Code lib. I will gradually collect the many generally useful Ruby tidbits I have laying around and clean them up into here. Don't want to rewrite these things again and again... So far this collects a number of generally useful additions to the standard Ruby classes/libs and then includes a simple optimization framework (FeldtRuby::Optimize).
|
8
|
-
|
9
|
-
email: robert.feldt ((a)) gmail.com
|
10
|
-
|
11
|
-
== FEATURES/PROBLEMS:
|
12
|
-
|
13
|
-
* FIX (list of features or problems)
|
14
|
-
|
15
|
-
== SYNOPSIS:
|
16
|
-
|
17
|
-
FIX (code sample of usage)
|
18
|
-
|
19
|
-
== REQUIREMENTS:
|
20
|
-
|
21
|
-
* FIX (list of requirements)
|
22
|
-
|
23
|
-
== INSTALL:
|
24
|
-
|
25
|
-
* FIX (sudo gem install, anything else)
|
26
|
-
|
27
|
-
== DEVELOPERS:
|
28
|
-
|
29
|
-
After checking out the source, run:
|
30
|
-
|
31
|
-
$ rake newb
|
32
|
-
|
33
|
-
This task will install any missing dependencies, run the tests/specs,
|
34
|
-
and generate the RDoc.
|
35
|
-
|
36
|
-
== LICENSE:
|
37
|
-
|
38
|
-
(The MIT License)
|
39
|
-
|
40
|
-
Copyright (c) 2012 FIX
|
41
|
-
|
42
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
43
|
-
a copy of this software and associated documentation files (the
|
44
|
-
'Software'), to deal in the Software without restriction, including
|
45
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
46
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
47
|
-
permit persons to whom the Software is furnished to do so, subject to
|
48
|
-
the following conditions:
|
49
|
-
|
50
|
-
The above copyright notice and this permission notice shall be
|
51
|
-
included in all copies or substantial portions of the Software.
|
52
|
-
|
53
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
54
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
55
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
56
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
57
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
58
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
59
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|