jubatus 0.1.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/LICENSE +5 -21
- data/README.rst +22 -0
- data/Rakefile +15 -10
- data/VERSION +1 -1
- data/generate.sh +31 -0
- data/jubatus.gemspec +13 -9
- data/lib/jubatus/classifier/client.rb +4 -26
- data/lib/jubatus/classifier/types.rb +7 -56
- data/lib/jubatus/graph/client.rb +42 -61
- data/lib/jubatus/graph/types.rb +36 -64
- data/lib/jubatus/recommender/client.rb +14 -36
- data/lib/jubatus/recommender/types.rb +3 -43
- data/lib/jubatus/regression/client.rb +8 -30
- data/lib/jubatus/regression/types.rb +3 -52
- data/lib/jubatus/stat/client.rb +8 -30
- data/lib/jubatus/stat/types.rb +2 -39
- data/test/jubatus_test/anomaly/test.rb +106 -0
- data/test/jubatus_test/classifier/test.rb +91 -0
- data/test/jubatus_test/graph/test.rb +90 -0
- data/test/jubatus_test/recommender/test.rb +138 -0
- data/test/jubatus_test/regression/test.rb +92 -0
- data/test/jubatus_test/stat/test.rb +125 -0
- data/test/jubatus_test/test_util.rb +49 -0
- metadata +69 -69
- data/README.md +0 -30
data/lib/jubatus/graph/types.rb
CHANGED
@@ -1,25 +1,4 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2012 Preferred Infrastructure, inc.
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
-
# of this software and associated documentation files (the "Software"), to deal
|
6
|
-
# in the Software without restriction, including without limitation the rights
|
7
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
# copies of the Software, and to permit persons to whom the Software is
|
9
|
-
# furnished to do so, subject to the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in
|
12
|
-
# all copies or substantial portions of the Software.
|
13
|
-
#
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
20
|
-
# SOFTWARE.
|
21
|
-
#
|
22
|
-
# This file is auto-generated from ./jubatus/jubatus.github/src/server//graph.idl
|
1
|
+
# This file is auto-generated from jubatus-generate/src/server/graph.idl
|
23
2
|
# *** DO NOT EDIT ***
|
24
3
|
|
25
4
|
require 'rubygems'
|
@@ -38,38 +17,30 @@ class Hash
|
|
38
17
|
end
|
39
18
|
|
40
19
|
module Jubatus
|
20
|
+
module Graph
|
41
21
|
|
42
|
-
class
|
43
|
-
def
|
44
|
-
|
45
|
-
end
|
46
|
-
def to_tuple(o)
|
47
|
-
o
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
class Node_info
|
52
|
-
def initialize(p, in_edges, out_edges)
|
53
|
-
@p = p
|
22
|
+
class Node
|
23
|
+
def initialize(property, in_edges, out_edges)
|
24
|
+
@property = property
|
54
25
|
@in_edges = in_edges
|
55
26
|
@out_edges = out_edges
|
56
27
|
end
|
57
28
|
def to_tuple
|
58
|
-
[@
|
29
|
+
[@property.each_with_object({}) {|(k,v),h| h[k] = v},
|
59
30
|
@in_edges.map {|x| x},
|
60
31
|
@out_edges.map {|x| x}]
|
61
32
|
end
|
62
33
|
def to_msgpack(out = '')
|
63
34
|
to_tuple.to_msgpack(out)
|
64
35
|
end
|
65
|
-
def
|
66
|
-
|
67
|
-
|
36
|
+
def Node.from_tuple(tuple)
|
37
|
+
Node.new(
|
38
|
+
tuple[0].each_with_object({}) {|(k,v),h| h[k] = v },
|
68
39
|
tuple[1].map { |x| x },
|
69
40
|
tuple[2].map { |x| x }
|
70
41
|
)
|
71
42
|
end
|
72
|
-
attr_reader :
|
43
|
+
attr_reader :property
|
73
44
|
attr_accessor :in_edges, :out_edges
|
74
45
|
end
|
75
46
|
|
@@ -94,58 +65,59 @@ class Preset_query
|
|
94
65
|
attr_accessor :edge_query, :node_query
|
95
66
|
end
|
96
67
|
|
97
|
-
class
|
98
|
-
def initialize(
|
99
|
-
@
|
100
|
-
@
|
101
|
-
@
|
68
|
+
class Edge
|
69
|
+
def initialize(property, source, target)
|
70
|
+
@property = property
|
71
|
+
@source = source
|
72
|
+
@target = target
|
102
73
|
end
|
103
74
|
def to_tuple
|
104
|
-
[@
|
105
|
-
@
|
106
|
-
@
|
75
|
+
[@property.each_with_object({}) {|(k,v),h| h[k] = v},
|
76
|
+
@source,
|
77
|
+
@target]
|
107
78
|
end
|
108
79
|
def to_msgpack(out = '')
|
109
80
|
to_tuple.to_msgpack(out)
|
110
81
|
end
|
111
|
-
def
|
112
|
-
|
113
|
-
|
82
|
+
def Edge.from_tuple(tuple)
|
83
|
+
Edge.new(
|
84
|
+
tuple[0].each_with_object({}) {|(k,v),h| h[k] = v },
|
114
85
|
tuple[1],
|
115
86
|
tuple[2]
|
116
87
|
)
|
117
88
|
end
|
118
|
-
attr_reader :
|
119
|
-
attr_accessor :
|
89
|
+
attr_reader :property
|
90
|
+
attr_accessor :source, :target
|
120
91
|
end
|
121
92
|
|
122
|
-
class
|
123
|
-
def initialize(
|
124
|
-
@
|
125
|
-
@
|
93
|
+
class Shortest_path_query
|
94
|
+
def initialize(source, target, max_hop, query)
|
95
|
+
@source = source
|
96
|
+
@target = target
|
126
97
|
@max_hop = max_hop
|
127
|
-
@
|
98
|
+
@query = query
|
128
99
|
end
|
129
100
|
def to_tuple
|
130
|
-
[@
|
131
|
-
@
|
101
|
+
[@source,
|
102
|
+
@target,
|
132
103
|
@max_hop,
|
133
|
-
@
|
104
|
+
@query.to_tuple]
|
134
105
|
end
|
135
106
|
def to_msgpack(out = '')
|
136
107
|
to_tuple.to_msgpack(out)
|
137
108
|
end
|
138
|
-
def
|
139
|
-
|
109
|
+
def Shortest_path_query.from_tuple(tuple)
|
110
|
+
Shortest_path_query.new(
|
140
111
|
tuple[0],
|
141
112
|
tuple[1],
|
142
113
|
tuple[2],
|
143
114
|
Preset_query.from_tuple(tuple[3])
|
144
115
|
)
|
145
116
|
end
|
146
|
-
attr_reader :
|
147
|
-
attr_accessor :
|
117
|
+
attr_reader :query
|
118
|
+
attr_accessor :source, :target, :max_hop
|
148
119
|
end
|
149
120
|
|
150
121
|
end
|
122
|
+
end
|
151
123
|
|
@@ -1,25 +1,4 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2012 Preferred Infrastructure, inc.
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
-
# of this software and associated documentation files (the "Software"), to deal
|
6
|
-
# in the Software without restriction, including without limitation the rights
|
7
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
# copies of the Software, and to permit persons to whom the Software is
|
9
|
-
# furnished to do so, subject to the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in
|
12
|
-
# all copies or substantial portions of the Software.
|
13
|
-
#
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
20
|
-
# SOFTWARE.
|
21
|
-
#
|
22
|
-
# This file is auto-generated from ./jubatus/jubatus.github/src/server//recommender.idl
|
1
|
+
# This file is auto-generated from jubatus-generate/src/server/recommender.idl
|
23
2
|
# *** DO NOT EDIT ***
|
24
3
|
|
25
4
|
require 'rubygems'
|
@@ -27,23 +6,21 @@ require 'msgpack/rpc'
|
|
27
6
|
require File.join(File.dirname(__FILE__), 'types')
|
28
7
|
|
29
8
|
module Jubatus
|
9
|
+
module Recommender
|
30
10
|
module Client
|
31
11
|
|
32
12
|
class Recommender
|
33
13
|
def initialize(host, port)
|
34
14
|
@cli = MessagePack::RPC::Client.new(host, port)
|
35
15
|
end
|
36
|
-
def set_config(name, c)
|
37
|
-
@cli.call(:set_config, name, c)
|
38
|
-
end
|
39
16
|
def get_config(name)
|
40
|
-
|
17
|
+
@cli.call(:get_config, name)
|
41
18
|
end
|
42
19
|
def clear_row(name, id)
|
43
20
|
@cli.call(:clear_row, name, id)
|
44
21
|
end
|
45
|
-
def update_row(name, id,
|
46
|
-
@cli.call(:update_row, name, id,
|
22
|
+
def update_row(name, id, row)
|
23
|
+
@cli.call(:update_row, name, id, row)
|
47
24
|
end
|
48
25
|
def clear(name)
|
49
26
|
@cli.call(:clear, name)
|
@@ -51,14 +28,14 @@ class Recommender
|
|
51
28
|
def complete_row_from_id(name, id)
|
52
29
|
Datum.from_tuple(@cli.call(:complete_row_from_id, name, id))
|
53
30
|
end
|
54
|
-
def
|
55
|
-
Datum.from_tuple(@cli.call(:
|
31
|
+
def complete_row_from_datum(name, row)
|
32
|
+
Datum.from_tuple(@cli.call(:complete_row_from_datum, name, row))
|
56
33
|
end
|
57
34
|
def similar_row_from_id(name, id, size)
|
58
35
|
Similar_result.from_tuple(@cli.call(:similar_row_from_id, name, id, size))
|
59
36
|
end
|
60
|
-
def
|
61
|
-
Similar_result.from_tuple(@cli.call(:
|
37
|
+
def similar_row_from_datum(name, row, size)
|
38
|
+
Similar_result.from_tuple(@cli.call(:similar_row_from_datum, name, row, size))
|
62
39
|
end
|
63
40
|
def decode_row(name, id)
|
64
41
|
Datum.from_tuple(@cli.call(:decode_row, name, id))
|
@@ -66,11 +43,11 @@ class Recommender
|
|
66
43
|
def get_all_rows(name)
|
67
44
|
@cli.call(:get_all_rows, name)
|
68
45
|
end
|
69
|
-
def
|
70
|
-
@cli.call(:
|
46
|
+
def calc_similarity(name, lhs, rhs)
|
47
|
+
@cli.call(:calc_similarity, name, lhs, rhs)
|
71
48
|
end
|
72
|
-
def
|
73
|
-
@cli.call(:
|
49
|
+
def calc_l2norm(name, row)
|
50
|
+
@cli.call(:calc_l2norm, name, row)
|
74
51
|
end
|
75
52
|
def save(name, id)
|
76
53
|
@cli.call(:save, name, id)
|
@@ -85,3 +62,4 @@ end
|
|
85
62
|
|
86
63
|
end
|
87
64
|
end
|
65
|
+
end
|
@@ -1,30 +1,10 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2012 Preferred Infrastructure, inc.
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
-
# of this software and associated documentation files (the "Software"), to deal
|
6
|
-
# in the Software without restriction, including without limitation the rights
|
7
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
# copies of the Software, and to permit persons to whom the Software is
|
9
|
-
# furnished to do so, subject to the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in
|
12
|
-
# all copies or substantial portions of the Software.
|
13
|
-
#
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
20
|
-
# SOFTWARE.
|
21
|
-
#
|
22
|
-
# This file is auto-generated from ./jubatus/jubatus.github/src/server//recommender.idl
|
1
|
+
# This file is auto-generated from jubatus-generate/src/server/recommender.idl
|
23
2
|
# *** DO NOT EDIT ***
|
24
3
|
|
25
4
|
require 'rubygems'
|
26
5
|
require 'msgpack/rpc'
|
27
6
|
module Jubatus
|
7
|
+
module Recommender
|
28
8
|
|
29
9
|
class Similar_result
|
30
10
|
def Similar_result.from_tuple(tuple)
|
@@ -35,27 +15,6 @@ class Similar_result
|
|
35
15
|
end
|
36
16
|
end
|
37
17
|
|
38
|
-
class Config_data
|
39
|
-
def initialize(method, converter)
|
40
|
-
@method = method
|
41
|
-
@converter = converter
|
42
|
-
end
|
43
|
-
def to_tuple
|
44
|
-
[@method,
|
45
|
-
@converter]
|
46
|
-
end
|
47
|
-
def to_msgpack(out = '')
|
48
|
-
to_tuple.to_msgpack(out)
|
49
|
-
end
|
50
|
-
def Config_data.from_tuple(tuple)
|
51
|
-
Config_data.new(
|
52
|
-
tuple[0],
|
53
|
-
tuple[1]
|
54
|
-
)
|
55
|
-
end
|
56
|
-
attr_accessor :method, :converter
|
57
|
-
end
|
58
|
-
|
59
18
|
class Datum
|
60
19
|
def initialize(string_values, num_values)
|
61
20
|
@string_values = string_values
|
@@ -78,4 +37,5 @@ class Datum
|
|
78
37
|
end
|
79
38
|
|
80
39
|
end
|
40
|
+
end
|
81
41
|
|
@@ -1,25 +1,4 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2012 Preferred Infrastructure, inc.
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
-
# of this software and associated documentation files (the "Software"), to deal
|
6
|
-
# in the Software without restriction, including without limitation the rights
|
7
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
# copies of the Software, and to permit persons to whom the Software is
|
9
|
-
# furnished to do so, subject to the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in
|
12
|
-
# all copies or substantial portions of the Software.
|
13
|
-
#
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
20
|
-
# SOFTWARE.
|
21
|
-
#
|
22
|
-
# This file is auto-generated from ./jubatus/jubatus.github/src/server//regression.idl
|
1
|
+
# This file is auto-generated from jubatus-generate/src/server/regression.idl
|
23
2
|
# *** DO NOT EDIT ***
|
24
3
|
|
25
4
|
require 'rubygems'
|
@@ -27,17 +6,15 @@ require 'msgpack/rpc'
|
|
27
6
|
require File.join(File.dirname(__FILE__), 'types')
|
28
7
|
|
29
8
|
module Jubatus
|
9
|
+
module Regression
|
30
10
|
module Client
|
31
11
|
|
32
12
|
class Regression
|
33
13
|
def initialize(host, port)
|
34
14
|
@cli = MessagePack::RPC::Client.new(host, port)
|
35
15
|
end
|
36
|
-
def set_config(name, c)
|
37
|
-
@cli.call(:set_config, name, c)
|
38
|
-
end
|
39
16
|
def get_config(name)
|
40
|
-
|
17
|
+
@cli.call(:get_config, name)
|
41
18
|
end
|
42
19
|
def train(name, train_data)
|
43
20
|
@cli.call(:train, name, train_data)
|
@@ -45,11 +22,11 @@ class Regression
|
|
45
22
|
def estimate(name, estimate_data)
|
46
23
|
@cli.call(:estimate, name, estimate_data)
|
47
24
|
end
|
48
|
-
def save(name,
|
49
|
-
@cli.call(:save, name,
|
25
|
+
def save(name, id)
|
26
|
+
@cli.call(:save, name, id)
|
50
27
|
end
|
51
|
-
def load(name,
|
52
|
-
@cli.call(:load, name,
|
28
|
+
def load(name, id)
|
29
|
+
@cli.call(:load, name, id)
|
53
30
|
end
|
54
31
|
def get_status(name)
|
55
32
|
@cli.call(:get_status, name)
|
@@ -58,3 +35,4 @@ end
|
|
58
35
|
|
59
36
|
end
|
60
37
|
end
|
38
|
+
end
|
@@ -1,60 +1,10 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (c) 2012 Preferred Infrastructure, inc.
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
-
# of this software and associated documentation files (the "Software"), to deal
|
6
|
-
# in the Software without restriction, including without limitation the rights
|
7
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
# copies of the Software, and to permit persons to whom the Software is
|
9
|
-
# furnished to do so, subject to the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in
|
12
|
-
# all copies or substantial portions of the Software.
|
13
|
-
#
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
20
|
-
# SOFTWARE.
|
21
|
-
#
|
22
|
-
# This file is auto-generated from ./jubatus/jubatus.github/src/server//regression.idl
|
1
|
+
# This file is auto-generated from jubatus-generate/src/server/regression.idl
|
23
2
|
# *** DO NOT EDIT ***
|
24
3
|
|
25
4
|
require 'rubygems'
|
26
5
|
require 'msgpack/rpc'
|
27
6
|
module Jubatus
|
28
|
-
|
29
|
-
class Param_t
|
30
|
-
def Param_t.from_tuple(tuple)
|
31
|
-
tuple.each_with_object({}) {|(k,v),h| h[k] = v }
|
32
|
-
end
|
33
|
-
def to_tuple(o)
|
34
|
-
o
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
class Config_data
|
39
|
-
def initialize(method, config)
|
40
|
-
@method = method
|
41
|
-
@config = config
|
42
|
-
end
|
43
|
-
def to_tuple
|
44
|
-
[@method,
|
45
|
-
@config]
|
46
|
-
end
|
47
|
-
def to_msgpack(out = '')
|
48
|
-
to_tuple.to_msgpack(out)
|
49
|
-
end
|
50
|
-
def Config_data.from_tuple(tuple)
|
51
|
-
Config_data.new(
|
52
|
-
tuple[0],
|
53
|
-
tuple[1]
|
54
|
-
)
|
55
|
-
end
|
56
|
-
attr_accessor :method, :config
|
57
|
-
end
|
7
|
+
module Regression
|
58
8
|
|
59
9
|
class Datum
|
60
10
|
def initialize(string_values, num_values)
|
@@ -78,4 +28,5 @@ class Datum
|
|
78
28
|
end
|
79
29
|
|
80
30
|
end
|
31
|
+
end
|
81
32
|
|