summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Maunz <andreas@maunz.de>2011-11-07 12:57:22 +0100
committerAndreas Maunz <andreas@maunz.de>2011-11-07 12:57:22 +0100
commitdce530c27024faf332f60c1ae0bc67f797336add (patch)
treef26a9b6b44c0ed5ef7253c46c0bb85331f04e422
parent3e57cfd6a551076089462e903823d215a6615e9c (diff)
Init to numeric branch
m---------last-utils0
-rw-r--r--lazar.rb57
m---------libfminer0
3 files changed, 56 insertions, 1 deletions
diff --git a/last-utils b/last-utils
-Subproject 04bd1b73f54bb7422d3c08bb5a81bc02af04f6f
+Subproject 8c02f7e71450cac6d8c5d7d34ecb620046b4ea4
diff --git a/lazar.rb b/lazar.rb
index 9750a56..98734e4 100644
--- a/lazar.rb
+++ b/lazar.rb
@@ -63,6 +63,10 @@ post '/lazar/?' do
lazar = OpenTox::Model::Lazar.new
lazar.min_sim = params[:min_sim].to_f if params[:min_sim]
+
+
+
+ # AM: Manage endpoint related variables.
if prediction_feature.feature_type == "classification"
@training_classes = training_activities.accept_values(prediction_feature.uri).sort
@training_classes.each_with_index { |c,i|
@@ -82,9 +86,23 @@ post '/lazar/?' do
end
params[:nr_hits] = "true" if lazar.nr_hits
+
+
+
+
+
task.progress 10
- if params[:feature_dataset_uri]
+
+
+
+ #
+ # AM: features
+ #
+ #
+
+ # READ OR CREATE
+ if params[:feature_dataset_uri]
feature_dataset_uri = params[:feature_dataset_uri]
training_features = OpenTox::Dataset.new(feature_dataset_uri)
case training_features.feature_type(@subjectid)
@@ -109,6 +127,9 @@ post '/lazar/?' do
training_features = OpenTox::Dataset.new(feature_dataset_uri)
end
+
+
+ # WRITE IN MODEL
training_features.load_all(@subjectid)
raise OpenTox::NotFoundError.new "Dataset #{feature_dataset_uri} not found." if training_features.nil?
@@ -119,6 +140,8 @@ post '/lazar/?' do
training_features.data_entries.each do |compound,entry|
lazar.fingerprints[compound] = {} unless lazar.fingerprints[compound]
entry.keys.each do |feature|
+
+ # CASE 1: Substructure
if lazar.feature_calculation_algorithm == "Substructure.match"
if training_features.features[feature]
smarts = training_features.features[feature][OT.smarts]
@@ -134,6 +157,8 @@ post '/lazar/?' do
lazar.effects[smarts] = training_features.features[feature][OT.effect]
end
end
+
+ # CASE 2: Others
else
case training_features.feature_type(@subjectid)
when "classification"
@@ -159,6 +184,15 @@ post '/lazar/?' do
end
task.progress 80
+
+
+
+ #
+ # AM: SETTINGS
+ #
+ #
+ #
+
# AM: allow settings override by user
lazar.prediction_algorithm = "Neighbors.#{params[:prediction_algorithm]}" unless params[:prediction_algorithm].nil?
if prediction_feature.feature_type == "regression"
@@ -169,6 +203,19 @@ post '/lazar/?' do
lazar.conf_stdev = false
lazar.conf_stdev = true if params[:conf_stdev] == "true"
+
+
+
+
+
+
+
+ #
+ # AM TRANSFORMATIONS
+ #
+ #
+ #
+
# AM: Feed Data using Transformations
if prediction_feature.feature_type == "regression"
transformed_acts = []
@@ -200,6 +247,14 @@ post '/lazar/?' do
end
task.progress 90
+
+
+ #
+ # AM: Metadata
+ #
+ #
+ #
+
lazar.metadata[DC.title] = "lazar model for #{URI.decode(File.basename(prediction_feature.uri))}"
lazar.metadata[OT.dependentVariables] = prediction_feature.uri
lazar.metadata[OT.trainingDataset] = dataset_uri
diff --git a/libfminer b/libfminer
-Subproject 07679a625a7acad864fd3abd80654a1a0a61e69
+Subproject 17932e809c35c93374ed3d5fd19a313325c35b4