summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--lazar.rb20
2 files changed, 3 insertions, 19 deletions
diff --git a/README.md b/README.md
index dacf1ec..8383cb6 100644
--- a/README.md
+++ b/README.md
@@ -37,7 +37,6 @@ REST operations
[local_svm_kernel=weighted_tanimoto]
[min_sim=0.3]
[nr_hits=false]
- [activity_transform=<Log10 (regression),NOP (classification)>]
[conf_stdev=false]
Synopsis
@@ -47,7 +46,6 @@ Synopsis
- local\_svm\_kernel: One of "weighted\_tanimoto", "propositionalized". local\_svm\_kernel is not appplicable when prediction\_algorithm="weighted\_majority\_vote".
- min_sim: The minimum similarity threshold for neighbors. Numeric value in [0,1].
- nr_hits: Whether for instantiated models (local\_svm\_kernel = "propositionalized" for prediction_algorithm="local\_svm\_classification" or "local\_svm\_regression", or for prediction_algorithm="local\_mlr\_prop") nominal features should be instantiated with their occurrence counts in the instances. For non-instantiated models (local\_svm\_kernel = "weighted\_tanimoto" for prediction_algorithm="local\_svm\_classification" or "local\_svm\_regression", or for prediction_algorithm="weighted\_majority\_vote") the neighbor-to-neighbor and neighbor-to-query similarity also integrates these counts, when the parameter is set. One of "true", "false".
-- activity_transform: Normalizing transformations of the y-values (activities), applicable only to regression problems. One of "Log10", "Inverter", "NOP". "Log10" moves all values above zero and takes the log to base 10. "Inverter" moves all values above 1.0 and takes the inverted value. "NOP" is the identity transformation, which does nothing. Model predictions are output with reverse transformation applied.
- conf_stdev: Whether confidence integrates distribution of neighbor activity values. When "true", the exp(-1.0*(standard deviation of neighbor activities)) is multiplied on the similarity. One of "true", "false".
See http://www.maunz.de/wordpress/opentox/2011/lazar-models-and-how-to-trigger-them for a graphical overview.
diff --git a/lazar.rb b/lazar.rb
index 5ae6c9c..9aac0d8 100644
--- a/lazar.rb
+++ b/lazar.rb
@@ -197,10 +197,6 @@ post '/lazar/?' do
# AM: allow settings override by user
lazar.prediction_algorithm = "Neighbors.#{params[:prediction_algorithm]}" unless params[:prediction_algorithm].nil?
- if prediction_feature.feature_type == "regression"
- lazar.transform["class"] = "Log10" if lazar.transform["class"] == "NOP"
- end
- lazar.transform["class"] = params[:activity_transform] unless params[:activity_transform].nil?
lazar.prop_kernel = true if (params[:local_svm_kernel] == "propositionalized" || params[:prediction_algorithm] == "local_mlr_prop")
lazar.conf_stdev = false
lazar.conf_stdev = true if params[:conf_stdev] == "true"
@@ -210,27 +206,17 @@ post '/lazar/?' do
#
- # AM TRANSFORMATIONS
+ # AM: Feed data
#
#
#
-
- # AM: Feed Data using Transformations
+
if prediction_feature.feature_type == "regression"
- transformed_acts = []
- training_activities.data_entries.each do |compound,entry|
- transformed_acts.concat entry[prediction_feature.uri] unless entry[prediction_feature.uri].empty?
- end
- transformer = eval "OpenTox::Algorithm::Transform::#{lazar.transform["class"]}.new(transformed_acts)"
- transformed_acts = transformer.values
- lazar.transform["offset"] = transformer.offset
- t_count=0
training_activities.data_entries.each do |compound,entry|
lazar.activities[compound] = [] unless lazar.activities[compound]
unless entry[prediction_feature.uri].empty?
entry[prediction_feature.uri].each do |value|
- lazar.activities[compound] << transformed_acts[t_count].to_s
- t_count+=1
+ lazar.activities[compound] << value
end
end
end