scoruby 0.2.10 → 0.2.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +2 -1
- data/Gemfile.lock +1 -1
- data/lib/scoruby/decision.rb +14 -6
- data/lib/scoruby/node.rb +1 -3
- data/lib/scoruby/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 00aa54edc46f55d9595e7f972b2983be9389c269
|
4
|
+
data.tar.gz: 3a191d0e24aa19310106d6eb99b67541e7edd4ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 192cb38df033c13c9dbda5871dd9e88222638912fd1a86cdb1ad530174a1da2c92d94217cab2063579836acdbfb3c0fdd5e28768580484fe0b3d247a1063c11e
|
7
|
+
data.tar.gz: 1f7560f9d42563feea72eaa11e380a30df1e6d02443eda182e2fb4853650da879605ccbb8726936bb00919581244b7ce129c50a354f8098e4b8cc9bb5385eb57
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
data/lib/scoruby/decision.rb
CHANGED
@@ -4,16 +4,24 @@ module Scoruby
|
|
4
4
|
class Decision
|
5
5
|
attr_reader :score, :score_distribution
|
6
6
|
|
7
|
-
def initialize(
|
8
|
-
|
9
|
-
|
7
|
+
def initialize(xml)
|
8
|
+
children = xml.children
|
9
|
+
distributions = children.select { |c| c.name == 'ScoreDistribution' }
|
10
|
+
|
11
|
+
@score = xml.attribute('score').to_s
|
12
|
+
return if distributions.empty?
|
10
13
|
|
11
14
|
@score_distribution = {}
|
12
|
-
|
15
|
+
distributions.each do |score_distribution|
|
13
16
|
value = score_distribution.attributes['value'].to_s
|
14
|
-
|
15
|
-
@score_distribution[value] = probability
|
17
|
+
@score_distribution[value] = probability(score_distribution, xml)
|
16
18
|
end
|
17
19
|
end
|
20
|
+
|
21
|
+
def probability(score_distribution, xml)
|
22
|
+
probability = score_distribution.attributes['probability'].to_s
|
23
|
+
return probability.to_f if probability != ''
|
24
|
+
score_distribution.attributes['recordCount'].to_s.to_f / xml.attributes['recordCount'].to_s.to_f
|
25
|
+
end
|
18
26
|
end
|
19
27
|
end
|
data/lib/scoruby/node.rb
CHANGED
@@ -9,9 +9,7 @@ module Scoruby
|
|
9
9
|
|
10
10
|
def initialize(xml)
|
11
11
|
children = xml.children
|
12
|
-
|
13
|
-
@decision = Decision.new(xml.attribute('score').to_s,
|
14
|
-
distributions)
|
12
|
+
@decision = Decision.new(xml)
|
15
13
|
children = remove_nodes(children)
|
16
14
|
@pred = PredicateFactory.for(children[0])
|
17
15
|
@children = children_nodes(children)
|
data/lib/scoruby/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scoruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Asaf Schers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -169,8 +169,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
169
|
version: '0'
|
170
170
|
requirements: []
|
171
171
|
rubyforge_project:
|
172
|
-
rubygems_version: 2.
|
172
|
+
rubygems_version: 2.2.2
|
173
173
|
signing_key:
|
174
174
|
specification_version: 4
|
175
175
|
summary: Ruby Scoring API for PMML.
|
176
176
|
test_files: []
|
177
|
+
has_rdoc:
|