當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。