jubatus 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +5 -5
- data/VERSION +1 -1
- data/jubatus.gemspec +1 -1
- data/test/jubatus_test/anomaly/test.rb +5 -2
- data/test/jubatus_test/classifier/test.rb +5 -14
- data/test/jubatus_test/graph/test.rb +10 -5
- data/test/jubatus_test/recommender/test.rb +5 -21
- data/test/jubatus_test/regression/test.rb +5 -13
- data/test/jubatus_test/stat/test.rb +5 -21
- metadata +2 -3
- data/generate.sh +0 -31
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'bundler'
|
3
3
|
require 'simplecov' # for Ruby 1.9
|
4
4
|
require 'rake/testtask'
|
5
|
-
|
5
|
+
require 'ci/reporter/rake/test_unit'
|
6
6
|
|
7
7
|
Bundler::GemHelper.install_tasks
|
8
8
|
|
@@ -14,9 +14,9 @@ task :test do |test|
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
# for Ruby 1.8
|
18
|
+
task :coverage do |coverage|
|
19
|
+
system("rcov -o test/coverage -I lib:test --exclude . --include-file lib/jubatus --aggregate coverage.info test/**/*.rb")
|
20
|
+
end
|
21
21
|
|
22
22
|
task :default => [:build]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
data/jubatus.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.license = "MIT"
|
14
14
|
|
15
15
|
files = `git ls-files`.split("\n")
|
16
|
-
excludes = ["patch/*"]
|
16
|
+
excludes = ["patch/*", "generate.sh"]
|
17
17
|
|
18
18
|
gem.files = files.reject { |f| excludes.any? { |e| File.fnmatch(e, f) } }
|
19
19
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
@@ -50,6 +50,10 @@ class AnomalyTest < Test::Unit::TestCase
|
|
50
50
|
TestUtil.kill_process(@srv)
|
51
51
|
end
|
52
52
|
|
53
|
+
def test_get_client
|
54
|
+
assert_instance_of( MessagePack::RPC::Client, @cli.get_client )
|
55
|
+
end
|
56
|
+
|
53
57
|
def test_clear_row
|
54
58
|
d = Jubatus::Anomaly::Datum.new([], [])
|
55
59
|
(row_id, score) = @cli.add("name", d)
|
@@ -85,14 +89,13 @@ class AnomalyTest < Test::Unit::TestCase
|
|
85
89
|
|
86
90
|
def test_get_config
|
87
91
|
config = @cli.get_config("name")
|
88
|
-
assert_equal(JSON.parse(config)
|
92
|
+
assert_equal(JSON.parse(config), @config)
|
89
93
|
end
|
90
94
|
|
91
95
|
def test_save
|
92
96
|
assert_equal(true, @cli.save("name", "anomaly.save_test.model"))
|
93
97
|
end
|
94
98
|
|
95
|
-
|
96
99
|
def test_load
|
97
100
|
model_name = "anomaly.load_test.model"
|
98
101
|
@cli.save("name", model_name)
|
@@ -40,52 +40,43 @@ class ClassifierTest < Test::Unit::TestCase
|
|
40
40
|
TestUtil.kill_process(@srv)
|
41
41
|
end
|
42
42
|
|
43
|
+
def test_get_client
|
44
|
+
assert_instance_of( MessagePack::RPC::Client, @cli.get_client )
|
45
|
+
end
|
46
|
+
|
43
47
|
def test_get_config
|
44
48
|
config = @cli.get_config("name")
|
45
|
-
assert_equal(
|
46
|
-
|
49
|
+
assert_equal(JSON.parse(config), @config)
|
47
50
|
end
|
48
51
|
|
49
|
-
|
50
52
|
def test_train
|
51
53
|
string_values = [["key1", "val1"], ["key2", "val2"]]
|
52
54
|
num_values = [["key1", 1.0], ["key2", 2.0]]
|
53
55
|
d = Jubatus::Classifier::Datum.new(string_values, num_values)
|
54
56
|
data = [["label", d]]
|
55
57
|
assert_equal(@cli.train("name", data), 1)
|
56
|
-
|
57
58
|
end
|
58
59
|
|
59
|
-
|
60
60
|
def test_classify
|
61
61
|
string_values = [["key1", "val1"], ["key2", "val2"]]
|
62
62
|
num_values = [["key1", 1.0], ["key2", 2.0]]
|
63
63
|
d = Jubatus::Classifier::Datum.new(string_values, num_values)
|
64
64
|
data = [d]
|
65
65
|
result = @cli.classify("name", data)
|
66
|
-
|
67
66
|
end
|
68
67
|
|
69
|
-
|
70
68
|
def test_save
|
71
69
|
assert_equal(@cli.save("name", "classifier.save_test.model"), true)
|
72
|
-
|
73
70
|
end
|
74
71
|
|
75
|
-
|
76
72
|
def test_load
|
77
73
|
model_name = "classifier.load_test.model"
|
78
74
|
@cli.save("name", model_name)
|
79
75
|
assert_equal(@cli.load("name", model_name), true)
|
80
|
-
|
81
76
|
end
|
82
77
|
|
83
|
-
|
84
78
|
def test_get_status
|
85
79
|
@cli.get_status("name")
|
86
|
-
|
87
80
|
end
|
88
81
|
|
89
|
-
|
90
82
|
end
|
91
|
-
|
@@ -31,6 +31,10 @@ class GraphTest < Test::Unit::TestCase
|
|
31
31
|
TestUtil.kill_process(@srv)
|
32
32
|
end
|
33
33
|
|
34
|
+
def test_get_client
|
35
|
+
assert_instance_of( MessagePack::RPC::Client, @cli.get_client )
|
36
|
+
end
|
37
|
+
|
34
38
|
def test_node_info
|
35
39
|
edge_query = [["a", "b"], ["c", "d"], ["e", "f"]]
|
36
40
|
node_query = [["0", "1"], ["2", "3"]]
|
@@ -40,7 +44,6 @@ class GraphTest < Test::Unit::TestCase
|
|
40
44
|
Jubatus::Graph::Node.new(p, in_edges, out_edges)
|
41
45
|
end
|
42
46
|
|
43
|
-
|
44
47
|
def test_create_node
|
45
48
|
name = "name"
|
46
49
|
@cli.clear(name)
|
@@ -53,10 +56,8 @@ class GraphTest < Test::Unit::TestCase
|
|
53
56
|
@cli.clear(name)
|
54
57
|
nid = @cli.create_node(name)
|
55
58
|
assert_equal(@cli.remove_node(name, nid), true)
|
56
|
-
|
57
59
|
end
|
58
60
|
|
59
|
-
|
60
61
|
def test_update_node
|
61
62
|
name = "name"
|
62
63
|
@cli.clear(name)
|
@@ -65,7 +66,6 @@ class GraphTest < Test::Unit::TestCase
|
|
65
66
|
assert_equal(@cli.update_node(name, nid, prop), true)
|
66
67
|
end
|
67
68
|
|
68
|
-
|
69
69
|
def test_create_edge
|
70
70
|
name = "name"
|
71
71
|
@cli.clear(name)
|
@@ -76,7 +76,6 @@ class GraphTest < Test::Unit::TestCase
|
|
76
76
|
eid = @cli.create_edge("name", tgt, ei)
|
77
77
|
end
|
78
78
|
|
79
|
-
|
80
79
|
def test_create_edge
|
81
80
|
name = "name"
|
82
81
|
@cli.clear(name)
|
@@ -86,5 +85,11 @@ class GraphTest < Test::Unit::TestCase
|
|
86
85
|
ei = Jubatus::Graph::Edge.new(prop, src, tgt)
|
87
86
|
eid = @cli.create_edge(src, tgt, ei)
|
88
87
|
end
|
88
|
+
|
89
|
+
def test_get_config
|
90
|
+
config = @cli.get_config("name")
|
91
|
+
assert_equal(JSON.parse(config), @config)
|
92
|
+
end
|
93
|
+
|
89
94
|
end
|
90
95
|
|
@@ -37,13 +37,15 @@ class RecommenderTest < Test::Unit::TestCase
|
|
37
37
|
TestUtil.kill_process(@srv)
|
38
38
|
end
|
39
39
|
|
40
|
+
def test_get_client
|
41
|
+
assert_instance_of( MessagePack::RPC::Client, @cli.get_client )
|
42
|
+
end
|
43
|
+
|
40
44
|
def test_get_config
|
41
45
|
config = @cli.get_config("name")
|
42
|
-
assert_equal(
|
43
|
-
|
46
|
+
assert_equal(JSON.parse(config), @config)
|
44
47
|
end
|
45
48
|
|
46
|
-
|
47
49
|
def test_complete_row
|
48
50
|
@cli.clear_row("name", "complete_row")
|
49
51
|
string_values = [["key1", "val1"], ["key2", "val2"]]
|
@@ -52,10 +54,8 @@ class RecommenderTest < Test::Unit::TestCase
|
|
52
54
|
@cli.update_row("name", "complete_row", d)
|
53
55
|
d1 = @cli.complete_row_from_id("name", "complete_row")
|
54
56
|
d2 = @cli.complete_row_from_datum("name", d)
|
55
|
-
|
56
57
|
end
|
57
58
|
|
58
|
-
|
59
59
|
def test_get_similar_row
|
60
60
|
@cli.clear_row("name", "similar_row")
|
61
61
|
string_values = [["key1", "val1"], ["key2", "val2"]]
|
@@ -64,10 +64,8 @@ class RecommenderTest < Test::Unit::TestCase
|
|
64
64
|
@cli.update_row("name", "similar_row", d)
|
65
65
|
s1 = @cli.similar_row_from_id("name", "similar_row", 10)
|
66
66
|
s2 = @cli.similar_row_from_datum("name", d, 10)
|
67
|
-
|
68
67
|
end
|
69
68
|
|
70
|
-
|
71
69
|
def test_decode_row
|
72
70
|
@cli.clear_row("name", "decode_row")
|
73
71
|
string_values = [["key1", "val1"], ["key2", "val2"]]
|
@@ -79,7 +77,6 @@ class RecommenderTest < Test::Unit::TestCase
|
|
79
77
|
assert_equal(d.num_values, decoded_row.num_values)
|
80
78
|
end
|
81
79
|
|
82
|
-
|
83
80
|
def test_get_row
|
84
81
|
@cli.clear("name")
|
85
82
|
string_values = [["key1", "val1"], ["key2", "val2"]]
|
@@ -88,51 +85,38 @@ class RecommenderTest < Test::Unit::TestCase
|
|
88
85
|
@cli.update_row("name", "get_row", d)
|
89
86
|
row_names = @cli.get_all_rows("name")
|
90
87
|
assert_equal(row_names, ["get_row"])
|
91
|
-
|
92
88
|
end
|
93
89
|
|
94
90
|
|
95
91
|
def test_clear
|
96
92
|
@cli.clear("name")
|
97
|
-
|
98
93
|
end
|
99
94
|
|
100
|
-
|
101
95
|
def test_calcs
|
102
96
|
string_values = [["key1", "val1"], ["key2", "val2"]]
|
103
97
|
num_values = [["key1", 1.0], ["key2", 2.0]]
|
104
98
|
d = Jubatus::Recommender::Datum.new(string_values, num_values)
|
105
99
|
assert_in_delta(@cli.calc_similarity("name", d, d), 1, 0.000001)
|
106
100
|
assert_in_delta(@cli.calc_l2norm("name", d), Math.sqrt(1*1 + 1*1+ 1*1 + 2*2), 0.000001)
|
107
|
-
|
108
101
|
end
|
109
102
|
|
110
|
-
|
111
103
|
def test_clear
|
112
104
|
@cli.clear("name")
|
113
|
-
|
114
105
|
end
|
115
106
|
|
116
|
-
|
117
107
|
def test_save
|
118
108
|
assert_equal(@cli.save("name", "recommender.save_test.model"), true)
|
119
|
-
|
120
109
|
end
|
121
110
|
|
122
|
-
|
123
111
|
def test_load
|
124
112
|
model_name = "recommender.load_test.model"
|
125
113
|
@cli.save("name", model_name)
|
126
114
|
assert_equal(@cli.load("name", model_name), true)
|
127
|
-
|
128
115
|
end
|
129
116
|
|
130
|
-
|
131
117
|
def test_get_status
|
132
118
|
@cli.get_status("name")
|
133
|
-
|
134
119
|
end
|
135
120
|
|
136
|
-
|
137
121
|
end
|
138
122
|
|
@@ -41,52 +41,44 @@ class RegressionTest < Test::Unit::TestCase
|
|
41
41
|
TestUtil.kill_process(@srv)
|
42
42
|
end
|
43
43
|
|
44
|
+
def test_get_client
|
45
|
+
assert_instance_of( MessagePack::RPC::Client, @cli.get_client )
|
46
|
+
end
|
47
|
+
|
44
48
|
def test_get_config
|
45
49
|
config = @cli.get_config("name")
|
46
|
-
assert_equal(
|
47
|
-
|
50
|
+
assert_equal(JSON.parse(config), @config)
|
48
51
|
end
|
49
52
|
|
50
|
-
|
51
53
|
def test_train
|
52
54
|
string_values = [["key1", "val1"], ["key2", "val2"]]
|
53
55
|
num_values = [["key1", 1.0], ["key2", 2.0]]
|
54
56
|
d = Jubatus::Regression::Datum.new(string_values, num_values)
|
55
57
|
data = [[1.0, d]]
|
56
58
|
assert_equal(@cli.train("name", data), 1)
|
57
|
-
|
58
59
|
end
|
59
60
|
|
60
|
-
|
61
61
|
def test_estimate
|
62
62
|
string_values = [["key1", "val1"], ["key2", "val2"]]
|
63
63
|
num_values = [["key1", 1.0], ["key2", 2.0]]
|
64
64
|
d = Jubatus::Regression::Datum.new(string_values, num_values)
|
65
65
|
data = [d]
|
66
66
|
result = @cli.estimate("name", data)
|
67
|
-
|
68
67
|
end
|
69
68
|
|
70
|
-
|
71
69
|
def test_save
|
72
70
|
assert_equal(@cli.save("name", "regression.save_test.model"), true)
|
73
|
-
|
74
71
|
end
|
75
72
|
|
76
|
-
|
77
73
|
def test_load
|
78
74
|
model_name = "regression.load_test.model"
|
79
75
|
@cli.save("name", model_name)
|
80
76
|
assert_equal(@cli.load("name", model_name), true)
|
81
|
-
|
82
77
|
end
|
83
78
|
|
84
|
-
|
85
79
|
def test_get_status
|
86
80
|
@cli.get_status("name")
|
87
|
-
|
88
81
|
end
|
89
82
|
|
90
|
-
|
91
83
|
end
|
92
84
|
|
@@ -28,13 +28,15 @@ class StatTest < Test::Unit::TestCase
|
|
28
28
|
TestUtil.kill_process(@srv)
|
29
29
|
end
|
30
30
|
|
31
|
+
def test_get_client
|
32
|
+
assert_instance_of( MessagePack::RPC::Client, @cli.get_client )
|
33
|
+
end
|
34
|
+
|
31
35
|
def test_get_config
|
32
36
|
config = @cli.get_config("name")
|
33
|
-
assert_equal(
|
34
|
-
|
37
|
+
assert_equal(JSON.parse(config), @config)
|
35
38
|
end
|
36
39
|
|
37
|
-
|
38
40
|
def test_stddev
|
39
41
|
@cli.push("name", "stddev", 1.0)
|
40
42
|
@cli.push("name", "stddev", 2.0)
|
@@ -42,10 +44,8 @@ class StatTest < Test::Unit::TestCase
|
|
42
44
|
@cli.push("name", "stddev", 4.0)
|
43
45
|
@cli.push("name", "stddev", 5.0)
|
44
46
|
assert_equal(@cli.stddev("name", "stddev"), Math::sqrt(2.0))
|
45
|
-
|
46
47
|
end
|
47
48
|
|
48
|
-
|
49
49
|
def test_sum
|
50
50
|
@cli.push("name", "sum", 1.0)
|
51
51
|
@cli.push("name", "sum", 2.0)
|
@@ -53,10 +53,8 @@ class StatTest < Test::Unit::TestCase
|
|
53
53
|
@cli.push("name", "sum", 4.0)
|
54
54
|
@cli.push("name", "sum", 5.0)
|
55
55
|
assert_equal(@cli.sum("name", "sum"), 15.0)
|
56
|
-
|
57
56
|
end
|
58
57
|
|
59
|
-
|
60
58
|
def test_max
|
61
59
|
@cli.push("name", "max", 1.0)
|
62
60
|
@cli.push("name", "max", 2.0)
|
@@ -64,10 +62,8 @@ class StatTest < Test::Unit::TestCase
|
|
64
62
|
@cli.push("name", "max", 4.0)
|
65
63
|
@cli.push("name", "max", 5.0)
|
66
64
|
assert_equal(@cli.max("name", "max"), 5.0)
|
67
|
-
|
68
65
|
end
|
69
66
|
|
70
|
-
|
71
67
|
def test_min
|
72
68
|
@cli.push("name", "min", 1.0)
|
73
69
|
@cli.push("name", "min", 2.0)
|
@@ -75,10 +71,8 @@ class StatTest < Test::Unit::TestCase
|
|
75
71
|
@cli.push("name", "min", 4.0)
|
76
72
|
@cli.push("name", "min", 5.0)
|
77
73
|
assert_equal(@cli.min("name", "min"), 1.0)
|
78
|
-
|
79
74
|
end
|
80
75
|
|
81
|
-
|
82
76
|
def test_entropy
|
83
77
|
@cli.push("name", "entropy", 1.0)
|
84
78
|
@cli.push("name", "entropy", 2.0)
|
@@ -86,10 +80,8 @@ class StatTest < Test::Unit::TestCase
|
|
86
80
|
@cli.push("name", "entropy", 4.0)
|
87
81
|
@cli.push("name", "entropy", 5.0)
|
88
82
|
assert_equal(@cli.entropy("name", "entropy"), 0.0)
|
89
|
-
|
90
83
|
end
|
91
84
|
|
92
|
-
|
93
85
|
def test_moment
|
94
86
|
@cli.push("name", "moment", 1.0)
|
95
87
|
@cli.push("name", "moment", 2.0)
|
@@ -97,29 +89,21 @@ class StatTest < Test::Unit::TestCase
|
|
97
89
|
@cli.push("name", "moment", 4.0)
|
98
90
|
@cli.push("name", "moment", 5.0)
|
99
91
|
assert_equal(@cli.moment("name", "moment", 3, 0.0), 45.0)
|
100
|
-
|
101
92
|
end
|
102
93
|
|
103
|
-
|
104
94
|
def test_save
|
105
95
|
assert_equal(@cli.save("name", "stat.save_test.model"), true)
|
106
|
-
|
107
96
|
end
|
108
97
|
|
109
|
-
|
110
98
|
def test_load
|
111
99
|
model_name = "stat.load_test.model"
|
112
100
|
@cli.save("name", model_name)
|
113
101
|
assert_equal(@cli.load("name", model_name), true)
|
114
|
-
|
115
102
|
end
|
116
103
|
|
117
|
-
|
118
104
|
def test_get_status
|
119
105
|
@cli.get_status("name")
|
120
|
-
|
121
106
|
end
|
122
107
|
|
123
|
-
|
124
108
|
end
|
125
109
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jubatus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-03-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: msgpack-rpc
|
@@ -55,7 +55,6 @@ files:
|
|
55
55
|
- README.rst
|
56
56
|
- Rakefile
|
57
57
|
- VERSION
|
58
|
-
- generate.sh
|
59
58
|
- jubatus.gemspec
|
60
59
|
- lib/jubatus/anomaly/client.rb
|
61
60
|
- lib/jubatus/anomaly/types.rb
|
data/generate.sh
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
#!/bin/bash -ue
|
2
|
-
|
3
|
-
JUBATUS_DIR="jubatus-generate"
|
4
|
-
JUBATUS_BRANCH="master"
|
5
|
-
CLIENT_DIR="$(dirname "${0}")"
|
6
|
-
|
7
|
-
[ $# -eq 0 ] || JUBATUS_BRANCH="${1}"
|
8
|
-
|
9
|
-
rm -rf "${JUBATUS_DIR}"
|
10
|
-
git clone https://github.com/jubatus/jubatus.git "${JUBATUS_DIR}"
|
11
|
-
pushd "${JUBATUS_DIR}"
|
12
|
-
git checkout "${JUBATUS_BRANCH}"
|
13
|
-
popd
|
14
|
-
|
15
|
-
# Ruby
|
16
|
-
|
17
|
-
capitalize() {
|
18
|
-
echo "$(echo ${1:0:1} | tr 'a-z' 'A-Z')${1:1}"
|
19
|
-
}
|
20
|
-
|
21
|
-
rm -rf "${CLIENT_DIR}/lib"
|
22
|
-
for IDL in "${JUBATUS_DIR}/src/server"/*.idl; do
|
23
|
-
NAMESPACE="$(capitalize $(basename "${IDL}" ".idl"))"
|
24
|
-
mpidl ruby "${IDL}" -m "Jubatus::${NAMESPACE}" -o "${CLIENT_DIR}/lib/jubatus"
|
25
|
-
done
|
26
|
-
|
27
|
-
for PATCH in "${CLIENT_DIR}/patch"/*.patch; do
|
28
|
-
patch -p0 --directory "${CLIENT_DIR}" < "${PATCH}"
|
29
|
-
done
|
30
|
-
|
31
|
-
rm -rf "${JUBATUS_DIR}"
|