diff options
author | Andreas Maunz <andreas@maunz.de> | 2011-11-08 13:43:10 +0100 |
---|---|---|
committer | Andreas Maunz <andreas@maunz.de> | 2011-11-08 13:43:10 +0100 |
commit | 7c4e683f6a7d2996456dc09bad446933f072c07a (patch) | |
tree | cff3151a870e483774c8f12d42e41c19aa61da38 | |
parent | 0cf433a84a050c4c2ab782d6e91603dc910c5484 (diff) |
Removed transformer
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | lazar.rb | 20 |
2 files changed, 3 insertions, 19 deletions
@@ -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. @@ -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 |