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 CHANGED
@@ -1,3 +1,4 @@
1
+ lib/
1
2
  *.gem
2
3
  *.rbc
3
4
  .bundle
@@ -11,6 +12,8 @@ spec/reports
11
12
  test/tmp
12
13
  test/version_tmp
13
14
  tmp
15
+ *.model.js
16
+ *.json
14
17
 
15
18
  # YARD artifacts
16
19
  .yardoc
data/LICENSE CHANGED
@@ -1,23 +1,7 @@
1
- Copyright (c) 2012, Jubatus Team All rights reserved.
1
+ Copyright (c) 2012 NTT Corporation & Preferred Infrastructure.
2
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.
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
13
4
 
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.
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,22 @@
1
+ Jubatus Ruby Client
2
+ ===================
3
+
4
+ Template of Jubatus client in Ruby.
5
+ See `RubyGems <http://rubygems.org/gems/jubatus>`_ for the latest release.
6
+
7
+ All codes are generated by `MessagePack IDL <https://github.com/msgpack/msgpack-haskell/tree/master/msgpack-idl>`_ .
8
+
9
+
10
+ Install
11
+ =======
12
+
13
+ ::
14
+
15
+ $ gem install jubatus
16
+
17
+
18
+ License
19
+ =======
20
+
21
+ MIT License
22
+
data/Rakefile CHANGED
@@ -1,17 +1,22 @@
1
+ require 'rubygems'
1
2
  require 'bundler'
2
- Bundler::GemHelper.install_tasks
3
-
3
+ require 'simplecov' # for Ruby 1.9
4
4
  require 'rake/testtask'
5
+ #require 'ci/reporter/rake/test_unit'
5
6
 
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
7
+ Bundler::GemHelper.install_tasks
11
8
 
12
- task :coverage do |t|
13
- ENV['SIMPLE_COV'] = '1'
14
- Rake::Task["test"].invoke
9
+ task :test do |test|
10
+ Rake::TestTask.new(:test) do |t|
11
+ t.libs << 'lib' << 'test'
12
+ t.test_files = FileList['test/**/*.rb']
13
+ t.verbose = true
14
+ end
15
15
  end
16
16
 
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
+
17
22
  task :default => [:build]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.4.0
@@ -0,0 +1,31 @@
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}"
@@ -3,19 +3,23 @@ $:.push File.expand_path('../lib', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
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
6
+ gem.description = "Jubatus is a distributed processing framework and streaming machine learning library. This is the Jubatus client in Ruby."
7
+ gem.homepage = "http://jubat.us"
8
+ gem.summary = "Jubatus Ruby client"
9
9
  gem.version = File.read("VERSION").strip
10
- gem.authors = ["Jubatus Team"]
10
+ gem.authors = ["PFI & NTT"]
11
11
  gem.email = "jubatus@googlegroups.com"
12
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) }
13
+ gem.license = "MIT"
14
+
15
+ files = `git ls-files`.split("\n")
16
+ excludes = ["patch/*"]
17
+
18
+ gem.files = files.reject { |f| excludes.any? { |e| File.fnmatch(e, f) } }
19
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
20
+ gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
17
21
  gem.require_paths = ['lib']
18
22
 
19
- gem.add_dependency "msgpack-rpc", "~> 0.4.5"
23
+ gem.add_dependency "msgpack-rpc", "~> 0.5.1"
20
24
  gem.add_development_dependency "rake", ">= 0.9.2"
21
25
  end
@@ -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//classifier.idl
1
+ # This file is auto-generated from jubatus-generate/src/server/classifier.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 Classifier
30
10
  module Client
31
11
 
32
12
  class Classifier
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
- Config_data.from_tuple(@cli.call(:get_config, name))
17
+ @cli.call(:get_config, name)
41
18
  end
42
19
  def train(name, data)
43
20
  @cli.call(:train, name, data)
@@ -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//classifier.idl
1
+ # This file is auto-generated from jubatus-generate/src/server/classifier.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 Classifier
58
8
 
59
9
  class Datum
60
10
  def initialize(string_values, num_values)
@@ -78,13 +28,13 @@ class Datum
78
28
  end
79
29
 
80
30
  class Estimate_result
81
- def initialize(label, prob)
31
+ def initialize(label, score)
82
32
  @label = label
83
- @prob = prob
33
+ @score = score
84
34
  end
85
35
  def to_tuple
86
36
  [@label,
87
- @prob]
37
+ @score]
88
38
  end
89
39
  def to_msgpack(out = '')
90
40
  to_tuple.to_msgpack(out)
@@ -95,8 +45,9 @@ class Estimate_result
95
45
  tuple[1]
96
46
  )
97
47
  end
98
- attr_accessor :label, :prob
48
+ attr_accessor :label, :score
99
49
  end
100
50
 
101
51
  end
52
+ end
102
53
 
@@ -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'
@@ -27,47 +6,51 @@ require 'msgpack/rpc'
27
6
  require File.join(File.dirname(__FILE__), 'types')
