Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed latestrelease/EvolutionaryTreeMiner-6.15.14-all.zip
Binary file not shown.
Binary file not shown.
Binary file modified latestrelease/EvolutionaryTreeMiner.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion latestrelease/ivy.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ivy-module version="2.0">
<info organisation="prom" module="EvolutionaryTreeMiner" revision="latest">
<description>
Version 6.15.14
Version 6.15.16
</description>
</info>
<configurations>
Expand Down
2 changes: 1 addition & 1 deletion latestrelease/packages.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

<packages>
<package name="EvolutionaryTreeMiner" version="6.15.14" os="all" url="EvolutionaryTreeMiner/EvolutionaryTreeMiner-6.15.14-all.zip" desc="Evolutionary Tree Miner (ETM)" org="Eindhoven University of Technology" license="L-GPL" author="Joos Buijs" auto="false" hasPlugins="true" logo="prom_subtitle_hat_300.png">
<package name="EvolutionaryTreeMiner" version="6.15.16" os="all" url="EvolutionaryTreeMiner/EvolutionaryTreeMiner-6.15.16-all.zip" desc="Evolutionary Tree Miner (ETM)" org="Eindhoven University of Technology" license="L-GPL" author="Joos Buijs" auto="false" hasPlugins="true" logo="prom_subtitle_hat_300.png">
<dependency org="prom" name="ApacheUtils" rev="latest" changing="true" transitive="true" />
<dependency org="prom" name="BasicUtils" rev="latest" changing="true" transitive="true" />
<dependency org="prom" name="Widgets" rev="latest" changing="true" transitive="true" />
Expand Down
37 changes: 35 additions & 2 deletions src/org/processmining/plugins/etm/logging/EvolutionLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ public EvolutionLogger(final PluginContext context, CentralRegistry registry, bo
this(context, registry, fileLoggingEnabled, 1);
}

