本文整理汇总了Java中com.rapidminer.operator.IOObject类的典型用法代码示例。如果您正苦于以下问题:Java IOObject类的具体用法?Java IOObject怎么用?Java IOObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IOObject类属于com.rapidminer.operator包,在下文中一共展示了IOObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convert
import com.rapidminer.operator.IOObject; //导入依赖的package包/类
public IOObject convert(ConnectionEntry connection, TableName tableName) throws OperatorException {
DatabaseDataReader reader;
try {
AttributeStore attributeStore = AttributeStoreFactory.getAttributeStore(connection);
reader = (DatabaseDataReader)OperatorService.createOperator(DatabaseDataReader.class);
reader.setAttributeStore(attributeStore);
reader.setTable(tableName.getTableName());
} catch (OperatorCreationException var5) {
throw new OperatorException("Failed to create database reader: " + var5, var5);
}
reader.setParameter("connection", connection.getName());
reader.setParameter("define_connection", DatabaseHandler.CONNECTION_MODES[0]);
reader.setParameter("table_name", tableName.getTableName());
if(tableName.getSchema() != null) {
reader.setParameter("use_default_schema", String.valueOf(false));
reader.setParameter("schema_name", tableName.getSchema());
}
reader.setParameter("define_query", DatabaseHandler.QUERY_MODES[2]);
return reader.read();
}
示例2: assertEquals
import com.rapidminer.operator.IOObject; //导入依赖的package包/类
/**
* Tests if both list of ioobjects are equal.
*
* @param expected
* expected value
* @param actual
* actual value
*/
public static void assertEquals(String message, List<IOObject> expected, List<IOObject> actual) {
assertSize(expected, actual);
Iterator<IOObject> expectedIter = expected.iterator();
Iterator<IOObject> actualIter = actual.iterator();
int objectIndex = 1;
while (expectedIter.hasNext() && actualIter.hasNext()) {
IOObject expectedIOO = expectedIter.next();
IOObject actualIOO = actualIter.next();
String subMessage = message + " IOObject \"" + actualIOO.getSource() + "\" at position " + objectIndex
+ " does not match the expected value ";
assertEquals(subMessage, expectedIOO, actualIOO);
objectIndex++;
}
}
示例3: doWork
import com.rapidminer.operator.IOObject; //导入依赖的package包/类
@Override
public void doWork() throws OperatorException {
ExampleSet eSet = trainingSetInput.getData(ExampleSet.class);
estimatePerformance(eSet);
// Generate complete model, if desired
if (modelOutput.isConnected()) {
learnFinalModel(eSet);
modelOutput.deliver(trainingProcessModelInput.getData(IOObject.class));
}
exampleSetOutput.deliver(eSet);
// set last result for plotting purposes. This is an average value and
// actually not the last performance value!
boolean success = false;
for (IOObject result : applyProcessPerformancePortExtender.getOutputData(IOObject.class)) {
if (result instanceof PerformanceVector) {
setResult((PerformanceVector) result);
success = true;
break;
}
}
if (!success) {
getLogger().warning("No performance vector found among averagable results. Performance will not be loggable.");
}
}
示例4: evaluate
import com.rapidminer.operator.IOObject; //导入依赖的package包/类
/**
* Applies the applier and evaluator (= second subprocess). In order to reuse possibly created
* predicted label attributes, we do the following: We compare the predicted label of
* <code>testSet</code> before and after applying the inner operator. If it changed, the
* predicted label is removed again. No outer operator could ever see it. The same applies for
* the confidence attributes in case of classification learning.
*/
protected final void evaluate(ExampleSet testSet) throws OperatorException {
Attribute predictedBefore = testSet.getAttributes().getPredictedLabel();
applyProcessExampleSetOutput.deliver(testSet);
applyProcessModelOutput.deliver(trainingProcessModelInput.getData(IOObject.class));
throughExtender.passDataThrough();
executeEvaluator();
Tools.buildAverages(applyProcessPerformancePortExtender);
Attribute predictedAfter = testSet.getAttributes().getPredictedLabel();
// remove predicted label and confidence attributes if there is a new prediction which is
// not equal to an old one
if (predictedAfter != null
&& (predictedBefore == null || predictedBefore.getTableIndex() != predictedAfter.getTableIndex())) {
PredictionModel.removePredictedLabel(testSet);
}
}
示例5: createIOObjectEntry
import com.rapidminer.operator.IOObject; //导入依赖的package包/类
@Override
public IOObjectEntry createIOObjectEntry(String name, IOObject ioobject, Operator callingOperator, ProgressListener l)
throws RepositoryException {
// check for possible invalid name
if (!RepositoryLocation.isNameValid(name)) {
throw new RepositoryException(I18N.getMessage(I18N.getErrorBundle(), "repository.illegal_entry_name", name,
getLocation()));
}
ensureLoaded();
IOObjectEntry entry = new SimpleIOObjectEntry(name, this, getRepository());
data.add(entry);
if (ioobject != null) {
entry.storeData(ioobject, null, l);
}
getRepository().fireEntryAdded(entry, this);
return entry;
}
示例6: getIconNameForType
import com.rapidminer.operator.IOObject; //导入依赖的package包/类
/**
*
* Searches for a class with the given name and returns the path of the resource.
*
* @param clazz
* the class as Class.
* @return the path of the resource of the corresponding icon.
*/
private static String getIconNameForType(Class<? extends IOObject> clazz) {
String iconName;
String path = null;
Class<? extends IOObject> typeClass;
typeClass = clazz;
iconName = RendererService.getIconName(typeClass);
if (iconName == null) {
iconName = "plug.png";
}
try {
path = SwingTools.getIconPath("24/" + iconName);
} catch (Exception e) {
LogService.getRoot().finer("Error retrieving icon for type '" + clazz + "'! Reason: " + e.getLocalizedMessage());
}
return path;
}
示例7: doWork
import com.rapidminer.operator.IOObject; //导入依赖的package包/类
@Override
public void doWork() throws OperatorException {
getProgress().setIndeterminate(true);
ExampleSet originalExampleSet = exampleSetInput.getData(ExampleSet.class);
double fraction = getParameterAsDouble(PARAMETER_FRACTION);
if (fraction < 0 || fraction > 1.0) {
throw new UserError(this, 207, new Object[] { fraction, "fraction",
"Cannot use fractions of less than 0.0 or more than 1.0" });
}
SplittedExampleSet splitted = new SplittedExampleSet(originalExampleSet, fraction,
getParameterAsInt(PARAMETER_SAMPLING_TYPE),
getParameterAsBoolean(RandomGenerator.PARAMETER_USE_LOCAL_RANDOM_SEED),
getParameterAsInt(RandomGenerator.PARAMETER_LOCAL_RANDOM_SEED));
splitted.selectSingleSubset(0);
exampleSubsetInnerSource.deliver(splitted);
getSubprocess(0).execute();
modelOutput.deliver(modelInnerSink.getData(IOObject.class));
}
示例8: getIconData
import com.rapidminer.operator.IOObject; //导入依赖的package包/类
private static IconData getIconData(Class<? extends IOObject> objectClass) {
if (objectClass == null) {
return ICON_DEFAULT;
}
IconData icon = class2IconMap.get(objectClass);
if (icon == null) {
for (Entry<Class<? extends IOObject>, IconData> renderableClassEntry : class2IconMap.entrySet()) {
if (renderableClassEntry.getKey().isAssignableFrom(objectClass)) {
class2IconMap.put(objectClass, renderableClassEntry.getValue());
return renderableClassEntry.getValue();
}
}
return ICON_DEFAULT;
}
return icon;
}
示例9: deliver
import com.rapidminer.operator.IOObject; //导入依赖的package包/类
public void deliver(List<? extends IOObject> inputs) {
int i = 0;
for (OutputPort port : getManagedPorts()) {
if (port.isConnected()) {
if (i >= inputs.size()) {
getPorts().getOwner().getOperator().getLogger().fine("Insufficient input for " + port.getSpec());
} else {
IOObject input = inputs.get(i);
port.deliver(input);
if (input != null) {
String name;
if (input instanceof ResultObject) {
name = ((ResultObject) input).getName();
} else {
name = input.getClass().getName();
}
if (input.getSource() != null) {
name += " (" + input.getSource() + ")";
}
getPorts().getOwner().getOperator().getLogger().fine("Delivering " + name + " to " + port.getSpec());
}
}
i++;
}
}
}
示例10: getData
import com.rapidminer.operator.IOObject; //导入依赖的package包/类
/**
* Returns a list of non-null data of all input ports.
*
* @param unfold
* If true, collections are added as individual objects rather than as a collection.
* The unfolding is done recursively.
* @deprecated use {@link #getData(Class, boolean)}
*/
@Deprecated
@SuppressWarnings("unchecked")
public <T extends IOObject> List<T> getData(boolean unfold) {
List<IOObject> results = new LinkedList<IOObject>();
for (InputPort port : getManagedPorts()) {
IOObject data = port.getAnyDataOrNull();
if (data != null) {
if (unfold && (data instanceof IOObjectCollection)) {
try {
unfold((IOObjectCollection<?>) data, results, IOObject.class, port);
} catch (UserError e) {
throw new RuntimeException(e.getMessage(), e);
}
} else {
results.add(data);
}
}
}
return (List<T>) results;
}
示例11: unfold
import com.rapidminer.operator.IOObject; //导入依赖的package包/类
/**
* @param desiredClass
* method will throw unless all non-collection children are of type desired class
* @param port
* Used for error message only
*/
@SuppressWarnings("unchecked")
private <T extends IOObject> void unfold(IOObjectCollection<?> collection, List<T> results, Class<T> desiredClass,
Port port) throws UserError {
for (IOObject obj : collection.getObjects()) {
if (obj instanceof IOObjectCollection) {
unfold((IOObjectCollection) obj, results, desiredClass, port);
} else {
if (desiredClass.isInstance(obj)) {
results.add((T) obj);
} else {
throw new UserError(getPorts().getOwner().getOperator(), 156, RendererService.getName(obj.getClass()),
port.getName(), RendererService.getName(desiredClass));
}
}
}
}
示例12: showResult
import com.rapidminer.operator.IOObject; //导入依赖的package包/类
/**
* Show result in a new tab.
*/
void showResult() {
if (resultObjects == null) return;
int i = 1;
for(IOObject result: resultObjects) {
if(result instanceof ResultObject) {
String resultName = result instanceof ExampleSet ?
((ResultObject) result).getName() :
RendererService.getName(result.getClass());
String tabName = prunedProcessName + " - " + resultName;
RapidMinerGUI.getMainFrame()
.getRemoteResultDisplay()
.showResultWithName((ResultObject) result, tabName);
i ++;
}
}
}
示例13: getTreeCellRendererComponent
import com.rapidminer.operator.IOObject; //导入依赖的package包/类
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf,
int row, boolean hasFocus) {
JLabel label = (JLabel) super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
CollectionTreeElement treeElement = (CollectionTreeElement) value;
IOObject ioobject = treeElement.getIOObject();
if (ioobject instanceof ResultObject) {
ResultObject ro = (ResultObject) ioobject;
String name = childNames.get(ro);
if (name == null) {
name = ro.getName();
}
String source = ro.getSource() != null ? " (<small>" + ro.getSource() + "</small>)" : "";
label.setText("<html>" + name + source + "</html>");
if (ro instanceof IOObjectCollection) {
label.setIcon(expanded ? ICON_FOLDER_OPEN : ICON_FOLDER_CLOSED);
} else {
Icon resultIcon = ro.getResultIcon();
label.setIcon(resultIcon);
}
} else if (ioobject instanceof IOObject) {
IOObject ioo = ioobject;
label.setText(ioo.getClass().getSimpleName());
}
return label;
}
示例14: createMetaDataforIOObject
import com.rapidminer.operator.IOObject; //导入依赖的package包/类
public MetaData createMetaDataforIOObject(IOObject ioo, boolean shortened) {
MetaData result;
Class<? extends IOObject> ioObjectClass = ioo.getClass();
Class<? extends MetaData> metaDataClass = ioObjectToMetaDataClass.get(ioObjectClass);
// No MetaData registered for IOObject class
if (metaDataClass == null) {
// look for next registered dominating IOObject class
ioObjectClass = new DominatingClassFinder<IOObject>().findNextDominatingClass(ioo.getClass(),
ioObjectToMetaDataClass.keySet());
// registered dominating IOObject class found
if (ioObjectClass != null) {
metaDataClass = ioObjectToMetaDataClass.get(ioObjectClass);
}
}
result = instantiateMetaData(metaDataClass, ioObjectClass, ioo, shortened);
result.setAnnotations(new Annotations(ioo.getAnnotations()));
return result;
}
示例15: getTypeNameForType
import com.rapidminer.operator.IOObject; //导入依赖的package包/类
/**
* Returns the name of a type in exchange for its class' name.
*
* @param type
* the class' name as String
* @return the short name of the class as String
*/
@SuppressWarnings("unchecked")
public static String getTypeNameForType(String type) {
String typeName = null;
if (type == null || type.isEmpty()) {
typeName = "";
} else {
Class<? extends IOObject> typeClass;
try {
typeClass = (Class<? extends IOObject>) Class.forName(type);
typeName = " (" + RendererService.getName(typeClass) + ")";
} catch (ClassNotFoundException e) {
LogService.getRoot().finer("Failed to lookup class '" + type + "'. Reason: " + e.getLocalizedMessage());
typeName = "";
}
}
return typeName;
}