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


Java Tupel类代码示例

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


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

示例1: toString

import com.rapidminer.tools.container.Tupel; //导入依赖的package包/类
@Override
public String toString() {
	StringBuffer buffer = new StringBuffer();
	for (String attributeName : rangesMap.keySet()) {
		buffer.append(Tools.getLineSeparator());
		buffer.append(Tools.getLineSeparator());
		buffer.append(attributeName);
		buffer.append(Tools.getLineSeparator());
		SortedSet<Tupel<Double, String>> set = rangesMap.get(attributeName);
		buffer.append(Double.NEGATIVE_INFINITY);
		for (Tupel<Double, String> tupel : set) {
			buffer.append(" < " + tupel.getSecond() + " <= " + tupel.getFirst());
		}
	}
	return buffer.toString();
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:17,代码来源:DiscretizationModel.java

示例2: getValue

import com.rapidminer.tools.container.Tupel; //导入依赖的package包/类
@Override
public double getValue(Attribute targetAttribute, double value) {
	SortedSet<Tupel<Double, String>> ranges = rangesMap.get(targetAttribute.getName());
	if (ranges != null) {
		int b = 0;
		for (Tupel<Double, String> rangePair : ranges) {
			if (value <= rangePair.getFirst().doubleValue()) {
				return b;
			}
			b++;
		}
		return Double.NaN;
	} else {
		return value;
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:17,代码来源:DiscretizationModel.java

示例3: createPreprocessingModel

import com.rapidminer.tools.container.Tupel; //导入依赖的package包/类
@Override
public PreprocessingModel createPreprocessingModel(ExampleSet exampleSet) throws OperatorException {
	HashMap<String, SortedSet<Tupel<Double, String>>> ranges = new HashMap<String, SortedSet<Tupel<Double, String>>>();
	List<String[]> rangeList = getParameterList(PARAMETER_RANGE_NAMES);

	TreeSet<Tupel<Double, String>> thresholdPairs = new TreeSet<Tupel<Double, String>>();
	for (String[] pair : rangeList) {
		thresholdPairs.add(new Tupel<Double, String>(Double.valueOf(pair[1]), pair[0]));
	}
	for (Attribute attribute : exampleSet.getAttributes()) {
		if (attribute.isNumerical()) {
			ranges.put(attribute.getName(), thresholdPairs);
		}
	}

	DiscretizationModel model = new DiscretizationModel(exampleSet);
	model.setRanges(ranges);
	return model;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:20,代码来源:UserBasedDiscretization.java

示例4: getNormalizationModel

import com.rapidminer.tools.container.Tupel; //导入依赖的package包/类
@Override
public AbstractNormalizationModel getNormalizationModel(ExampleSet exampleSet, Operator operator) throws UserError {
	// Range Normalization
	double min = operator.getParameterAsDouble(PARAMETER_MIN);
	double max = operator.getParameterAsDouble(PARAMETER_MAX);
	if (max <= min) {
		throw new UserError(operator, 116, "max", "Must be greater than 'min'");
	}

	// calculating attribute ranges
	HashMap<String, Tupel<Double, Double>> attributeRanges = new HashMap<String, Tupel<Double, Double>>();
	exampleSet.recalculateAllAttributeStatistics();
	for (Attribute attribute : exampleSet.getAttributes()) {
		if (attribute.isNumerical()) {
			attributeRanges.put(
					attribute.getName(),
					new Tupel<Double, Double>(exampleSet.getStatistics(attribute, Statistics.MINIMUM), exampleSet
							.getStatistics(attribute, Statistics.MAXIMUM)));
		}
	}
	return new MinMaxNormalizationModel(exampleSet, min, max, attributeRanges);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:23,代码来源:RangeNormalizationMethod.java

示例5: toResultString

import com.rapidminer.tools.container.Tupel; //导入依赖的package包/类
/** Returns a string representation of this model. */
@Override
public String toResultString() {
	StringBuffer result = new StringBuffer();
	result.append("Normalize " + attributeMeanVarianceMap.size() + " attributes to mean 0 and variance 1."
			+ Tools.getLineSeparator() + "Using");
	int counter = 0;
	for (String name : attributeMeanVarianceMap.keySet()) {
		if (counter > 4) {
			result.append(Tools.getLineSeparator() + "... " + (attributeMeanVarianceMap.size() - 5)
					+ " more attributes ...");
			break;
		}
		Tupel<Double, Double> meanVariance = attributeMeanVarianceMap.get(name);
		result.append(Tools.getLineSeparator() + name + " --> mean: " + meanVariance.getFirst().doubleValue()
				+ ", variance: " + meanVariance.getSecond().doubleValue());
		counter++;
	}
	return result.toString();
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:21,代码来源:ZTransformationModel.java

示例6: getNormalizationModel

import com.rapidminer.tools.container.Tupel; //导入依赖的package包/类
@Override
public AbstractNormalizationModel getNormalizationModel(ExampleSet exampleSet, Operator operator) throws UserError {
	// Z-Transformation
	exampleSet.recalculateAllAttributeStatistics();
	HashMap<String, Tupel<Double, Double>> attributeMeanVarianceMap = new HashMap<String, Tupel<Double, Double>>();
	for (Attribute attribute : exampleSet.getAttributes()) {
		if (attribute.isNumerical()) {
			attributeMeanVarianceMap.put(
					attribute.getName(),
					new Tupel<Double, Double>(exampleSet.getStatistics(attribute, Statistics.AVERAGE), exampleSet
							.getStatistics(attribute, Statistics.VARIANCE)));
		}
	}
	ZTransformationModel model = new ZTransformationModel(exampleSet, attributeMeanVarianceMap);
	return model;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:17,代码来源:ZTransformationNormalizationMethod.java

示例7: getNormalizationModel

import com.rapidminer.tools.container.Tupel; //导入依赖的package包/类
@Override
public AbstractNormalizationModel getNormalizationModel(ExampleSet exampleSet, Operator operator) throws UserError {
	// Range Normalization
	double min = operator.getParameterAsDouble(PARAMETER_MIN);
	double max = operator.getParameterAsDouble(PARAMETER_MAX);
	if (max <= min) {
		throw new UserError(operator, 116, "max", "Must be greater than 'min'");
	}

	// calculating attribute ranges
	HashMap<String, Tupel<Double, Double>> attributeRanges = new HashMap<String, Tupel<Double, Double>>();
	exampleSet.recalculateAllAttributeStatistics();
	for (Attribute attribute : exampleSet.getAttributes()) {
		if (attribute.isNumerical()) {
			double minA = exampleSet.getStatistics(attribute, Statistics.MINIMUM);
			double maxA = exampleSet.getStatistics(attribute, Statistics.MAXIMUM);
			if (!Double.isFinite(minA) || !Double.isFinite(maxA)) {
				nonFiniteValueWarning(operator, attribute.getName(), minA, maxA);
			}
			attributeRanges.put(attribute.getName(), new Tupel<Double, Double>(minA, maxA));
		}
	}
	return new MinMaxNormalizationModel(exampleSet, min, max, attributeRanges);
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:25,代码来源:RangeNormalizationMethod.java

示例8: getNormalizationModel

import com.rapidminer.tools.container.Tupel; //导入依赖的package包/类
@Override
public AbstractNormalizationModel getNormalizationModel(ExampleSet exampleSet, Operator operator) throws UserError {
	// Z-Transformation
	exampleSet.recalculateAllAttributeStatistics();
	HashMap<String, Tupel<Double, Double>> attributeMeanVarianceMap = new HashMap<String, Tupel<Double, Double>>();
	for (Attribute attribute : exampleSet.getAttributes()) {
		if (attribute.isNumerical()) {
			double average = exampleSet.getStatistics(attribute, Statistics.AVERAGE);
			double variance = exampleSet.getStatistics(attribute, Statistics.VARIANCE);
			if (!Double.isFinite(average) || !Double.isFinite(variance)) {
				nonFiniteValueWarning(operator, attribute.getName(), average, variance);
			}
			attributeMeanVarianceMap.put(attribute.getName(), new Tupel<Double, Double>(average, variance));
		}
	}
	ZTransformationModel model = new ZTransformationModel(exampleSet, attributeMeanVarianceMap);
	return model;
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:19,代码来源:ZTransformationNormalizationMethod.java

示例9: createRanges

import com.rapidminer.tools.container.Tupel; //导入依赖的package包/类
private TreeSet<Tupel<Double,String>> createRanges(double[] entry, String rangeBaseName, int rangeNameType, int numberOfDigits) {
	TreeSet<Tupel<Double, String>> ranges = new TreeSet<Tupel<Double, String>>();
	int i = 1;
	double lastLimit = Double.NEGATIVE_INFINITY;
	for (double rangeValue : entry) {
		String usedRangeName = null;
		switch (rangeNameType) {
		case RANGE_NAME_LONG:
			usedRangeName = (rangeBaseName + i) + " [" + Tools.formatIntegerIfPossible(lastLimit) + " - " + Tools.formatIntegerIfPossible(rangeValue) + "]";
			break;
		case RANGE_NAME_SHORT:
			usedRangeName = (rangeBaseName + i);
			break;
		case RANGE_NAME_INTERVAL:
			usedRangeName = "[" + Tools.formatNumber(lastLimit, numberOfDigits) + " - " + Tools.formatNumber(rangeValue, numberOfDigits) + "]";
			break;
		}

		ranges.add(new Tupel<Double, String>(rangeValue, usedRangeName));
		i++;
		lastLimit = rangeValue;
	}
	return ranges;
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:25,代码来源:DiscretizationModel.java

示例10: getNormalizationModel

import com.rapidminer.tools.container.Tupel; //导入依赖的package包/类
@Override
public AbstractNormalizationModel getNormalizationModel(ExampleSet exampleSet, Operator operator) throws UserError {
	// Range Normalization
	double min = operator.getParameterAsDouble(PARAMETER_MIN);
	double max = operator.getParameterAsDouble(PARAMETER_MAX);
	if (max <= min)
		throw new UserError(operator, 116, "max", "Must be greater than 'min'");

	// calculating attribute ranges
	HashMap<String, Tupel<Double, Double>> attributeRanges = new HashMap<String, Tupel<Double, Double>>();
	exampleSet.recalculateAllAttributeStatistics();
	for (Attribute attribute : exampleSet.getAttributes()) {
		if (attribute.isNumerical()) {
			attributeRanges.put(attribute.getName(), new Tupel<Double, Double>(exampleSet.getStatistics(attribute, Statistics.MINIMUM), exampleSet.getStatistics(attribute, Statistics.MAXIMUM)));
		}
	}
	return new MinMaxNormalizationModel(exampleSet, min, max, attributeRanges);
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:19,代码来源:RangeNormalizationMethod.java

示例11: toResultString

import com.rapidminer.tools.container.Tupel; //导入依赖的package包/类
/** Returns a string representation of this model. */
@Override
public String toResultString() {
    StringBuffer result = new StringBuffer();
    result.append("Normalize " + attributeMeanVarianceMap.size() + " attributes to mean 0 and variance 1." + Tools.getLineSeparator() + "Using");
    int counter = 0;
    for(String name: attributeMeanVarianceMap.keySet()) {
        if (counter > 4) {
            result.append(Tools.getLineSeparator() + "... " + (attributeMeanVarianceMap.size() - 5) + " more attributes ...");
            break;
        }
        Tupel<Double, Double> meanVariance = attributeMeanVarianceMap.get(name);
        result.append(Tools.getLineSeparator() + name + " --> mean: " + meanVariance.getFirst().doubleValue() + ", variance: " + meanVariance.getSecond().doubleValue());
        counter++;
    }
    return result.toString();
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:18,代码来源:ZTransformationModel.java

示例12: getNearestNodes

import com.rapidminer.tools.container.Tupel; //导入依赖的package包/类
private BoundedPriorityQueue<Tupel<Double, KDTreeNode<T>>> getNearestNodes(int k, double[] values) {
	Stack<KDTreeNode<T>> nodeStack = new Stack<KDTreeNode<T>>();
	// first doing initial search for nearest Node
	nodeStack = traverseTree(nodeStack, root, values);

	// creating data structure for finding k nearest values
	BoundedPriorityQueue<Tupel<Double, KDTreeNode<T>>> priorityQueue = new BoundedPriorityQueue<Tupel<Double, KDTreeNode<T>>>(k);
	
	// now work on stack
	while (!nodeStack.isEmpty()) {
		// put top element into priorityQueue
		KDTreeNode<T> currentNode = nodeStack.pop();
		Tupel<Double, KDTreeNode<T>> currentTupel = new Tupel<Double, KDTreeNode<T>>(distance.calculateDistance(currentNode.getValues(), values), currentNode);
		priorityQueue.add(currentTupel);
		// now check if far children has to be regarded
		if (!priorityQueue.isFilled() || 
				priorityQueue.peek().getFirst().doubleValue() > currentNode.getCompareValue() - values[currentNode.getCompareDimension()]) {
			// if needs to be checked, traverse tree to nearest leaf
			if (currentNode.hasFarChild(values))
				traverseTree(nodeStack, currentNode.getFarChild(values), values);
		}
	
		// go on, until stack is empty
	}
	return priorityQueue;
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:27,代码来源:KDTree.java

示例13: haveNext

import com.rapidminer.tools.container.Tupel; //导入依赖的package包/类
private boolean haveNext(ArrayList<Tupel<FrequentItemSet, Iterator<FrequentItemSet>>> iterators) {
	boolean hasNext = iterators.size() > 0;
	for (Tupel<FrequentItemSet, Iterator<FrequentItemSet>> iterator : iterators) {
		hasNext = hasNext || iterator.getSecond().hasNext();
	}
	return hasNext;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:8,代码来源:FrequentItemSetUnificator.java

示例14: getSequenceArray

import com.rapidminer.tools.container.Tupel; //导入依赖的package包/类
public Sequence[] getSequenceArray() {
	Sequence[] sequences = new Sequence[this.sequences.size()];
	int i = 0;
	for (Tupel<Sequence, Double> tupel : this.sequences) {
		sequences[i] = tupel.getFirst();
		i++;
	}
	return sequences;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:10,代码来源:GSPSet.java

示例15: getSupportArray

import com.rapidminer.tools.container.Tupel; //导入依赖的package包/类
public double[] getSupportArray() {
	double[] supports = new double[sequences.size()];
	int i = 0;
	for (Tupel<Sequence, Double> tupel : sequences) {
		supports[i] = tupel.getSecond();
		i++;
	}
	return supports;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:10,代码来源:GSPSet.java


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