Skip to content

Commit

Permalink
Release RapidMiner 8.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Boeck committed Dec 5, 2017
1 parent f50d004 commit 864275d
Show file tree
Hide file tree
Showing 314 changed files with 5,170 additions and 2,023 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}
dependencies {
classpath 'com.rapidminer.gradle:java-basics:0.4.0'
classpath 'com.rapidminer.gradle:java-publishing:0.2.0'
classpath 'com.rapidminer.gradle:java-publishing:0.2.1'
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=7.6.1
version=8.0.0
group=com.rapidminer.studio
234 changes: 126 additions & 108 deletions src/main/java/com/rapidminer/Process.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
import com.rapidminer.operator.ports.InputPort;
import com.rapidminer.operator.ports.OutputPort;
import com.rapidminer.operator.ports.Port;
import com.rapidminer.parameter.UndefinedParameterError;
import com.rapidminer.report.ReportStream;
import com.rapidminer.repository.BlobEntry;
import com.rapidminer.repository.Entry;
Expand Down Expand Up @@ -1191,117 +1192,115 @@ public final IOContainer run(final IOContainer input, final int logVerbosity, fi
*/
public final IOContainer run(final IOContainer input, int logVerbosity, final Map<String, String> macroMap,
final boolean storeOutput) throws OperatorException {
// make sure the process flow filter is registered
ProcessFlowFilter filter = ProcessFlowFilterRegistry.INSTANCE.getProcessFlowFilter();
if (filter != null && !processFlowFilters.contains(filter)) {
addProcessFlowFilter(filter);
}

// make sure licensing constraints are not violated
// iterate over all operators in the process
for (Operator op : rootOperator.getAllInnerOperators()) {
// we only care about enabled operators
if (op.isEnabled()) {

// Check for annotations that constrain access to the current operator
List<LicenseViolation> licenseViolations = ProductConstraintManager.INSTANCE.checkAnnotationViolations(op,
true);
if (!licenseViolations.isEmpty()) {
throw new LicenseViolationException(op, licenseViolations);
}
ActionStatisticsCollector.getInstance().logExecutionStarted();
try {
// make sure the process flow filter is registered
ProcessFlowFilter filter = ProcessFlowFilterRegistry.INSTANCE.getProcessFlowFilter();
if (filter != null && !processFlowFilters.contains(filter)) {
addProcessFlowFilter(filter);
}

// make sure licensing constraints are not violated
// iterate over all operators in the process
for (Operator op : rootOperator.getAllInnerOperators()) {
// we only care about enabled operators
if (op.isEnabled()) {

// Check for annotations that constrain access to the current operator
List<LicenseViolation> licenseViolations = ProductConstraintManager.INSTANCE.checkAnnotationViolations(op,
true);
if (!licenseViolations.isEmpty()) {
throw new LicenseViolationException(op, licenseViolations);
}

// as a side effect mark all enabled operators as dirty
// so it is clear which ones have already been executed
op.makeDirty();
// as a side effect mark all enabled operators as dirty
// so it is clear which ones have already been executed
op.makeDirty();
}
}
}
// fetching process name for logging
String name = null;
if (getProcessLocation() != null) {
name = getProcessLocation().toString();
}

int myVerbosity = rootOperator.getParameterAsInt(ProcessRootOperator.PARAMETER_LOGVERBOSITY);
if (logVerbosity == LogService.UNKNOWN_LEVEL) {
logVerbosity = LogService.OFF;
}
logVerbosity = Math.min(logVerbosity, myVerbosity);
int myVerbosity = rootOperator.getParameterAsInt(ProcessRootOperator.PARAMETER_LOGVERBOSITY);
if (logVerbosity == LogService.UNKNOWN_LEVEL) {
logVerbosity = LogService.OFF;
}
logVerbosity = Math.min(logVerbosity, myVerbosity);

prepareRun(logVerbosity);
prepareRun(logVerbosity);

// apply macros
applyContextMacros();
if (macroMap != null) {
for (Map.Entry<String, String> entry : macroMap.entrySet()) {
getMacroHandler().addMacro(entry.getKey(), entry.getValue());
// apply macros
applyContextMacros();
if (macroMap != null) {
for (Map.Entry<String, String> entry : macroMap.entrySet()) {
getMacroHandler().addMacro(entry.getKey(), entry.getValue());
}
}
}

String logFilename = rootOperator.getParameter(ProcessRootOperator.PARAMETER_LOGFILE);
Handler logHandler = null;
if (logFilename != null) {
try {
logHandler = new FileHandler(logFilename);
logHandler.setFormatter(new SimpleFormatter());
logHandler.setLevel(Level.ALL);
getLogger().config("Logging process to file " + logFilename);
} catch (Exception e) {
getLogger().warning("Cannot create log file '" + logFilename + "': " + e);
Handler logHandler = generateLogHandler();
if (logHandler != null) {
getLogger().addHandler(logHandler);
}
}
if (logHandler != null) {
getLogger().addHandler(logHandler);
}

long start = System.currentTimeMillis();
long start = System.currentTimeMillis();

rootOperator.processStarts();
rootOperator.processStarts();

final int firstInput = input != null ? input.getIOObjects().length : 0;
if (checkForInitialData(firstInput)) {
// load data as specified in process context
ProgressThread pt = new ProgressThread("load_context_data", false) {
final int firstInput = input != null ? input.getIOObjects().length : 0;
if (checkForInitialData(firstInput)) {
// load data as specified in process context
ProgressThread pt = new ProgressThread("load_context_data", false) {

@Override
public void run() {
try {
loadInitialData(firstInput, getProgressListener());
setLastInitException(null);
} catch (ProgressThreadStoppedException ptse) {
// do nothing, it's checked below (pt.isCancelled)
} catch (Exception e) {
setLastInitException(e);
@Override
public void run() {
try {
loadInitialData(firstInput, getProgressListener());
setLastInitException(null);
} catch (ProgressThreadStoppedException ptse) {
// do nothing, it's checked below (pt.isCancelled)
} catch (Exception e) {
setLastInitException(e);
}
}
};
pt.setShowDialogTimerDelay(5000);
pt.setStartDialogShowTimer(true);

pt.startAndWait();
if (lastInitException != null) {
Throwable e = lastInitException;
lastInitException = null;
finishProcess(logHandler);
OperatorException oe;
if (e instanceof OperatorException) {
oe = (OperatorException) e;
} else {
oe = new OperatorException("context_problem_other", e, e.getMessage());
}
throw oe;
}
};
pt.setShowDialogTimerDelay(5000);
pt.setStartDialogShowTimer(true);

pt.startAndWait();
if (lastInitException != null) {
Throwable e = lastInitException;
lastInitException = null;
finishProcess(logHandler);
OperatorException oe;
if (e instanceof OperatorException) {
oe = (OperatorException) e;
} else {
oe = new OperatorException("context_problem_other", e, e.getMessage());
if (pt.isCancelled() || shouldStop()) {
finishProcess(logHandler);
throw new ProcessStoppedException();
}
throw oe;
}
if (pt.isCancelled() || shouldStop()) {
finishProcess(logHandler);
throw new ProcessStoppedException();
}
return execute(input, storeOutput, logHandler, start);
} catch (Exception e) {
ActionStatisticsCollector.getInstance().logExecutionException(this, e);

throw e;
}
}

if (name != null) {
getLogger().info("Process " + name + " starts");
private IOContainer execute(IOContainer input, boolean storeOutput, Handler logHandler, long start) throws OperatorException {
// fetching process name for logging
final String name;
if (getProcessLocation() != null) {
name = getProcessLocation().toString();
getLogger().log(Level.INFO, () -> "Process " + name + " starts");
} else {
getLogger().info("Process starts");
name = null;
getLogger().log(Level.INFO, "Process starts");
}
getLogger().fine("Process:" + Tools.getLineSeparator() + getRootOperator().createProcessTree(3));
getLogger().log(Level.FINE, () -> "Process:" + Tools.getLineSeparator() + getRootOperator().createProcessTree(3));

try {
ActionStatisticsCollector.getInstance().logExecution(this);
Expand All @@ -1316,35 +1315,54 @@ public void run() {
IOContainer result = rootOperator.getResults(isOmittingNullResults());
long end = System.currentTimeMillis();

getLogger().fine("Process:" + Tools.getLineSeparator() + getRootOperator().createProcessTree(3));
getLogger().log(Level.FINE, () -> "Process:" + Tools.getLineSeparator() + getRootOperator().createProcessTree(3));
if (name != null) {
getLogger().info("Process " + name + " finished successfully after " + Tools.formatDuration(end - start));
getLogger().log(Level.INFO, () -> "Process " + name + " finished successfully after " + Tools.formatDuration(end - start));
} else {
getLogger().info("Process finished successfully after " + Tools.formatDuration(end - start));
getLogger().log(Level.INFO, () -> "Process finished successfully after " + Tools.formatDuration(end - start));
}

ActionStatisticsCollector.getInstance().logExecutionSuccess();

return result;
} catch (ProcessStoppedException e) {
Operator op = getOperator(e.getOperatorName());
ActionStatisticsCollector.getInstance().log(op, ActionStatisticsCollector.OPERATOR_EVENT_STOPPED);
throw e;
} catch (UserError e) {
ActionStatisticsCollector.getInstance().log(getCurrentOperator(), ActionStatisticsCollector.OPERATOR_EVENT_FAILURE);
ActionStatisticsCollector.getInstance().log(e.getOperator(), ActionStatisticsCollector.OPERATOR_EVENT_USER_ERROR);
throw e;
} catch (OperatorException e) {
if (e instanceof ProcessStoppedException) {
Operator op = getOperator(((ProcessStoppedException) e).getOperatorName());
ActionStatisticsCollector.getInstance().log(op, ActionStatisticsCollector.OPERATOR_EVENT_STOPPED);
} else {
ActionStatisticsCollector.getInstance().log(getCurrentOperator(),
ActionStatisticsCollector.OPERATOR_EVENT_FAILURE);
if (e instanceof UserError) {
ActionStatisticsCollector.getInstance().log(((UserError) e).getOperator(),
ActionStatisticsCollector.OPERATOR_EVENT_USER_ERROR);
} else {
ActionStatisticsCollector.getInstance().log(getCurrentOperator(),
ActionStatisticsCollector.OPERATOR_EVENT_OPERATOR_EXCEPTION);
}
}
ActionStatisticsCollector.getInstance().log(getCurrentOperator(), ActionStatisticsCollector.OPERATOR_EVENT_FAILURE);
ActionStatisticsCollector.getInstance().log(getCurrentOperator(), ActionStatisticsCollector.OPERATOR_EVENT_OPERATOR_EXCEPTION);
throw e;
} finally {
finishProcess(logHandler);
}
}

/**
* Sets up the {@link Handler}} for the executed process.
*
* @throws UndefinedParameterError
*/
private Handler generateLogHandler() throws UndefinedParameterError {
String logFilename = rootOperator.getParameter(ProcessRootOperator.PARAMETER_LOGFILE);
Handler logHandler = null;
if (logFilename != null) {
try {
logHandler = new FileHandler(logFilename);
logHandler.setFormatter(new SimpleFormatter());
logHandler.setLevel(Level.ALL);
getLogger().log(Level.CONFIG, () -> "Logging process to file " + logFilename);
} catch (Exception e) {
getLogger().warning("Cannot create log file '" + logFilename + "': " + e);
}
}
return logHandler;
}

/** The last thrown exception during context loading */
private Exception lastInitException;

Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/rapidminer/RapidMiner.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
import com.rapidminer.tools.cipher.KeyGeneratorTool;
import com.rapidminer.tools.config.ConfigurationManager;
import com.rapidminer.tools.plugin.Plugin;
import com.rapidminer.tools.usagestats.ActionStatisticsCollector;
import com.rapidminer.tools.usagestats.UsageStatistics;


Expand Down Expand Up @@ -724,6 +725,9 @@ public static void init(final Product product, final LicenseLocation licenseLoca
}
}
UsageStatistics.getInstance(); // initializes as a side effect
ActionStatisticsCollector.getInstance().log(ActionStatisticsCollector.TYPE_CONSTANT, ActionStatisticsCollector.VALUE_CONSTANT_START, null);
ActionStatisticsCollector.getInstance().log(ActionStatisticsCollector.TYPE_CONSTANT, ActionStatisticsCollector.VALUE_MODE, RapidMiner.getExecutionMode().name());
ActionStatisticsCollector.getInstance().startTimer(RapidMiner.class, ActionStatisticsCollector.TYPE_CONSTANT, ActionStatisticsCollector.VALUE_EXECUTION, ActionStatisticsCollector.ARG_RUNTIME);

// registering operators
RapidMiner.splashMessage("register_plugins");
Expand Down Expand Up @@ -963,6 +967,8 @@ private static void runStartupHook(final Runnable runnable) {
}

public synchronized static void quit(final ExitMode exitMode) {
ActionStatisticsCollector.getInstance().stopTimer(RapidMiner.class);

for (Runnable hook : shutdownHooks) {
try {
hook.run();
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/com/rapidminer/example/AttributeWeights.java
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,28 @@ public void normalize() {
}
}

/**
* This method divides each weight by the sum of weights.
*
* @since 8.0
*/
public void relativize() {
double sum = 0;
for (String name : getAttributeNames()) {
double weight = Math.abs(getWeight(name));
sum += weight;
}
Iterator<AttributeWeight> w = weightMap.values().iterator();
while (w.hasNext()) {
AttributeWeight attributeWeight = w.next();
double newWeight = attributeWeight.getWeight();
if (sum != 0.0d) {
newWeight = Math.abs(newWeight) / sum;
}
attributeWeight.setWeight(newWeight);
}
}

public DataTable createDataTable() {
DataTable dataTable = new SimpleDataTable("Attribute Weights", new String[] { "attribute", "weight" });
for (Map.Entry<String, AttributeWeight> entry : weightMap.entrySet()) {
Expand Down

0 comments on commit 864275d

Please sign in to comment.