diff options
Diffstat (limited to 'src/de/lmu/ifi/dbs/elki/workflow')
-rw-r--r-- | src/de/lmu/ifi/dbs/elki/workflow/AlgorithmStep.java | 13 | ||||
-rw-r--r-- | src/de/lmu/ifi/dbs/elki/workflow/EvaluationStep.java | 25 | ||||
-rw-r--r-- | src/de/lmu/ifi/dbs/elki/workflow/LoggingStep.java | 8 |
3 files changed, 35 insertions, 11 deletions
diff --git a/src/de/lmu/ifi/dbs/elki/workflow/AlgorithmStep.java b/src/de/lmu/ifi/dbs/elki/workflow/AlgorithmStep.java index 807f2684..e6788568 100644 --- a/src/de/lmu/ifi/dbs/elki/workflow/AlgorithmStep.java +++ b/src/de/lmu/ifi/dbs/elki/workflow/AlgorithmStep.java @@ -29,6 +29,7 @@ import de.lmu.ifi.dbs.elki.algorithm.Algorithm; import de.lmu.ifi.dbs.elki.database.Database; import de.lmu.ifi.dbs.elki.index.Index; import de.lmu.ifi.dbs.elki.logging.Logging; +import de.lmu.ifi.dbs.elki.logging.LoggingConfiguration; import de.lmu.ifi.dbs.elki.persistent.PageFileStatistics; import de.lmu.ifi.dbs.elki.persistent.PageFileUtil; import de.lmu.ifi.dbs.elki.result.BasicResult; @@ -38,6 +39,7 @@ import de.lmu.ifi.dbs.elki.utilities.FormatUtil; import de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizer; import de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionID; import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.Parameterization; +import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Flag; import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.ObjectListParameter; /** @@ -133,6 +135,11 @@ public class AlgorithmStep implements WorkflowStep { */ public static class Parameterizer extends AbstractParameterizer { /** + * Enable logging of performance data + */ + protected boolean time = false; + + /** * Holds the algorithm to run. */ protected List<Algorithm> algorithms; @@ -140,6 +147,11 @@ public class AlgorithmStep implements WorkflowStep { @Override protected void makeOptions(Parameterization config) { super.makeOptions(config); + // Time parameter + final Flag timeF = new Flag(OptionID.TIME_FLAG); + if(config.grab(timeF)) { + time = timeF.getValue(); + } // parameter algorithm final ObjectListParameter<Algorithm> ALGORITHM_PARAM = new ObjectListParameter<Algorithm>(OptionID.ALGORITHM, Algorithm.class); if(config.grab(ALGORITHM_PARAM)) { @@ -149,6 +161,7 @@ public class AlgorithmStep implements WorkflowStep { @Override protected AlgorithmStep makeInstance() { + LoggingConfiguration.setTime(time); return new AlgorithmStep(algorithms); } } diff --git a/src/de/lmu/ifi/dbs/elki/workflow/EvaluationStep.java b/src/de/lmu/ifi/dbs/elki/workflow/EvaluationStep.java index 65ac83a6..fdc1f201 100644 --- a/src/de/lmu/ifi/dbs/elki/workflow/EvaluationStep.java +++ b/src/de/lmu/ifi/dbs/elki/workflow/EvaluationStep.java @@ -23,9 +23,11 @@ package de.lmu.ifi.dbs.elki.workflow; along with this program. If not, see <http://www.gnu.org/licenses/>. */ +import java.util.ArrayList; import java.util.List; import de.lmu.ifi.dbs.elki.database.Database; +import de.lmu.ifi.dbs.elki.evaluation.AutomaticEvaluation; import de.lmu.ifi.dbs.elki.evaluation.Evaluator; import de.lmu.ifi.dbs.elki.result.HierarchicalResult; import de.lmu.ifi.dbs.elki.result.Result; @@ -67,7 +69,7 @@ public class EvaluationStep implements WorkflowStep { public void runEvaluators(HierarchicalResult r, Database db) { // Run evaluation helpers if(evaluators != null) { - new Evaluation(db, evaluators).update(r); + new Evaluation(r, evaluators).update(r); } this.result = r; } @@ -83,7 +85,7 @@ public class EvaluationStep implements WorkflowStep { /** * Database */ - private Database database; + private HierarchicalResult baseResult; /** * Evaluators to run. @@ -93,14 +95,14 @@ public class EvaluationStep implements WorkflowStep { /** * Constructor. * - * @param database Database + * @param baseResult base result * @param evaluators Evaluators */ - public Evaluation(Database database, List<Evaluator> evaluators) { - this.database = database; + public Evaluation(HierarchicalResult baseResult, List<Evaluator> evaluators) { + this.baseResult = baseResult; this.evaluators = evaluators; - database.getHierarchy().addResultListener(this); + baseResult.getHierarchy().addResultListener(this); } /** @@ -113,7 +115,7 @@ public class EvaluationStep implements WorkflowStep { /* * if(normalizationUndo) { evaluator.setNormalization(normalization); } */ - evaluator.processNewResult(database, r); + evaluator.processNewResult(baseResult, r); } } @@ -154,10 +156,13 @@ public class EvaluationStep implements WorkflowStep { @Override protected void makeOptions(Parameterization config) { super.makeOptions(config); + List<Class<? extends Evaluator>> def = new ArrayList<Class<? extends Evaluator>>(1); + def.add(AutomaticEvaluation.class); // evaluator parameter - final ObjectListParameter<Evaluator> ealuatorP = new ObjectListParameter<Evaluator>(OptionID.EVALUATOR, Evaluator.class, true); - if(config.grab(ealuatorP)) { - evaluators = ealuatorP.instantiateClasses(config); + final ObjectListParameter<Evaluator> evaluatorP = new ObjectListParameter<Evaluator>(OptionID.EVALUATOR, Evaluator.class); + evaluatorP.setDefaultValue(def); + if(config.grab(evaluatorP)) { + evaluators = evaluatorP.instantiateClasses(config); } } diff --git a/src/de/lmu/ifi/dbs/elki/workflow/LoggingStep.java b/src/de/lmu/ifi/dbs/elki/workflow/LoggingStep.java index 1e1a144f..bfe9dba2 100644 --- a/src/de/lmu/ifi/dbs/elki/workflow/LoggingStep.java +++ b/src/de/lmu/ifi/dbs/elki/workflow/LoggingStep.java @@ -92,8 +92,14 @@ public class LoggingStep implements WorkflowStep { * @apiviz.exclude */ public static class Parameterizer extends AbstractParameterizer { + /** + * Verbose mode + */ protected boolean verbose = false; - + + /** + * Enable logging levels manually + */ protected String[][] levels = null; @Override |