summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Maunz <andreas@maunz.de>2011-07-08 14:55:16 +0200
committerAndreas Maunz <andreas@maunz.de>2011-07-08 14:55:16 +0200
commit469605e600f52eb409704a2e8195588a2f99591d (patch)
tree069d8dd22f628a09c4c11bba8cad58fc037cae54
parent624a0eaa13d0c9b14e61b7478cb7f139f08d5ecf (diff)
Added transformation on model creation
-rw-r--r--lazar.rb19
1 files changed, 18 insertions, 1 deletions
diff --git a/lazar.rb b/lazar.rb
index 708fa56..832735b 100644
--- a/lazar.rb
+++ b/lazar.rb
@@ -146,6 +146,22 @@ post '/lazar/?' do
lazar.prop_kernel = true if (params[:local_svm_kernel] == "propositionalized" || params[:prediction_algorithm] == "local_mlr_prop")
lazar.balanced = true if params[:balanced] == "true"
+ # AM: Transformation of Data
+ transform_acts = []
+ if prediction_feature.feature_type == "regression"
+ training_activities.data_entries.each do |compound,entry|
+ unless entry[prediction_feature.uri].empty?
+ entry[prediction_feature.uri].each do |value|
+ transform_acts << value.to_f
+ end
+ end
+ end
+ end
+ inverter = OpenTox::Algorithm::Transform::Inverter.new(transform_acts)
+ transform_acts = inverter.value
+ lazar.transform = inverter
+
+ transform_counts=0
training_activities.data_entries.each do |compound,entry|
lazar.activities[compound] = [] unless lazar.activities[compound]
unless entry[prediction_feature.uri].empty?
@@ -154,8 +170,9 @@ post '/lazar/?' do
lazar.activities[compound] << lazar.value_map.invert[value] # insert mapped values, not originals
elsif prediction_feature.feature_type == "regression"
#never use halt in tasks, do not raise exception when, print warning instead
- lazar.activities[compound] << value.to_f
+ lazar.activities[compound] << transform_acts[transform_counts].to_s
end
+ transform_counts+=1
end
end
end