public EvolutionLogger(final PluginContext context, CentralRegistry registry, boolean fileLoggingEnabled,
int logModulo) {
// Save the statistics log file by adding a timestamp to the filename:-
public EvolutionLogger(final PluginContext context, CentralRegistry registry, boolean fileLoggingEnabled, int logModulo) {
super();

this.context = context;
Expand Down Expand Up @@ -106,6 +106,39 @@ public EvolutionLogger(final PluginContext context, CentralRegistry registry, bo
out.println("Timestamp; Generation; Fittest; Average; Deviation;replayFitness;allMeasures;bestCandidate");
}
}

// Save the statistics log file using the user-provided relative file path (including filename) :-
public EvolutionLogger(final PluginContext context, CentralRegistry registry, boolean fileLoggingEnabled, int logModulo, String logFilePathRelative) {
super();

this.context = context;
this.fileLoggingEnabled = fileLoggingEnabled;
this.registry = registry;
this.logModulo = logModulo;

if (this.fileLoggingEnabled) {
try {
// Make sure the path is treated as relative
String finalPath = "./" + logFilePathRelative.replaceFirst("\\.[^.]*$", "") + ".csv";

File statsFile = new File(finalPath);
File parentDir = statsFile.getParentFile();
if (parentDir != null && !parentDir.exists()) {
parentDir.mkdirs(); // create directories if they don't exist
}

statsFile.setWritable(true);
statsFile.setReadable(true);

fos = new FileOutputStream(statsFile);
out = new PrintWriter(fos);
} catch (Exception e) {
e.printStackTrace();
}
// Write the header
out.println("Timestamp; Generation; Fittest; Average; Deviation;replayFitness;allMeasures;bestCandidate");
}
}

public void disableFileLogging() {
fileLoggingEnabled = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private static void realMinimal() {
EvolutionLogger<NAryTree> logger = new EvolutionLogger<NAryTree>(null, param.getCentralRegistry(), false, 1);
param.addEvolutionObserver(logger);

ProcessTree pt = ETMwithoutGUI.minePTWithParameters(null, log, MiningParameters.getDefaultClassifier(), param);
ProcessTree pt = ETMwithoutGUI.minePTWithParameters(null, log, MiningParameters.getDefaultClassifier(), param, "./Results/experiment.log");

@SuppressWarnings("unused")
CentralRegistry cr = param.getCentralRegistry();
Expand Down
26 changes: 18 additions & 8 deletions src/org/processmining/plugins/etm/ui/plugins/ETMrwithoutGUI.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
package org.processmining.plugins.etm.ui.plugins;

import java.util.ArrayList;
import java.util.List;

import org.deckfour.xes.classification.XEventClassifier;
import org.deckfour.xes.info.impl.XLogInfoImpl;
import org.deckfour.xes.model.XLog;
import org.processmining.framework.plugin.PluginContext;
import org.processmining.framework.plugin.annotations.Plugin;
import org.processmining.framework.plugin.annotations.PluginCategory;
import org.processmining.framework.plugin.annotations.PluginVariant;
import org.processmining.plugins.etm.CentralRegistry;
import org.processmining.plugins.etm.ETM;
import org.processmining.plugins.etm.experiments.StandardLogs;
import org.processmining.plugins.etm.logging.EvolutionLogger;
import org.processmining.plugins.etm.model.narytree.NAryTree;
import org.processmining.plugins.etm.model.narytree.conversion.NAryTreeToProcessTree;
import org.processmining.plugins.etm.model.narytree.conversion.ProcessTreeToNAryTree;
import org.processmining.plugins.etm.parameters.ETMParam;
import org.processmining.plugins.etm.parameters.ETMParamFactory;
import org.processmining.processtree.ProcessTree;
import org.uncommonseditedbyjoosbuijs.watchmaker.framework.EvolutionObserver;

@Plugin(
name = "Mine a Process Tree with ETMr using parameters and classifier",
parameterLabels = { "Process Tree", "Event log", "Classifier", "Parameters"},
parameterLabels = { "Process Tree", "Event log", "Classifier", "Parameters", "Log File Path Relative"},
returnLabels = { "Process Tree" },
returnTypes = { ProcessTree.class },
userAccessible = true,
Expand All @@ -30,19 +36,17 @@ public class ETMrwithoutGUI {

@PluginVariant(
variantLabel = "Mine a Process Tree with ETMr using default parameters and provided classifier",
requiredParameterLabels = { 0, 1 })
public static ProcessTree minePTWithClassifier(final PluginContext context, ProcessTree processTree, XLog eventlog,
XEventClassifier classifier) {
requiredParameterLabels = { 0, 1, 2, 3 })
public static ProcessTree minePTWithClassifier(final PluginContext context, ProcessTree processTree, XLog eventlog, XEventClassifier classifier, String logFilePathRelative) {
ETMParam param = ETMParamFactory.buildStandardParam(eventlog, context);


return minePTWithParameters(context, processTree, eventlog, classifier, param);
return minePTWithParameters(context, processTree, eventlog, classifier, param, logFilePathRelative);
}

@PluginVariant(
variantLabel = "Mine a Process Tree with ETMr using provided parameters and provided classifier",
requiredParameterLabels = { 0, 1, 2 })
public static ProcessTree minePTWithParameters(final PluginContext context, ProcessTree processTree, XLog eventlog, XEventClassifier classifier, ETMParam param) {
requiredParameterLabels = { 0, 1, 2, 3, 4 })
public static ProcessTree minePTWithParameters(final PluginContext context, ProcessTree processTree, XLog eventlog, XEventClassifier classifier, ETMParam param, String logFilePathRelative) {

//TODO check if this is enough, should be..
param.getCentralRegistry().updateEventClassifier(classifier);
Expand All @@ -52,6 +56,12 @@ public static ProcessTree minePTWithParameters(final PluginContext context, Proc
seed[0] = convertor.convert(processTree);

param.setSeed(seed);
// String logFilePathRelative = "./Results/"

//Add a logger to output to the context
List<EvolutionObserver<NAryTree>> evolutionObservers = new ArrayList<EvolutionObserver<NAryTree>>();
evolutionObservers.add(new EvolutionLogger<NAryTree>(context, param.getCentralRegistry(), true, 1, logFilePathRelative));
param.setEvolutionObservers(evolutionObservers);

ETM etm = new ETM(param);
etm.run();
Expand Down
28 changes: 20 additions & 8 deletions src/org/processmining/plugins/etm/ui/plugins/ETMwithoutGUI.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package org.processmining.plugins.etm.ui.plugins;

import java.util.ArrayList;
import java.util.List;

import org.deckfour.xes.classification.XEventClassifier;
import org.deckfour.xes.info.impl.XLogInfoImpl;
import org.deckfour.xes.model.XLog;
Expand All @@ -9,15 +12,17 @@
import org.processmining.framework.plugin.annotations.PluginVariant;
import org.processmining.plugins.etm.ETM;
import org.processmining.plugins.etm.experiments.StandardLogs;
import org.processmining.plugins.etm.logging.EvolutionLogger;
import org.processmining.plugins.etm.model.narytree.NAryTree;
import org.processmining.plugins.etm.model.narytree.conversion.NAryTreeToProcessTree;
import org.processmining.plugins.etm.parameters.ETMParam;
import org.processmining.plugins.etm.parameters.ETMParamFactory;
import org.processmining.processtree.ProcessTree;
import org.uncommonseditedbyjoosbuijs.watchmaker.framework.EvolutionObserver;

@Plugin(
name = "Mine a Process Tree with ETMd using parameters and classifier",
parameterLabels = { "Event log", "Classifier", "Parameters"},
parameterLabels = { "Event log", "Classifier", "Parameters", "Log File Path Relative"},
returnLabels = { "Process Tree" },
returnTypes = { ProcessTree.class },
userAccessible = true,
Expand All @@ -27,24 +32,31 @@
keywords = {"ETM", "ETMd", "Process Tree", "Evolutionary", "Evolutionary Tree Miner", "Genetic", "Genetic Miner"})
public class ETMwithoutGUI {

private static String logPath= "./Results/testLog.txt";
@PluginVariant(
variantLabel = "Mine a Process Tree with ETMd using default parameters and provided classifier",
requiredParameterLabels = { 0, 1 })
public static ProcessTree minePTWithClassifier(final PluginContext context, XLog eventlog,
XEventClassifier classifier) {
requiredParameterLabels = { 0, 1, 2 })
public static ProcessTree minePTWithClassifier(final PluginContext context, XLog eventlog, XEventClassifier classifier, String logFilePathRelative) {
ETMParam param = ETMParamFactory.buildStandardParam(eventlog, context);

return minePTWithParameters(context, eventlog, classifier, param);
return minePTWithParameters(context, eventlog, classifier, param, logFilePathRelative);
}

@PluginVariant(
variantLabel = "Mine a Process Tree with ETMd using provided parameters and provided classifier",
requiredParameterLabels = { 0, 1, 2 })
public static ProcessTree minePTWithParameters(final PluginContext context, XLog eventlog, XEventClassifier classifier, ETMParam param) {
requiredParameterLabels = { 0, 1, 2, 3 })
public static ProcessTree minePTWithParameters(final PluginContext context, XLog eventlog, XEventClassifier classifier, ETMParam param, String logFilePathRelative) {

//TODO check if this is enough, should be..
param.getCentralRegistry().updateEventClassifier(classifier);

// String logFilePathRelative = "./Results/"

//Add a logger to output to the context
List<EvolutionObserver<NAryTree>> evolutionObservers = new ArrayList<EvolutionObserver<NAryTree>>();
evolutionObservers.add(new EvolutionLogger<NAryTree>(context, param.getCentralRegistry(), true, 1, logFilePathRelative));
param.setEvolutionObservers(evolutionObservers);

ETM etm = new ETM(param);
etm.run();

Expand All @@ -56,7 +68,7 @@ public static ProcessTree minePTWithParameters(final PluginContext context, XLog
}
public static void main(String[] args) {
System.out.println("Starting ETM...");
ProcessTree pt = ETMwithoutGUI.minePTWithClassifier(null, StandardLogs.createTestLog(), XLogInfoImpl.NAME_CLASSIFIER);
ProcessTree pt = ETMwithoutGUI.minePTWithClassifier(null, StandardLogs.createTestLog(), XLogInfoImpl.NAME_CLASSIFIER, logPath);
System.out.println(pt.toString());
}
}