Skip to content

Commit

Permalink
Release RapidMiner 7.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rmknopf committed Feb 13, 2017
1 parent 0908488 commit 9f1dd1a
Show file tree
Hide file tree
Showing 11 changed files with 253 additions and 77 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=7.4.0-BETA
version=7.4.0
group=com.rapidminer.studio
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/**
* Copyright (C) 2001-2017 by RapidMiner and the contributors
*
*
* Complete list of developers available at our web site:
*
*
* http://rapidminer.com
*
*
* This program is free software: you can redistribute it and/or modify it under the terms of the
* GNU Affero General Public License as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License along with this program.
* If not, see http://www.gnu.org/licenses/.
*/
*/
package com.rapidminer.example.set;

import com.rapidminer.example.Attribute;
Expand All @@ -25,8 +25,11 @@


/**
* This transformation returns the remapped value.
*
* This transformation returns the remapped value, remapping from the current nominal mapping of the
* attribute to the given {@link #overlayedMapping}. {@link #transform(Attribute, double)} maps the
* given double value to a tranformed value that represents the same nominal value in
* {@link #overlayedMapping} as the given value represents in the current attribute mapping.
*
* @author Ingo Mierswa
*/
public class AttributeTransformationRemapping implements AttributeTransformation {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/**
* Copyright (C) 2001-2017 by RapidMiner and the contributors
*
* Complete list of developers available at our web site:
*
* http://rapidminer.com
*
* This program is free software: you can redistribute it and/or modify it under the terms of the
* GNU Affero General Public License as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License along with this program.
* If not, see http://www.gnu.org/licenses/.
*/
package com.rapidminer.example.set;

import com.rapidminer.example.Attribute;
import com.rapidminer.example.AttributeTransformation;
import com.rapidminer.example.AttributeTypeException;
import com.rapidminer.example.table.NominalMapping;


/**
* This transformation returns the remapped value, remapping from the given {@link #baseMapping} to
* the current mapping of the attribute. {@link #transform(Attribute, double)} maps the given double
* value to a tranformed value that represents the same nominal value in the current attribute
* mapping as the given value represents in the {@link #baseMapping}. This transformation should be
* used if the mapping of an attribute is changed. In that case, use the old mapping as
* {@link #baseMapping} in this transformation.
*
* @author Ingo Mierswa, Gisa Schaefer
* @since 7.4
*/
public class FullAttributeTransformationRemapping implements AttributeTransformation {

private static final long serialVersionUID = 1L;

private NominalMapping baseMapping;

public FullAttributeTransformationRemapping(NominalMapping baseMapping) {
this.baseMapping = baseMapping;
}

public FullAttributeTransformationRemapping(FullAttributeTransformationRemapping other) {
this.baseMapping = (NominalMapping) other.baseMapping.clone();
}

@Override
public Object clone() {
return new FullAttributeTransformationRemapping(this);
}

public void setNominalMapping(NominalMapping mapping) {
this.baseMapping = mapping;
}

@Override
public double transform(Attribute attribute, double value) {
if (Double.isNaN(value)) {
return value;
}
if (attribute.isNominal()) {
try {
String nominalValue = baseMapping.mapIndex((int) value);
int index = attribute.getMapping().getIndex(nominalValue);
if (index < 0) {
return Double.NaN;
} else {
return index;
}
} catch (AttributeTypeException e) {
return Double.NaN;
}
} else {
return value;
}
}

@Override
public double inverseTransform(Attribute attribute, double value) {
if (Double.isNaN(value)) {
return value;
}
if (attribute.isNominal()) {
try {
String nominalValue = attribute.getMapping().mapIndex((int) value);
int newValue = baseMapping.getIndex(nominalValue);
if (newValue < 0) {
return value;
} else {
return newValue;
}
} catch (AttributeTypeException e) {
return value;
}
} else {
return value;
}
}

@Override
public boolean isReversable() {
return true;
}
}
31 changes: 17 additions & 14 deletions src/main/java/com/rapidminer/example/set/RemappedExampleSet.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/**
* Copyright (C) 2001-2017 by RapidMiner and the contributors
*
*
* Complete list of developers available at our web site:
*
*
* http://rapidminer.com
*
*
* This program is free software: you can redistribute it and/or modify it under the terms of the
* GNU Affero General Public License as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License along with this program.
* If not, see http://www.gnu.org/licenses/.
*/
*/
package com.rapidminer.example.set;

import java.util.Iterator;
Expand Down Expand Up @@ -58,11 +58,13 @@ public RemappedExampleSet(ExampleSet parentSet, ExampleSet _mappingSet, boolean
* Sorts the regular attributes of parentSet in the order of mappingSet. If additional
* attributes occur and keepAdditional is {@code true}, they are appended on the end of the
* example set. If transformMappings is {@code true} then mapping indices returned by
* {@link Example#getValue} are remapped to the mappings used in mappingSet.
* {@link Example#getValue} are remapped to the mappings used in mappingSet and the attribute
* mappings are changed to those in mappingSet.
* <p>
* Note that {@link Example#getValueAsString} must never be used on such remapped attributes as
* it permutes the values. Therefore, {@link RemappedExampleSet}s with transformMappings
* {@code true} must not be returned at ports unless those attributes are removed.
* Note that {@link Example#getValueAsString} might not return the same as before the remapping
* but a missing value if not all strings in the old attribute mapping are part of the mapping
* from {@link #mappingSet}. Therefore, {@link RemappedExampleSet}s with transformMappings
* {@code true} should not be returned at ports unless those affected attributes are removed.
*
* @param parentSet
* the example set that should be adjusted to the
Expand All @@ -75,6 +77,7 @@ public RemappedExampleSet(ExampleSet parentSet, ExampleSet _mappingSet, boolean
* if {@code true} an {@link AttributeTransformationRemapping} is added to the
* nominal attributes of the adjusted example set so that {@code example.getValue(a)}
* returns the mapping index according to the mapping of the attribute in mappingSet
* and the nominal mapping of those attributes is adjusted
*/
public RemappedExampleSet(ExampleSet parentSet, ExampleSet mappingSet, boolean keepAdditional,
boolean transformMappings) {
Expand Down Expand Up @@ -118,13 +121,13 @@ public RemappedExampleSet(ExampleSet parentSet, ExampleSet mappingSet, boolean k
AttributeRole role = a.next();
Attribute currentAttribute = role.getAttribute();
if (currentAttribute.isNominal()) {
NominalMapping mapping = null;
mapping = currentAttribute.getMapping();
Attribute oldMappingAttribute = clonedMappingSet.getAttributes().get(role.getAttribute().getName());
if (oldMappingAttribute != null && oldMappingAttribute.isNominal()) {
mapping = oldMappingAttribute.getMapping();
NominalMapping currentMapping = currentAttribute.getMapping();
NominalMapping overlayedMapping = oldMappingAttribute.getMapping();
currentAttribute.setMapping(overlayedMapping);
currentAttribute.addTransformation(new FullAttributeTransformationRemapping(currentMapping));
}
currentAttribute.addTransformation(new AttributeTransformationRemapping(mapping));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.awt.Dialog.ModalityType;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.function.BooleanSupplier;

import javax.swing.JPanel;

Expand Down Expand Up @@ -43,9 +44,10 @@ public void windowClosed(WindowEvent e) {
ParameterService.getParameterValue(RapidMiner.PROPERTY_RAPIDMINER_UPDATE_ADDITIONAL_PERMISSIONS));

if (!permissionsActiveBefore && permissionsActiveNow) {

if (ProductConstraintManager.INSTANCE.isInitialized() && ProductConstraintManager.INSTANCE.getActiveLicense()
.getPrecedence() >= StudioLicenseConstants.UNLIMITED_LICENSE_PRECEDENCE) {
BooleanSupplier isAllowed = () -> ProductConstraintManager.INSTANCE.getActiveLicense()
.getPrecedence() >= StudioLicenseConstants.UNLIMITED_LICENSE_PRECEDENCE
|| ProductConstraintManager.INSTANCE.isTrialLicense();
if (ProductConstraintManager.INSTANCE.isInitialized() && isAllowed.getAsBoolean()) {
ButtonDialog dialog = new ButtonDialogBuilder("additional_permissions")
.setOwner(ApplicationFrame.getApplicationFrame())
.setButtons(DefaultButtons.OK_BUTTON, DefaultButtons.CANCEL_BUTTON)
Expand Down
32 changes: 26 additions & 6 deletions src/main/java/com/rapidminer/operator/GroupedModel.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/**
* Copyright (C) 2001-2017 by RapidMiner and the contributors
*
*
* Complete list of developers available at our web site:
*
*
* http://rapidminer.com
*
*
* This program is free software: you can redistribute it and/or modify it under the terms of the
* GNU Affero General Public License as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License along with this program.
* If not, see http://www.gnu.org/licenses/.
*/
*/
package com.rapidminer.operator;

import java.util.ArrayList;
Expand Down Expand Up @@ -46,10 +46,30 @@ public class GroupedModel extends AbstractModel implements Iterable<Model>, Meta
/** Contains all models. */
private List<Model> models = new ArrayList<Model>();

/**
* @deprecated Using this constructor results in a GroupedModel without a training header
* example set. This can cause NPE in places where the {@link Model} is assumed to
* have a training header set (for example when the model is connected to the
* process result port). Use {@link GroupedModel#GroupedModel(ExampleSet)} instead.
*/
@Deprecated
public GroupedModel() {
super(null);
}

/**
* Creates a GroupedModel with a training header example set. The training header example set
* should correspond to the last (in the order in which the models are added and will be applied
* to the group model) model.
*
* @param exampleSet
* The {@link ExampleSet} from which to create the training header example set
* @since 7.4.0
*/
public GroupedModel(ExampleSet exampleSet) {
super(exampleSet);
}

/** Applies all models. */
@Override
public ExampleSet apply(ExampleSet exampleSet) throws OperatorException {
Expand Down
33 changes: 21 additions & 12 deletions src/main/java/com/rapidminer/operator/ModelGrouper.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
/**
* Copyright (C) 2001-2017 by RapidMiner and the contributors
*
*
* Complete list of developers available at our web site:
*
*
* http://rapidminer.com
*
*
* This program is free software: you can redistribute it and/or modify it under the terms of the
* GNU Affero General Public License as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
*
* You should have received a copy of the GNU Affero General Public License along with this program.
* If not, see http://www.gnu.org/licenses/.
*/
*/
package com.rapidminer.operator;

import java.util.List;

import com.rapidminer.example.ExampleSet;
import com.rapidminer.operator.ports.InputPort;
import com.rapidminer.operator.ports.InputPortExtender;
import com.rapidminer.operator.ports.OutputPort;
Expand All @@ -28,28 +31,26 @@
import com.rapidminer.operator.ports.metadata.Precondition;
import com.rapidminer.operator.ports.metadata.SimplePrecondition;

import java.util.List;


/**
* <p>
* This operator groups all input models together into a grouped (combined) model. This model can be
* completely applied on new data or written into a file as once. This might become useful in cases
* where preprocessing and prediction models should be applied together on new and unseen data.
* </p>
*
*
* <p>
* This operator replaces the automatic model grouping known from previous versions of RapidMiner.
* The explicit usage of this grouping operator gives the user more control about the grouping
* procedure. A grouped model can be ungrouped with the {@link ModelUngrouper} operator.
* </p>
*
*
* <p>
* Please note that the input models will be added in reverse order, i.e. the last created model,
* which is usually the first one at the start of the io object, queue will be added as the last
* model to the combined group model.
* </p>
*
*
* @author Ingo Mierswa, Sebastian Land
*/
public class ModelGrouper extends Operator {
Expand Down Expand Up @@ -95,8 +96,16 @@ public void transformMD() {

@Override
public void doWork() throws OperatorException {
GroupedModel groupedModel = new GroupedModel();
List<Model> modelList = modelInputExtender.getData(Model.class, true);

GroupedModel groupedModel;
if (modelList.size() < 1) {
groupedModel = new GroupedModel(null);
} else {
ExampleSet trainingHeader = modelList.get(modelList.size() - 1).getTrainingHeader();
groupedModel = new GroupedModel(trainingHeader);
}

for (Model model : modelList) {
groupedModel.addModel(model);
}
Expand Down

0 comments on commit 9f1dd1a

Please sign in to comment.