summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Maunz <andreas@maunz.de>2011-06-24 14:57:02 +0200
committerAndreas Maunz <andreas@maunz.de>2011-06-24 14:57:02 +0200
commitf9721059cb28c23c10e83dafe7aa58d9cf650746 (patch)
tree0cbc493757e058a66ae5894ec199b9f3fd00a18b
parent310500f4d61f92de713577e7a09e9536ff6e7c42 (diff)
Fixed SVM predictions
-rw-r--r--lib/algorithm.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/algorithm.rb b/lib/algorithm.rb
index 75252c2..1f0ef2a 100644
--- a/lib/algorithm.rb
+++ b/lib/algorithm.rb
@@ -222,7 +222,8 @@ module OpenTox
acts = neighbors.collect do |n|
act = n[:activity]
end # activities of neighbors for supervised learning
- acts_f = acts.collect {|v| v == true ? 1.0 : 0.0}
+# acts_f = acts.collect {|v| v == true ? 1.0 : 0.0}
+ acts_f = acts
sims = neighbors.collect{ |n| Algorithm.gauss(n[:similarity]) } # similarity values btwn q and nbors
begin
prediction = (props.nil? ? local_svm(neighbors, acts_f, sims, "C-bsvc", params) : local_svm_prop(props, acts_f, "C-bsvc", params))
@@ -300,7 +301,8 @@ module OpenTox
if type == "nu-svr"
prediction = @r.p
elsif type == "C-bsvc"
- prediction = (@r.p.to_f == 1.0 ? true : false)
+ #prediction = (@r.p.to_f == 1.0 ? true : false)
+ prediction = @r.p
end
@r.quit # free R
rescue Exception => e
@@ -374,7 +376,8 @@ module OpenTox
if type == "nu-svr"
prediction = @r.p
elsif type == "C-bsvc"
- prediction = (@r.p.to_f == 1.0 ? true : false)
+ #prediction = (@r.p.to_f == 1.0 ? true : false)
+ prediction = @r.p
end
@r.quit # free R
rescue Exception => e