jubatus 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
data/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2012, Jubatus Team All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions are met:
5
+ * Redistributions of source code must retain the above copyright
6
+ notice, this list of conditions and the following disclaimer.
7
+ * Redistributions in binary form must reproduce the above copyright
8
+ notice, this list of conditions and the following disclaimer in the
9
+ documentation and/or other materials provided with the distribution.
10
+ * Neither the name of the <organization> nor the
11
+ names of its contributors may be used to endorse or promote products
12
+ derived from this software without specific prior written permission.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17
+ DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
18
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,30 @@
1
+ jubatus-ruby-client
2
+ ===================
3
+
4
+ Jubatus' Ruby client skeleton. Don't clone this repository.
5
+
6
+ Released client is generated by [MessagePack IDL](https://github.com/msgpack/msgpack-haskell/tree/master/msgpack-idl).
7
+
8
+ ## TODO
9
+
10
+ - Release gem (Currently, IDL generated codes are broken...)
11
+
12
+ ## Copyright
13
+
14
+ <table>
15
+ <tr>
16
+ <td>Web site</td><td>http://jubat.us/</td>
17
+ </tr>
18
+ <tr>
19
+ <td>Repository</td><td>https://github.com/jubatus</td>
20
+ </tr>
21
+ <tr>
22
+ <td>Author</td><td>Jubatus Team</td>
23
+ </tr>
24
+ <tr>
25
+ <td>Copyright</td><td>Copyright (c) 2012, Jubatus Team</td>
26
+ </tr>
27
+ <tr>
28
+ <td>License</td><td>New BSD License</td>
29
+ </tr>
30
+ </table>
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'rake/testtask'
5
+
6
+ Rake::TestTask.new(:test) do |test|
7
+ test.libs << 'lib' << 'test'
8
+ test.test_files = FileList['test/*.rb']
9
+ test.verbose = true
10
+ end
11
+
12
+ task :coverage do |t|
13
+ ENV['SIMPLE_COV'] = '1'
14
+ Rake::Task["test"].invoke
15
+ end
16
+
17
+ task :default => [:build]
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
data/jubatus.gemspec ADDED
@@ -0,0 +1,21 @@
1
+ # encoding: utf-8
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.name = "jubatus"
6
+ gem.description = "Jubatus client for Ruby"
7
+ gem.homepage = "https://github.com/jubatus/jubatus-ruby-client"
8
+ gem.summary = gem.description
9
+ gem.version = File.read("VERSION").strip
10
+ gem.authors = ["Jubatus Team"]
11
+ gem.email = "jubatus@googlegroups.com"
12
+ gem.has_rdoc = false
13
+ #gem.platform = Gem::Platform::RUBY
14
+ gem.files = `git ls-files`.split("\n")
15
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ gem.require_paths = ['lib']
18
+
19
+ gem.add_dependency "msgpack-rpc", "~> 0.4.5"
20
+ gem.add_development_dependency "rake", ">= 0.9.2"
21
+ end
@@ -0,0 +1,60 @@
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//classifier.idl
23
+ # *** DO NOT EDIT ***
24
+
25
+ require 'rubygems'
26
+ require 'msgpack/rpc'
27
+ require File.join(File.dirname(__FILE__), 'types')
28
+
29
+ module Jubatus
30
+ module Client
31
+
32
+ class Classifier
33
+ def initialize(host, port)
34
+ @cli = MessagePack::RPC::Client.new(host, port)
35
+ end
36
+ def set_config(name, c)
37
+ @cli.call(:set_config, name, c)
38
+ end
39
+ def get_config(name)
40
+ Config_data.from_tuple(@cli.call(:get_config, name))
41
+ end
42
+ def train(name, data)
43
+ @cli.call(:train, name, data)
44
+ end
45
+ def classify(name, data)
46
+ @cli.call(:classify, name, data)
47
+ end
48
+ def save(name, id)
49
+ @cli.call(:save, name, id)
50
+ end
51
+ def load(name, id)
52
+ @cli.call(:load, name, id)
53
+ end
54
+ def get_status(name)
55
+ @cli.call(:get_status, name)
56
+ end
57
+ end
58
+
59
+ end
60
+ end
@@ -0,0 +1,102 @@
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//classifier.idl
23
+ # *** DO NOT EDIT ***
24
+
25
+ require 'rubygems'
26
+ require 'msgpack/rpc'
27
+ 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
58
+
59
+ class Datum
60
+ def initialize(string_values, num_values)
61
+ @string_values = string_values
62
+ @num_values = num_values
63
+ end
64
+ def to_tuple
65
+ [@string_values.map {|x| [x[0], x[1], ] },
66
+ @num_values.map {|x| [x[0], x[1], ] }]
67
+ end
68
+ def to_msgpack(out = '')
69
+ to_tuple.to_msgpack(out)
70
+ end
71
+ def Datum.from_tuple(tuple)
72
+ Datum.new(
73
+ tuple[0].map { |x| [x[0] , x[1] ] },
74
+ tuple[1].map { |x| [x[0] , x[1] ] }
75
+ )
76
+ end
77
+ attr_accessor :string_values, :num_values
78
+ end
79
+
80
+ class Estimate_result
81
+ def initialize(label, prob)
82
+ @label = label
83
+ @prob = prob
84
+ end
85
+ def to_tuple
86
+ [@label,
87
+ @prob]
88
+ end
89
+ def to_msgpack(out = '')
90
+ to_tuple.to_msgpack(out)
91
+ end
92
+ def Estimate_result.from_tuple(tuple)
93
+ Estimate_result.new(
94
+ tuple[0],
95
+ tuple[1]
96
+ )
97
+ end
98
+ attr_accessor :label, :prob
99
+ end
100
+
101
+ end
102
+
@@ -0,0 +1,108 @@
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
23
+ # *** DO NOT EDIT ***
24
+
25
+ require 'rubygems'
26
+ require 'msgpack/rpc'
27
+ require File.join(File.dirname(__FILE__), 'types')
28
+
29
+ module Jubatus
30
+ module Client
31
+
32
+ class Graph
33
+ def initialize(host, port)
34
+ @cli = MessagePack::RPC::Client.new(host, port)
35
+ end
36
+ def create_node(name)
37
+ @cli.call(:create_node, name)
38
+ end
39
+ def remove_node(name, nid)
40
+ @cli.call(:remove_node, name, nid)
41
+ end
42
+ def update_node(name, nid, p)
43
+ @cli.call(:update_node, name, nid, p)
44
+ end
45
+ def create_edge(name, nid, ei)
46
+ @cli.call(:create_edge, name, nid, ei)
47
+ end
48
+ def update_edge(name, nid, eid, ei)
49
+ @cli.call(:update_edge, name, nid, eid, ei)
50
+ end
51
+ def remove_edge(name, nid, e)
52
+ @cli.call(:remove_edge, name, nid, e)
53
+ end
54
+ def centrality(name, nid, ct, q)
55
+ @cli.call(:centrality, name, nid, ct, q)
56
+ end
57
+ def add_centrality_query(name, q)
58
+ @cli.call(:add_centrality_query, name, q)
59
+ end
60
+ def add_shortest_path_query(name, q)
61
+ @cli.call(:add_shortest_path_query, name, q)
62
+ end
63
+ def remove_centrality_query(name, q)
64
+ @cli.call(:remove_centrality_query, name, q)
65
+ end
66
+ def remove_shortest_path_query(name, q)
67
+ @cli.call(:remove_shortest_path_query, name, q)
68
+ end
69
+ def shortest_path(name, r)
70
+ @cli.call(:shortest_path, name, r)
71
+ end
72
+ def update_index(name)
73
+ @cli.call(:update_index, name)
74
+ end
75
+ def clear(name)
76
+ @cli.call(:clear, name)
77
+ end
78
+ def get_node(name, nid)
79
+ Node_info.from_tuple(@cli.call(:get_node, name, nid))
80
+ end
81
+ def get_edge(name, nid, e)
82
+ Edge_info.from_tuple(@cli.call(:get_edge, name, nid, e))
83
+ end
84
+ def save(name, arg1)
85
+ @cli.call(:save, name, arg1)
86
+ end
87
+ def load(name, arg1)
88
+ @cli.call(:load, name, arg1)
89
+ end
90
+ def get_status(name)
91
+ @cli.call(:get_status, name)
92
+ end
93
+ def create_node_here(name, nid)
94
+ @cli.call(:create_node_here, name, nid)
95
+ end
96
+ def create_global_node(name, nid)
97
+ @cli.call(:create_global_node, name, nid)
98
+ end
99
+ def remove_global_node(name, nid)
100
+ @cli.call(:remove_global_node, name, nid)
101
+ end
102
+ def create_edge_here(name, eid, ei)
103
+ @cli.call(:create_edge_here, name, eid, ei)
104
+ end
105
+ end
106
+
107
+ end
108
+ end
@@ -0,0 +1,151 @@
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
23
+ # *** DO NOT EDIT ***
24
+
25
+ require 'rubygems'
26
+ require 'msgpack/rpc'
27
+
28
+ class String
29
+ def to_tuple
30
+ self
31
+ end
32
+ end
33
+
34
+ class Hash
35
+ def to_tuple
36
+ self
37
+ end
38
+ end
39
+
40
+ module Jubatus
41
+
42
+ class Property
43
+ def Property.from_tuple(tuple)
44
+ tuple.each_with_object({}) {|(k,v),h| h[k] = v }
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
54
+ @in_edges = in_edges
55
+ @out_edges = out_edges
56
+ end
57
+ def to_tuple
58
+ [@p.to_tuple,
59
+ @in_edges.map {|x| x},
60
+ @out_edges.map {|x| x}]
61
+ end
62
+ def to_msgpack(out = '')
63
+ to_tuple.to_msgpack(out)
64
+ end
65
+ def Node_info.from_tuple(tuple)
66
+ Node_info.new(
67
+ Property.from_tuple(tuple[0]),
68
+ tuple[1].map { |x| x },
69
+ tuple[2].map { |x| x }
70
+ )
71
+ end
72
+ attr_reader :p
73
+ attr_accessor :in_edges, :out_edges
74
+ end
75
+
76
+ class Preset_query
77
+ def initialize(edge_query, node_query)
78
+ @edge_query = edge_query
79
+ @node_query = node_query
80
+ end
81
+ def to_tuple
82
+ [@edge_query.map {|x| [x[0], x[1], ] },
83
+ @node_query.map {|x| [x[0], x[1], ] }]
84
+ end
85
+ def to_msgpack(out = '')
86
+ to_tuple.to_msgpack(out)
87
+ end
88
+ def Preset_query.from_tuple(tuple)
89
+ Preset_query.new(
90
+ tuple[0].map { |x| [x[0] , x[1] ] },
91
+ tuple[1].map { |x| [x[0] , x[1] ] }
92
+ )
93
+ end
94
+ attr_accessor :edge_query, :node_query
95
+ end
96
+
97
+ class Edge_info
98
+ def initialize(p, src, tgt)
99
+ @p = p
100
+ @src = src
101
+ @tgt = tgt
102
+ end
103
+ def to_tuple
104
+ [@p.to_tuple,
105
+ @src,
106
+ @tgt]
107
+ end
108
+ def to_msgpack(out = '')
109
+ to_tuple.to_msgpack(out)
110
+ end
111
+ def Edge_info.from_tuple(tuple)
112
+ Edge_info.new(
113
+ Property.from_tuple(tuple[0]),
114
+ tuple[1],
115
+ tuple[2]
116
+ )
117
+ end
118
+ attr_reader :p
119
+ attr_accessor :src, :tgt
120
+ end
121
+
122
+ class Shortest_path_req
123
+ def initialize(src, tgt, max_hop, q)
124
+ @src = src
125
+ @tgt = tgt
126
+ @max_hop = max_hop
127
+ @q = q
128
+ end
129
+ def to_tuple
130
+ [@src,
131
+ @tgt,
132
+ @max_hop,
133
+ @q.to_tuple]
134
+ end
135
+ def to_msgpack(out = '')
136
+ to_tuple.to_msgpack(out)
137
+ end
138
+ def Shortest_path_req.from_tuple(tuple)
139
+ Shortest_path_req.new(
140
+ tuple[0],
141
+ tuple[1],
142
+ tuple[2],
143
+ Preset_query.from_tuple(tuple[3])
144
+ )
145
+ end
146
+ attr_reader :q
147
+ attr_accessor :src, :tgt, :max_hop
148
+ end
149
+
150
+ end
151
+
@@ -0,0 +1,87 @@
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
23
+ # *** DO NOT EDIT ***
24
+
25
+ require 'rubygems'
26
+ require 'msgpack/rpc'
27
+ require File.join(File.dirname(__FILE__), 'types')
28
+
29
+ module Jubatus
30
+ module Client
31
+
32
+ class Recommender
33
+ def initialize(host, port)
34
+ @cli = MessagePack::RPC::Client.new(host, port)
35
+ end
36
+ def set_config(name, c)
37
+ @cli.call(:set_config, name, c)
38
+ end
39
+ def get_config(name)
40
+ Config_data.from_tuple(@cli.call(:get_config, name))
41
+ end
42
+ def clear_row(name, id)
43
+ @cli.call(:clear_row, name, id)
44
+ end
45
+ def update_row(name, id, d)
46
+ @cli.call(:update_row, name, id, d)
47
+ end
48
+ def clear(name)
49
+ @cli.call(:clear, name)
50
+ end
51
+ def complete_row_from_id(name, id)
52
+ Datum.from_tuple(@cli.call(:complete_row_from_id, name, id))
53
+ end
54
+ def complete_row_from_data(name, d)
55
+ Datum.from_tuple(@cli.call(:complete_row_from_data, name, d))
56
+ end
57
+ def similar_row_from_id(name, id, size)
58
+ Similar_result.from_tuple(@cli.call(:similar_row_from_id, name, id, size))
59
+ end
60
+ def similar_row_from_data(name, data, size)
61
+ Similar_result.from_tuple(@cli.call(:similar_row_from_data, name, data, size))
62
+ end
63
+ def decode_row(name, id)
64
+ Datum.from_tuple(@cli.call(:decode_row, name, id))
65
+ end
66
+ def get_all_rows(name)
67
+ @cli.call(:get_all_rows, name)
68
+ end
69
+ def similarity(name, lhs, rhs)
70
+ @cli.call(:similarity, name, lhs, rhs)
71
+ end
72
+ def l2norm(name, d)
73
+ @cli.call(:l2norm, name, d)
74
+ end
75
+ def save(name, id)
76
+ @cli.call(:save, name, id)
77
+ end
78
+ def load(name, id)
79
+ @cli.call(:load, name, id)
80
+ end
81
+ def get_status(name)
82
+ @cli.call(:get_status, name)
83
+ end
84
+ end
85
+
86
+ end
87
+ end
@@ -0,0 +1,81 @@
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
23
+ # *** DO NOT EDIT ***
24
+
25
+ require 'rubygems'
26
+ require 'msgpack/rpc'
27
+ module Jubatus
28
+
29
+ class Similar_result
30
+ def Similar_result.from_tuple(tuple)
31
+ tuple.map { |x| [x[0] , x[1] ] }
32
+ end
33
+ def to_tuple(o)
34
+ o
35
+ end
36
+ end
37
+
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
+ class Datum
60
+ def initialize(string_values, num_values)
61
+ @string_values = string_values
62
+ @num_values = num_values
63
+ end
64
+ def to_tuple
65
+ [@string_values.map {|x| [x[0], x[1], ] },
66
+ @num_values.map {|x| [x[0], x[1], ] }]
67
+ end
68
+ def to_msgpack(out = '')
69
+ to_tuple.to_msgpack(out)
70
+ end
71
+ def Datum.from_tuple(tuple)
72
+ Datum.new(
73
+ tuple[0].map { |x| [x[0] , x[1] ] },
74
+ tuple[1].map { |x| [x[0] , x[1] ] }
75
+ )
76
+ end
77
+ attr_accessor :string_values, :num_values
78
+ end
79
+
80
+ end
81
+
@@ -0,0 +1,60 @@
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
23
+ # *** DO NOT EDIT ***
24
+
25
+ require 'rubygems'
26
+ require 'msgpack/rpc'
27
+ require File.join(File.dirname(__FILE__), 'types')
28
+
29
+ module Jubatus
30
+ module Client
31
+
32
+ class Regression
33
+ def initialize(host, port)
34
+ @cli = MessagePack::RPC::Client.new(host, port)
35
+ end
36
+ def set_config(name, c)
37
+ @cli.call(:set_config, name, c)
38
+ end
39
+ def get_config(name)
40
+ Config_data.from_tuple(@cli.call(:get_config, name))
41
+ end
42
+ def train(name, train_data)
43
+ @cli.call(:train, name, train_data)
44
+ end
45
+ def estimate(name, estimate_data)
46
+ @cli.call(:estimate, name, estimate_data)
47
+ end
48
+ def save(name, arg1)
49
+ @cli.call(:save, name, arg1)
50
+ end
51
+ def load(name, arg1)
52
+ @cli.call(:load, name, arg1)
53
+ end
54
+ def get_status(name)
55
+ @cli.call(:get_status, name)
56
+ end
57
+ end
58
+
59
+ end
60
+ end
@@ -0,0 +1,81 @@
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
23
+ # *** DO NOT EDIT ***
24
+
25
+ require 'rubygems'
26
+ require 'msgpack/rpc'
27
+ 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
58
+
59
+ class Datum
60
+ def initialize(string_values, num_values)
61
+ @string_values = string_values
62
+ @num_values = num_values
63
+ end
64
+ def to_tuple
65
+ [@string_values.map {|x| [x[0], x[1], ] },
66
+ @num_values.map {|x| [x[0], x[1], ] }]
67
+ end
68
+ def to_msgpack(out = '')
69
+ to_tuple.to_msgpack(out)
70
+ end
71
+ def Datum.from_tuple(tuple)
72
+ Datum.new(
73
+ tuple[0].map { |x| [x[0] , x[1] ] },
74
+ tuple[1].map { |x| [x[0] , x[1] ] }
75
+ )
76
+ end
77
+ attr_accessor :string_values, :num_values
78
+ end
79
+
80
+ end
81
+
@@ -0,0 +1,75 @@
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//stat.idl
23
+ # *** DO NOT EDIT ***
24
+
25
+ require 'rubygems'
26
+ require 'msgpack/rpc'
27
+ require File.join(File.dirname(__FILE__), 'types')
28
+
29
+ module Jubatus
30
+ module Client
31
+
32
+ class Stat
33
+ def initialize(host, port)
34
+ @cli = MessagePack::RPC::Client.new(host, port)
35
+ end
36
+ def set_config(name, c)
37
+ @cli.call(:set_config, name, c)
38
+ end
39
+ def get_config(name)
40
+ Config_data.from_tuple(@cli.call(:get_config, name))
41
+ end
42
+ def push(name, key, val)
43
+ @cli.call(:push, name, key, val)
44
+ end
45
+ def sum(name, key)
46
+ @cli.call(:sum, name, key)
47
+ end
48
+ def stddev(name, key)
49
+ @cli.call(:stddev, name, key)
50
+ end
51
+ def max(name, key)
52
+ @cli.call(:max, name, key)
53
+ end
54
+ def min(name, key)
55
+ @cli.call(:min, name, key)
56
+ end
57
+ def entropy(name, key)
58
+ @cli.call(:entropy, name, key)
59
+ end
60
+ def moment(name, key, n, c)
61
+ @cli.call(:moment, name, key, n, c)
62
+ end
63
+ def save(name, id)
64
+ @cli.call(:save, name, id)
65
+ end
66
+ def load(name, id)
67
+ @cli.call(:load, name, id)
68
+ end
69
+ def get_status(name)
70
+ @cli.call(:get_status, name)
71
+ end
72
+ end
73
+
74
+ end
75
+ end
@@ -0,0 +1,48 @@
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//stat.idl
23
+ # *** DO NOT EDIT ***
24
+
25
+ require 'rubygems'
26
+ require 'msgpack/rpc'
27
+ module Jubatus
28
+
29
+ class Config_data
30
+ def initialize(window_size)
31
+ @window_size = window_size
32
+ end
33
+ def to_tuple
34
+ [@window_size]
35
+ end
36
+ def to_msgpack(out = '')
37
+ to_tuple.to_msgpack(out)
38
+ end
39
+ def Config_data.from_tuple(tuple)
40
+ Config_data.new(
41
+ tuple[0]
42
+ )
43
+ end
44
+ attr_accessor :window_size
45
+ end
46
+
47
+ end
48
+
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jubatus
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Jubatus Team
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-07-20 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: msgpack-rpc
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ hash: 5
29
+ segments:
30
+ - 0
31
+ - 4
32
+ - 5
33
+ version: 0.4.5
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: rake
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 63
45
+ segments:
46
+ - 0
47
+ - 9
48
+ - 2
49
+ version: 0.9.2
50
+ type: :development
51
+ version_requirements: *id002
52
+ description: Jubatus client for Ruby
53
+ email: jubatus@googlegroups.com
54
+ executables: []
55
+
56
+ extensions: []
57
+
58
+ extra_rdoc_files: []
59
+
60
+ files:
61
+ - .gitignore
62
+ - LICENSE
63
+ - README.md
64
+ - Rakefile
65
+ - VERSION
66
+ - jubatus.gemspec
67
+ - lib/jubatus/classifier/client.rb
68
+ - lib/jubatus/classifier/types.rb
69
+ - lib/jubatus/graph/client.rb
70
+ - lib/jubatus/graph/types.rb
71
+ - lib/jubatus/recommender/client.rb
72
+ - lib/jubatus/recommender/types.rb
73
+ - lib/jubatus/regression/client.rb
74
+ - lib/jubatus/regression/types.rb
75
+ - lib/jubatus/stat/client.rb
76
+ - lib/jubatus/stat/types.rb
77
+ homepage: https://github.com/jubatus/jubatus-ruby-client
78
+ licenses: []
79
+
80
+ post_install_message:
81
+ rdoc_options: []
82
+
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ hash: 3
91
+ segments:
92
+ - 0
93
+ version: "0"
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ hash: 3
100
+ segments:
101
+ - 0
102
+ version: "0"
103
+ requirements: []
104
+
105
+ rubyforge_project:
106
+ rubygems_version: 1.8.11
107
+ signing_key:
108
+ specification_version: 3
109
+ summary: Jubatus client for Ruby
110
+ test_files: []
111
+