当前位置: 首页>>代码示例>>Java>>正文


Java GenerationException类代码示例

本文整理汇总了Java中com.rapidminer.generator.GenerationException的典型用法代码示例。如果您正苦于以下问题:Java GenerationException类的具体用法?Java GenerationException怎么用?Java GenerationException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GenerationException类属于com.rapidminer.generator包,在下文中一共展示了GenerationException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addNewMergedAttribute

import com.rapidminer.generator.GenerationException; //导入依赖的package包/类
/**
 * The given list must contain the original attribute names which should be merged by the global
 * FeatureGenerator.
 */
private void addNewMergedAttribute(AttributeWeightedExampleSet es, List<String> mergeList, FeatureGenerator generator)
		throws GenerationException {
	Attribute mergeAttribute = null;
	Iterator<String> i = mergeList.iterator();
	while (i.hasNext()) {
		Attribute currentAttribute = es.getAttributes().getRegular(i.next());
		if (mergeAttribute == null) {
			mergeAttribute = currentAttribute;
		} else {
			generator = generator.newInstance();
			Attribute[] args = new Attribute[] { mergeAttribute, currentAttribute };
			generator.setArguments(args);
			List<FeatureGenerator> generatorList = new LinkedList<FeatureGenerator>();
			generatorList.add(generator);
			List<Attribute> newAttributes = FeatureGenerator.generateAll(es.getExampleTable(), generatorList);
			mergeAttribute = newAttributes.get(0);
		}
	}
	es.getAttributes().addRegular(mergeAttribute);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:25,代码来源:AggregationIndividual.java

示例2: startVisualization

import com.rapidminer.generator.GenerationException; //导入依赖的package包/类
@Override
public void startVisualization(Object id) {
	int index = 0;
	if (id instanceof String) {
		String idString = (String) id;
		index = Integer.parseInt(idString.substring(0, idString.indexOf("(")).trim());
	} else {
		index = ((Double) id).intValue();
	}
	AggregationIndividual individual = lastPopulation.get(index);
	ExampleSet es = null;
	try {
		es = individual.createExampleSet(originalExampleSet, allAttributes, generator);
	} catch (GenerationException e) {
		throw new RuntimeException("Cannot visualize individual '" + index + "': " + e.getMessage());
	}
	Component visualizationComponent = ResultDisplayTools.createVisualizationComponent(es, null, es.getName());
	JFrame frame = new JFrame();
	frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
	frame.getContentPane().setLayout(new BorderLayout());
	frame.getContentPane().add(new ExtendedJScrollPane(visualizationComponent), BorderLayout.CENTER);
	frame.setSize(600, 400);
	frame.setLocationRelativeTo(null);
	frame.setVisible(true);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:26,代码来源:AggregationPopulationPlotter.java

示例3: operate

import com.rapidminer.generator.GenerationException; //导入依赖的package包/类
/**
 * Performs one of the following three mutations:
 * <ul>
 * <li>add a newly generated attribute</li>
 * <li>add an original attribute</li>
 * <li>remove an attribute</li>
 * </ul>
 */
@Override
public List<ExampleSetBasedIndividual> operate(ExampleSetBasedIndividual individual) throws Exception {
	LinkedList<ExampleSetBasedIndividual> l = new LinkedList<ExampleSetBasedIndividual>();
	AttributeWeightedExampleSet clone = (AttributeWeightedExampleSet) individual.getExampleSet().clone();

	try {
		int numberOriginal = addOriginalAttribute(clone);
		int numberCreated = addGeneratedAttribute(clone);
		deselect(clone, numberOriginal + numberCreated);
	} catch (GenerationException e) {
		individual
				.getExampleSet()
				.getLog()
				.logWarning(
						"GeneratingMutation: Exception occured during generation of attributes, using only original example set instead.");
	}

	if (clone.getNumberOfUsedAttributes() > 0) {
		l.add(new ExampleSetBasedIndividual(clone));
	}
	l.add(individual);
	return l;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:32,代码来源:FourierGeneratingMutation.java

示例4: addOriginalAttribute

import com.rapidminer.generator.GenerationException; //导入依赖的package包/类
private int addOriginalAttribute(AttributeWeightedExampleSet exampleSet) throws GenerationException, OperatorException {
	int counter = 0;
	for (int k = 0; k < numberOfOriginal; k++) {
		if (random.nextDouble() < p) {
			int i = random.nextInt(originalAttributes.size());
			Attribute originalAttribute = originalAttributes.get(i);
			if (exampleSet.getAttributes().getRegular(originalAttribute.getName()) == null) {
				exampleSet.getAttributes().addRegular(originalAttribute);
				counter++;
			}

			// add sinus functions of the original attribute
			List<AttributePeak> peaks = factory.getAttributePeaks(exampleSet, exampleSet.getAttributes().getLabel(),
					originalAttribute);
			if (peaks.size() > 0) {
				factory.generateSinusFunctions(exampleSet, peaks, random);
			}
			counter += peaks.size();
		}
	}
	return counter;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:23,代码来源:FourierGeneratingMutation.java

示例5: operate

import com.rapidminer.generator.GenerationException; //导入依赖的package包/类
/**
 * Performs one of the following three mutations:
 * <ul>
 * <li>add a newly generated attribute</li>
 * <li>add an original attribute</li>
 * <li>remove an attribute</li>
 * </ul>
 */
@Override
public List<ExampleSetBasedIndividual> operate(ExampleSetBasedIndividual individual) throws Exception {
	List<ExampleSetBasedIndividual> l = new LinkedList<ExampleSetBasedIndividual>();
	AttributeWeightedExampleSet clone = (AttributeWeightedExampleSet) individual.getExampleSet().clone();

	try {
		addOriginalAttribute(clone);
		addGeneratedAttribute(clone);
		deselect(clone, maxGeneratedAttributes + maxAddedOriginalAttributes);

		if (clone.getNumberOfUsedAttributes() > 0) {
			l.add(new ExampleSetBasedIndividual(clone));
		}
	} catch (GenerationException e) {
		individual
				.getExampleSet()
				.getLog()
				.logWarning(
						"DirectedGGA: Exception occured during generation of attributes, using only original example set instead.");
	}
	l.add(individual);
	return l;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:32,代码来源:DirectedGeneratingMutation.java

示例6: operate

import com.rapidminer.generator.GenerationException; //导入依赖的package包/类
/**
 * Performs one of the following three mutations:
 * <ul>
 * <li>add a newly generated attribute</li>
 * <li>add an original attribute</li>
 * <li>remove an attribute</li>
 * </ul>
 */
@Override
public List<ExampleSetBasedIndividual> operate(ExampleSetBasedIndividual individual) throws Exception {
	LinkedList<ExampleSetBasedIndividual> l = new LinkedList<ExampleSetBasedIndividual>();
	AttributeWeightedExampleSet clone = new AttributeWeightedExampleSet(individual.getExampleSet());

	try {
		int numberOriginal = addOriginalAttribute(clone);
		int numberCreated = addGeneratedAttribute(clone);
		deselect(clone, numberOriginal + numberCreated);
	} catch (GenerationException e) {
		individual
				.getExampleSet()
				.getLog()
				.logWarning(
						"GeneratingMutation: Exception occured during generation of attributes, using only original example set instead.");
	}

	if (clone.getNumberOfUsedAttributes() > 0) {
		l.add(new ExampleSetBasedIndividual(clone));
	}
	l.add(individual);
	return l;
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:32,代码来源:FourierGeneratingMutation.java

示例7: operate

import com.rapidminer.generator.GenerationException; //导入依赖的package包/类
/**
 * Performs one of the following three mutations:
 * <ul>
 * <li>add a newly generated attribute</li>
 * <li>add an original attribute</li>
 * <li>remove an attribute</li>
 * </ul>
 */
@Override
public List<ExampleSetBasedIndividual> operate(ExampleSetBasedIndividual individual) throws Exception {
	List<ExampleSetBasedIndividual> l = new LinkedList<ExampleSetBasedIndividual>();
	AttributeWeightedExampleSet clone = new AttributeWeightedExampleSet(individual.getExampleSet());

	try {
		addOriginalAttribute(clone);
		addGeneratedAttribute(clone);
		deselect(clone, maxGeneratedAttributes + maxAddedOriginalAttributes);

		if (clone.getNumberOfUsedAttributes() > 0) {
			l.add(new ExampleSetBasedIndividual(clone));
		}
	} catch (GenerationException e) {
		individual
				.getExampleSet()
				.getLog()
				.logWarning(
						"DirectedGGA: Exception occured during generation of attributes, using only original example set instead.");
	}
	l.add(individual);
	return l;
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:32,代码来源:DirectedGeneratingMutation.java

示例8: getClosingBracketIndex

import com.rapidminer.generator.GenerationException; //导入依赖的package包/类
private static int getClosingBracketIndex(String string, int startIndex) throws GenerationException {
	int openCount = 1;
	while (true) {
		int nextOpen = string.indexOf("(", startIndex + 1);
		int nextClosing = string.indexOf(")", startIndex + 1);
		if (nextClosing == -1)
			throw new GenerationException("Malformed attribute description: mismatched parantheses");
		if ((nextOpen != -1) && (nextOpen < nextClosing)) {
			openCount++;
			startIndex = nextOpen;
		} else {
			openCount--;
			startIndex = nextClosing;
		}
		if (openCount == 0) {
			return nextClosing;
		}
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:20,代码来源:AttributeParser.java

示例9: addNewMergedAttribute

import com.rapidminer.generator.GenerationException; //导入依赖的package包/类
/**
 * The given list must contain the original attribute names which should be
 * merged by the global FeatureGenerator.
 */
private void addNewMergedAttribute(AttributeWeightedExampleSet es, List<String> mergeList, FeatureGenerator generator) throws GenerationException {
	Attribute mergeAttribute = null;
	Iterator<String> i = mergeList.iterator();
	while (i.hasNext()) {
		Attribute currentAttribute = es.getAttributes().getRegular(i.next());
		if (mergeAttribute == null) {
			mergeAttribute = currentAttribute;
		} else {
			generator = generator.newInstance();
			Attribute[] args = new Attribute[] { mergeAttribute, currentAttribute };
			generator.setArguments(args);
			List<FeatureGenerator> generatorList = new LinkedList<FeatureGenerator>();
			generatorList.add(generator);
			List<Attribute> newAttributes = FeatureGenerator.generateAll(es.getExampleTable(), generatorList);
			mergeAttribute = newAttributes.get(0);
		}
	}
	es.getAttributes().addRegular(mergeAttribute);
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:24,代码来源:AggregationIndividual.java

示例10: startVisualization

import com.rapidminer.generator.GenerationException; //导入依赖的package包/类
public void startVisualization(Object id) {
	int index = 0;
	if (id instanceof String) {
		String idString = (String) id;
		index = Integer.parseInt(idString.substring(0, idString.indexOf("(")).trim());
	} else
		index = ((Double) id).intValue();
	AggregationIndividual individual = lastPopulation.get(index);
	ExampleSet es = null;
	try {
		es = individual.createExampleSet(originalExampleSet, allAttributes, generator);
	} catch (GenerationException e) {
		throw new RuntimeException("Cannot visualize individual '" + index + "': " + e.getMessage());
	}
	Component visualizationComponent = ResultDisplayTools.createVisualizationComponent(es, null, es.getName());
	JFrame frame = new JFrame();
	frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
	frame.getContentPane().setLayout(new BorderLayout());
	frame.getContentPane().add(new ExtendedJScrollPane(visualizationComponent), BorderLayout.CENTER);
	frame.setSize(600, 400);
	frame.setLocationRelativeTo(null);
	frame.setVisible(true);
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:24,代码来源:AggregationPopulationPlotter.java

示例11: operate

import com.rapidminer.generator.GenerationException; //导入依赖的package包/类
/**
 * Performs one of the following three mutations:
 * <ul>
 * <li>add a newly generated attribute</li>
 * <li>add an original attribute</li>
 * <li>remove an attribute</li>
 * </ul>
 */
@Override
public List<ExampleSetBasedIndividual> operate(ExampleSetBasedIndividual individual) throws Exception {
	LinkedList<ExampleSetBasedIndividual> l = new LinkedList<ExampleSetBasedIndividual>();
	AttributeWeightedExampleSet clone = (AttributeWeightedExampleSet) individual.getExampleSet().clone();

	try {
		int numberOriginal = addOriginalAttribute(clone);
		int numberCreated = addGeneratedAttribute(clone);
		deselect(clone, numberOriginal + numberCreated);
	} catch (GenerationException e) {
		individual.getExampleSet().getLog().logWarning("GeneratingMutation: Exception occured during generation of attributes, using only original example set instead.");
	}

	if (clone.getNumberOfUsedAttributes() > 0) {
		l.add(new ExampleSetBasedIndividual(clone));
	}
	l.add(individual);
	return l;
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:28,代码来源:FourierGeneratingMutation.java

示例12: addOriginalAttribute

import com.rapidminer.generator.GenerationException; //导入依赖的package包/类
private int addOriginalAttribute(AttributeWeightedExampleSet exampleSet) throws GenerationException, OperatorException {
	int counter = 0;
	for (int k = 0; k < numberOfOriginal; k++) {
		if (random.nextDouble() < p) {
			int i = random.nextInt(originalAttributes.size());
			Attribute originalAttribute = originalAttributes.get(i);
			if (exampleSet.getAttributes().getRegular(originalAttribute.getName()) == null) {
				exampleSet.getAttributes().addRegular(originalAttribute);
				counter++;
			}

			// add sinus functions of the original attribute
			List<AttributePeak> peaks = factory.getAttributePeaks(exampleSet, exampleSet.getAttributes().getLabel(), originalAttribute);
			if (peaks.size() > 0)
				factory.generateSinusFunctions(exampleSet, peaks, random);
			counter += peaks.size();
		}
	}
	return counter;
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:21,代码来源:FourierGeneratingMutation.java

示例13: operate

import com.rapidminer.generator.GenerationException; //导入依赖的package包/类
/**
 * Performs one of the following three mutations:
 * <ul>
 * <li>add a newly generated attribute</li>
 * <li>add an original attribute</li>
 * <li>remove an attribute</li>
 * </ul>
 */
@Override
public List<ExampleSetBasedIndividual> operate(ExampleSetBasedIndividual individual) throws Exception {
	List<ExampleSetBasedIndividual> l = new LinkedList<ExampleSetBasedIndividual>();
	AttributeWeightedExampleSet clone = (AttributeWeightedExampleSet) individual.getExampleSet().clone();
	double p = prob < 0 ? 1.0d / clone.getAttributes().size() : prob;
	p /= 4.0d;
	try {
		if ((maxNumberOfAttributes < 0) || (clone.getAttributes().size() < maxNumberOfAttributes)) {
			addOriginalAttribute(clone, p);
		}
		boolean generationPossible = false;
		if ((maxNumberOfAttributes < 0) || (clone.getAttributes().size() <= maxNumberOfAttributes)) {
			generationPossible = addGeneratedAttribute(clone, p);
		}
		deselect(clone, generationPossible ? 2 : 1, p);
	} catch (GenerationException e) {
		individual.getExampleSet().getLog().logWarning("GeneratingMutation: Exception occured during generation of attributes, using only original example set instead.");
	}

	if (clone.getNumberOfUsedAttributes() > 0) {
		l.add(new ExampleSetBasedIndividual(clone));
	}
	l.add(individual);
	return l;
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:34,代码来源:GeneratingMutation.java

示例14: operate

import com.rapidminer.generator.GenerationException; //导入依赖的package包/类
/**
 * Performs one of the following three mutations:
 * <ul>
 * <li>add a newly generated attribute</li>
 * <li>add an original attribute</li>
 * <li>remove an attribute</li>
 * </ul>
 */
@Override
public List<ExampleSetBasedIndividual> operate(ExampleSetBasedIndividual individual) throws Exception {
	List<ExampleSetBasedIndividual> l = new LinkedList<ExampleSetBasedIndividual>();
	AttributeWeightedExampleSet clone = (AttributeWeightedExampleSet) individual.getExampleSet().clone();

	try {
		addOriginalAttribute(clone);
		addGeneratedAttribute(clone);
		deselect(clone, maxGeneratedAttributes + maxAddedOriginalAttributes);

		if (clone.getNumberOfUsedAttributes() > 0) {
			l.add(new ExampleSetBasedIndividual(clone));
		}
	} catch (GenerationException e) {
		individual.getExampleSet().getLog().logWarning("DirectedGGA: Exception occured during generation of attributes, using only original example set instead.");
	}
	l.add(individual);
	return l;
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:28,代码来源:DirectedGeneratingMutation.java

示例15: doWork

import com.rapidminer.generator.GenerationException; //导入依赖的package包/类
@Override
public void doWork() throws OperatorException {		
	AbstractExpressionParser parser = ExpressionParserFactory.getExpressionParser(getParameterAsBoolean(PARAMETER_USE_STANDARD_CONSTANTS), getProcess());
	Iterator<String[]> j = getParameterList(PARAMETER_FUNCTIONS).iterator();
	while (j.hasNext()) {
		String[] nameFunctionPair = j.next();
		String name = nameFunctionPair[0];
		String function = nameFunctionPair[1];

		try {
			parser.addMacro(getProcess().getMacroHandler(), name, function);
		} catch (GenerationException e) {
			throw new UserError(this, 108, e.getMessage());
		}
	}

	dummyPorts.passDataThrough();
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:19,代码来源:MacroConstructionOperator.java


注:本文中的com.rapidminer.generator.GenerationException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。