28
7
 
29
8
  module Jubatus
9
+ module Graph
30
10
  module Client
31
11
 
32
12
  class Graph
33
13
  def initialize(host, port)
34
14
  @cli = MessagePack::RPC::Client.new(host, port)
35
15
  end
16
+ def get_config(name)
17
+ @cli.call(:get_config, name)
18
+ end
36
19
  def create_node(name)
37
20
  @cli.call(:create_node, name)
38
21
  end
39
- def remove_node(name, nid)
40
- @cli.call(:remove_node, name, nid)
22
+ def remove_node(name, node_id)
23
+ @cli.call(:remove_node, name, node_id)
41
24
  end
42
- def update_node(name, nid, p)
43
- @cli.call(:update_node, name, nid, p)
25
+ def update_node(name, node_id, property)
26
+ @cli.call(:update_node, name, node_id, property)
44
27
  end
45
- def create_edge(name, nid, ei)
46
- @cli.call(:create_edge, name, nid, ei)
28
+ def create_edge(name, node_id, e)
29
+ @cli.call(:create_edge, name, node_id, e)
47
30
  end
48
- def update_edge(name, nid, eid, ei)
49
- @cli.call(:update_edge, name, nid, eid, ei)
31
+ def update_edge(name, node_id, edge_id, e)
32
+ @cli.call(:update_edge, name, node_id, edge_id, e)
50
33
  end
51
- def remove_edge(name, nid, e)
52
- @cli.call(:remove_edge, name, nid, e)
34
+ def remove_edge(name, node_id, edge_id)
35
+ @cli.call(:remove_edge, name, node_id, edge_id)
53
36
  end
54
- def centrality(name, nid, ct, q)
55
- @cli.call(:centrality, name, nid, ct, q)
37
+ def get_centrality(name, node_id, centrality_type, query)
38
+ @cli.call(:get_centrality, name, node_id, centrality_type, query)
56
39
  end
57
- def add_centrality_query(name, q)
58
- @cli.call(:add_centrality_query, name, q)
40
+ def add_centrality_query(name, query)
41
+ @cli.call(:add_centrality_query, name, query)
59
42
  end
60
- def add_shortest_path_query(name, q)
61
- @cli.call(:add_shortest_path_query, name, q)
43
+ def add_shortest_path_query(name, query)
44
+ @cli.call(:add_shortest_path_query, name, query)
62
45
  end
63
- def remove_centrality_query(name, q)
64
- @cli.call(:remove_centrality_query, name, q)
46
+ def remove_centrality_query(name, query)
47
+ @cli.call(:remove_centrality_query, name, query)
65
48
  end
66
- def remove_shortest_path_query(name, q)
67
- @cli.call(:remove_shortest_path_query, name, q)
49
+ def remove_shortest_path_query(name, query)
50
+ @cli.call(:remove_shortest_path_query, name, query)
68
51
  end
69
- def shortest_path(name, r)
70
- @cli.call(:shortest_path, name, r)
52
+ def get_shortest_path(name, query)
53
+ @cli.call(:get_shortest_path, name, query)
71
54
  end
72
55
  def update_index(name)
73
56
  @cli.call(:update_index, name)
@@ -75,34 +58,32 @@ class Graph
75
58
  def clear(name)
76
59
  @cli.call(:clear, name)
77
60
  end
78
- def get_node(name, nid)
79
- Node_info.from_tuple(@cli.call(:get_node, name, nid))
61
+ def get_node(name, node_id)
62
+ Node.from_tuple(@cli.call(:get_node, name, node_id))
80
63
  end
81
- def get_edge(name, nid, e)
82
- Edge_info.from_tuple(@cli.call(:get_edge, name, nid, e))
64
+ def get_edge(name, node_id, edge_id)
65
+ Edge.from_tuple(@cli.call(:get_edge, name, node_id, edge_id))
83
66
  end
84
- def save(name, arg1)
85
- @cli.call(:save, name, arg1)
67
+ def save(name, id)
68
+ @cli.call(:save, name, id)
86
69
  end
87
- def load(name, arg1)
88
- @cli.call(:load, name, arg1)
70
+ def load(name, id)
71
+ @cli.call(:load, name, id)
89
72
  end
90
73
  def get_status(name)
91
74
  @cli.call(:get_status, name)
92
75
  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)
76
+ def create_node_here(name, node_id)
77
+ @cli.call(:create_node_here, name, node_id)
98
78
  end
99
- def remove_global_node(name, nid)
100
- @cli.call(:remove_global_node, name, nid)
79
+ def remove_global_node(name, node_id)
80
+ @cli.call(:remove_global_node, name, node_id)
101
81
  end
102
- def create_edge_here(name, eid, ei)
103
- @cli.call(:create_edge_here, name, eid, ei)
82
+ def create_edge_here(name, edge_id, e)
83
+ @cli.call(:create_edge_here, name, edge_id, e)
104
84
  end
105
85
  end
106
86
 
107
87
  end
108
88
  end
89
+ end