linefit 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/linefit.rb +2 -2
- metadata +19 -5
data/lib/linefit.rb
CHANGED
@@ -427,7 +427,7 @@ private
|
|
427
427
|
end
|
428
428
|
sumw = numNonZero = 0
|
429
429
|
weights.each do |weight|
|
430
|
-
if
|
430
|
+
if weight < 0
|
431
431
|
puts "Weights must be non-negative numbers!" unless @hush
|
432
432
|
return FALSE
|
433
433
|
end
|
@@ -438,7 +438,7 @@ private
|
|
438
438
|
puts "At least two weights must be nonzero!" unless @hush
|
439
439
|
return FALSE
|
440
440
|
end
|
441
|
-
factor = weights.length / sumw
|
441
|
+
factor = weights.length / sumw.to_f
|
442
442
|
weights.collect! {|weight| weight * factor}
|
443
443
|
@weight = weights
|
444
444
|
return TRUE
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linefit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Eric Cline
|
@@ -30,29 +36,37 @@ files:
|
|
30
36
|
- CHANGELOG
|
31
37
|
has_rdoc: true
|
32
38
|
homepage: http://linefit.rubyforge.org/
|
39
|
+
licenses: []
|
40
|
+
|
33
41
|
post_install_message:
|
34
42
|
rdoc_options: []
|
35
43
|
|
36
44
|
require_paths:
|
37
45
|
- - lib
|
38
46
|
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
39
48
|
requirements:
|
40
49
|
- - ">="
|
41
50
|
- !ruby/object:Gem::Version
|
51
|
+
hash: 3
|
52
|
+
segments:
|
53
|
+
- 0
|
42
54
|
version: "0"
|
43
|
-
version:
|
44
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
45
57
|
requirements:
|
46
58
|
- - ">="
|
47
59
|
- !ruby/object:Gem::Version
|
60
|
+
hash: 3
|
61
|
+
segments:
|
62
|
+
- 0
|
48
63
|
version: "0"
|
49
|
-
version:
|
50
64
|
requirements: []
|
51
65
|
|
52
66
|
rubyforge_project: linefit
|
53
|
-
rubygems_version: 1.3.
|
67
|
+
rubygems_version: 1.3.7
|
54
68
|
signing_key:
|
55
|
-
specification_version:
|
69
|
+
specification_version: 3
|
56
70
|
summary: LineFit is a linear regression math class.
|
57
71
|
test_files: []
|
58
72
|
|