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


Java PreprocessingModel类代码示例

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


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

示例1: createPreprocessingModel

import com.rapidminer.operator.preprocessing.PreprocessingModel; //导入依赖的package包/类
@Override
public PreprocessingModel createPreprocessingModel(ExampleSet exampleSet) throws OperatorException {
	HashMap<Attribute, double[]> rangesMap = new HashMap<Attribute, double[]>();
	double[][] ranges = getRanges(exampleSet);
	int attributeIndex = 0;
	for (Attribute attribute : exampleSet.getAttributes()) {
		if (attribute.isNumerical()) {
			ranges[attributeIndex][ranges[attributeIndex].length - 1] = Double.POSITIVE_INFINITY;
			rangesMap.put(attribute, ranges[attributeIndex]);
			attributeIndex++;
		}
	}

	DiscretizationModel model = new DiscretizationModel(exampleSet, getParameterAsBoolean(PARAMETER_REMOVE_USELESS));

	// determine number of digits
	int numberOfDigits = -1;
	if (getParameterAsBoolean(FrequencyDiscretization.PARAMETER_AUTOMATIC_NUMBER_OF_DIGITS) == false) {
		numberOfDigits = getParameterAsInt(FrequencyDiscretization.PARAMETER_NUMBER_OF_DIGITS);
	}

	model.setRanges(rangesMap, "range", getParameterAsInt(FrequencyDiscretization.PARAMETER_RANGE_NAME_TYPE),
			numberOfDigits);
	return model;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:26,代码来源:MinimalEntropyDiscretization.java

示例2: createPreprocessingModel

import com.rapidminer.operator.preprocessing.PreprocessingModel; //导入依赖的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

示例3: createPreprocessingModel

import com.rapidminer.operator.preprocessing.PreprocessingModel; //导入依赖的package包/类
@Override
public PreprocessingModel createPreprocessingModel(ExampleSet exampleSet) throws OperatorException {
	HashMap<Attribute, double[]> rangesMap = new HashMap<Attribute, double[]>();
	double[][] ranges = getRanges(exampleSet);
	int attributeIndex = 0;
	for (Attribute attribute : exampleSet.getAttributes()) {
		if (attribute.isNumerical()) {
			ranges[attributeIndex][ranges[attributeIndex].length - 1] = Double.POSITIVE_INFINITY;
			rangesMap.put(attribute, ranges[attributeIndex]);
			attributeIndex++;
		}
	}

	DiscretizationModel model = new DiscretizationModel(exampleSet, getParameterAsBoolean(PARAMETER_REMOVE_USELESS));

	// determine number of digits
	int numberOfDigits = -1;
	if (getParameterAsBoolean(FrequencyDiscretization.PARAMETER_AUTOMATIC_NUMBER_OF_DIGITS) == false) {
		numberOfDigits = getParameterAsInt(FrequencyDiscretization.PARAMETER_NUMBER_OF_DIGITS);
	}

	model.setRanges(rangesMap, "range", getParameterAsInt(FrequencyDiscretization.PARAMETER_RANGE_NAME_TYPE), numberOfDigits);
	return model;
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:25,代码来源:MinimalEntropyDiscretization.java

示例4: createPreprocessingModel

import com.rapidminer.operator.preprocessing.PreprocessingModel; //导入依赖的package包/类
@Override
public PreprocessingModel createPreprocessingModel(ExampleSet exampleSet) throws OperatorException {
	DiscretizationModel model = new DiscretizationModel(exampleSet);

	exampleSet.recalculateAllAttributeStatistics();
	int numberOfBins = getParameterAsInt(PARAMETER_NUMBER_OF_BINS);
	HashMap<Attribute, double[]> ranges = new HashMap<Attribute, double[]>();

	double min = getParameterAsDouble(PARAMETER_MIN_VALUE);
	double max = getParameterAsDouble(PARAMETER_MAX_VALUE);
	if (min > max) {
		throw new UserError(this, 116, PARAMETER_MIN_VALUE + " and " + PARAMETER_MAX_VALUE,
				"minimum must be less than maximum");
	}
	for (Attribute attribute : exampleSet.getAttributes()) {
		if (attribute.isNumerical()) { // skip nominal and date attributes
			double[] binRange = new double[numberOfBins + 2];
			binRange[0] = min;
			for (int b = 1; b < numberOfBins; b++) {
				binRange[b] = min + (((double) b / (double) numberOfBins) * (max - min));
			}
			binRange[numberOfBins] = max;
			binRange[numberOfBins + 1] = Double.POSITIVE_INFINITY;
			ranges.put(attribute, binRange);
		}
	}

	// determine number of digits
	int numberOfDigits = -1;
	if (getParameterAsBoolean(PARAMETER_AUTOMATIC_NUMBER_OF_DIGITS) == false) {
		numberOfDigits = getParameterAsInt(PARAMETER_NUMBER_OF_DIGITS);
	}

	model.setRanges(ranges, "range", getParameterAsInt(PARAMETER_RANGE_NAME_TYPE), numberOfDigits);
	return (model);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:37,代码来源:MinMaxBinDiscretization.java

示例5: createPreprocessingModel

import com.rapidminer.operator.preprocessing.PreprocessingModel; //导入依赖的package包/类
@Override
public PreprocessingModel createPreprocessingModel(ExampleSet exampleSet) throws OperatorException {
	int method = getParameterAsInt(PARAMETER_NORMALIZATION_METHOD);
	NormalizationMethod normalizationMethod = METHODS.get(method);
	normalizationMethod.init();
	return normalizationMethod.getNormalizationModel(exampleSet, this);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:8,代码来源:Normalization.java

示例6: createPreprocessingModel

import com.rapidminer.operator.preprocessing.PreprocessingModel; //导入依赖的package包/类
@Override
public PreprocessingModel createPreprocessingModel(ExampleSet exampleSet) throws OperatorException {
	exampleSet.recalculateAllAttributeStatistics();

	int defaultFunction = getParameterAsInt(PARAMETER_DEFAULT);
	List<String[]> functionList = getParameterList(PARAMETER_COLUMNS);

	double replacedValue = getReplacedValue();
	HashMap<String, Double> numericalAndDateReplacementMap = new HashMap<String, Double>();
	HashMap<String, String> nominalReplacementMap = new HashMap<String, String>();
	List<String> functionNames = Arrays.asList(getFunctionNames());
	for (Attribute attribute : exampleSet.getAttributes()) {
		String attributeName = attribute.getName();
		int function = defaultFunction;
		for (String[] pair : functionList) {
			if (pair[0].equals(attributeName)) {
				function = functionNames.indexOf(pair[1]);
				if (function == -1) {
					throw new RuntimeException("Illegal replacement function: " + pair[1]);
				}
			}
		}

		final double replenishmentValue = getReplenishmentValue(function, exampleSet, attribute);
		if (attribute.isNominal()) {
			if ((replenishmentValue == -1) || Double.isNaN(replenishmentValue)) {
				nominalReplacementMap.put(attributeName, null);
			} else {
				nominalReplacementMap.put(attributeName, attribute.getMapping().mapIndex((int) replenishmentValue));
			}
		}
		if (attribute.isNumerical() || Ontology.ATTRIBUTE_VALUE_TYPE.isA(attribute.getValueType(), Ontology.DATE_TIME)) {
			numericalAndDateReplacementMap.put(attributeName, replenishmentValue);
		}
	}

	return new ValueReplenishmentModel(exampleSet, replacedValue, numericalAndDateReplacementMap, nominalReplacementMap);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:39,代码来源:ValueReplenishment.java

示例7: createPreprocessingModel

import com.rapidminer.operator.preprocessing.PreprocessingModel; //导入依赖的package包/类
@Override
public PreprocessingModel createPreprocessingModel(ExampleSet exampleSet) throws OperatorException {
	ExampleSet dictionarySet = dictionaryInput.getData(ExampleSet.class);

	AttributeSubsetSelector subsetSelector = new AttributeSubsetSelector(this, getExampleSetInputPort());
	boolean toLowerCase = getParameterAsBoolean(PARAMETER_TO_LOWERCASE);

	List<String[]> replacements = new LinkedList<>();

	Attribute from = dictionarySet.getAttributes().get(getParameterAsString(PARAMETER_FROM_ATTRIBUTE));
	Attribute to = dictionarySet.getAttributes().get(getParameterAsString(PARAMETER_TO_ATTRIBUTE));
	if (from == null) {
		throw new UndefinedParameterError(PARAMETER_FROM_ATTRIBUTE, this);
	}
	if (to == null) {
		throw new UndefinedParameterError(PARAMETER_TO_ATTRIBUTE, this);
	}
	if (!from.isNominal()) {
		throw new UserError(this, 119, from.getName(), this);
	}
	if (!to.isNominal()) {
		throw new UserError(this, 119, to.getName(), this);
	}
	for (Example example : dictionarySet) {
		if (toLowerCase) {
			replacements.add(new String[] { example.getValueAsString(from).toLowerCase(),
					example.getValueAsString(to).toLowerCase() });
		} else {
			replacements.add(new String[] { example.getValueAsString(from), example.getValueAsString(to) });
		}
	}
	return new Dictionary(exampleSet, subsetSelector.getAttributeSubset(exampleSet, false), replacements,
			getParameterAsBoolean(PARAMETER_REGEXP), toLowerCase, getParameterAsBoolean(PARAMETER_FIRST_MATCH_ONLY));
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:35,代码来源:ExampleSetToDictionary.java

示例8: createPreprocessingModel

import com.rapidminer.operator.preprocessing.PreprocessingModel; //导入依赖的package包/类
@Override
public PreprocessingModel createPreprocessingModel(ExampleSet exampleSet) throws OperatorException {
	PreprocessingModel model = new NominalToBinominalModel(exampleSet,
			getParameterAsBoolean(PARAMETER_TRANSFORM_BINOIMINAL),
			getParameterAsBoolean(PARAMETER_USE_UNDERSCORE_IN_NAME));
	return model;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:8,代码来源:NominalToBinominal.java

示例9: createPreprocessingModel

import com.rapidminer.operator.preprocessing.PreprocessingModel; //导入依赖的package包/类
@Override
public PreprocessingModel createPreprocessingModel(ExampleSet exampleSet) throws OperatorException {

	int codingType = getParameterAsInt(PARAMETER_CODING_TYPE);
	if (codingType == INTEGERS_CODING) {
		return new com.rapidminer.operator.preprocessing.filter.NominalToNumericModel(exampleSet, codingType);
	} else if (codingType == DUMMY_CODING) {
		Map<String, Double> sourceAttributeToComparisonGroupMap = null;
		if (getParameterAsBoolean(PARAMETER_USE_COMPARISON_GROUPS)) {
			sourceAttributeToComparisonGroupMap = getSourceAttributeToComparisonGroupMap(exampleSet);
		}
		;
		Map<String, Double> attributeTo1ValueMap = getAttributeTo1ValueMap(exampleSet);
		return new com.rapidminer.operator.preprocessing.filter.NominalToNumericModel(exampleSet, codingType,
				getParameterAsBoolean(PARAMETER_USE_UNDERSCORE_IN_NAME), sourceAttributeToComparisonGroupMap,
				attributeTo1ValueMap, null, getParameterAsBoolean(PARAMETER_USE_COMPARISON_GROUPS),
				getParameterAsInt(PARAMETER_UNEXPECTED_VALUE_HANDLING));
	} else if (codingType == EFFECT_CODING) {
		Map<String, Double> sourceAttributeToComparisonGroupMap = getSourceAttributeToComparisonGroupMap(exampleSet);
		Map<String, Pair<Double, Double>> attributeToValuesMap = getAttributeToValuesMap(exampleSet);
		return new com.rapidminer.operator.preprocessing.filter.NominalToNumericModel(exampleSet, codingType,
				getParameterAsBoolean(PARAMETER_USE_UNDERSCORE_IN_NAME), sourceAttributeToComparisonGroupMap, null,
				attributeToValuesMap, true, getParameterAsInt(PARAMETER_UNEXPECTED_VALUE_HANDLING));
	} else {
		assert false; // unsupported coding
		return null;
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:29,代码来源:NominalToNumeric.java

示例10: createPreprocessingModel

import com.rapidminer.operator.preprocessing.PreprocessingModel; //导入依赖的package包/类
@Override
public PreprocessingModel createPreprocessingModel(ExampleSet exampleSet) throws OperatorException {
	DiscretizationModel model = new DiscretizationModel(exampleSet);

	exampleSet.recalculateAllAttributeStatistics();
	int numberOfBins = getParameterAsInt(PARAMETER_NUMBER_OF_BINS);
	HashMap<Attribute, double[]> ranges = new HashMap<Attribute, double[]>();

	double min = getParameterAsDouble(PARAMETER_MIN_VALUE);
	double max = getParameterAsDouble(PARAMETER_MAX_VALUE);
	if (min > max) {
		throw new UserError(this, 116, PARAMETER_MIN_VALUE + " and " + PARAMETER_MAX_VALUE, "minimum must be less than maximum");
	}
	for (Attribute attribute : exampleSet.getAttributes()) {
		if (attribute.isNumerical()) { // skip nominal and date attributes
			double[] binRange = new double[numberOfBins + 2];
			binRange[0] = min;
			for (int b = 1; b < numberOfBins; b++) {
				binRange[b] = min + (((double) b / (double) numberOfBins) * (max - min));
			}
			binRange[numberOfBins] = max;
			binRange[numberOfBins + 1] = Double.POSITIVE_INFINITY;
			ranges.put(attribute, binRange);
		}
	}

	// determine number of digits
	int numberOfDigits = -1;
	if (getParameterAsBoolean(PARAMETER_AUTOMATIC_NUMBER_OF_DIGITS) == false) {
		numberOfDigits = getParameterAsInt(PARAMETER_NUMBER_OF_DIGITS);
	}

	model.setRanges(ranges, "range", getParameterAsInt(PARAMETER_RANGE_NAME_TYPE), numberOfDigits);
	return (model);
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:36,代码来源:MinMaxBinDiscretization.java

示例11: createPreprocessingModel

import com.rapidminer.operator.preprocessing.PreprocessingModel; //导入依赖的package包/类
@Override
public PreprocessingModel createPreprocessingModel(ExampleSet exampleSet) throws OperatorException {
	exampleSet.recalculateAllAttributeStatistics();

	int defaultFunction = getParameterAsInt(PARAMETER_DEFAULT);
	List<String[]> functionList = getParameterList(PARAMETER_COLUMNS);

	double replacedValue = getReplacedValue();
	HashMap<String, Double> numericalAndDateReplacementMap = new HashMap<String, Double>();
	HashMap<String, String> nominalReplacementMap = new HashMap<String, String>();
	List<String> functionNames = Arrays.asList(getFunctionNames());
	for (Attribute attribute: exampleSet.getAttributes()) {
		String attributeName = attribute.getName();
		int function = defaultFunction;
		for (String[] pair: functionList) {
			if (pair[0].equals(attributeName)) {
				function = functionNames.indexOf(pair[1]);
				if (function == -1) {
					throw new RuntimeException("Illegal replacement function: "+pair[1]);
				}
			}
		}

		final double replenishmentValue = getReplenishmentValue(function, exampleSet, attribute);
		if (attribute.isNominal()) {
			if ((replenishmentValue == -1) || Double.isNaN(replenishmentValue)) {
				nominalReplacementMap.put(attributeName, null);
			} else {
				nominalReplacementMap.put(attributeName, attribute.getMapping().mapIndex((int) replenishmentValue));
			}
		}
		if (attribute.isNumerical() || Ontology.ATTRIBUTE_VALUE_TYPE.isA(attribute.getValueType(), Ontology.DATE_TIME)) {
			numericalAndDateReplacementMap.put(attributeName, replenishmentValue);
		}
	}

	return new ValueReplenishmentModel(exampleSet, replacedValue, numericalAndDateReplacementMap, nominalReplacementMap);
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:39,代码来源:ValueReplenishment.java

示例12: createPreprocessingModel

import com.rapidminer.operator.preprocessing.PreprocessingModel; //导入依赖的package包/类
@Override
public PreprocessingModel createPreprocessingModel(ExampleSet exampleSet) throws OperatorException {
	ExampleSet dictionarySet = dictionaryInput.getData(ExampleSet.class);

	AttributeSubsetSelector subsetSelector = new AttributeSubsetSelector(this, getExampleSetInputPort());	
	boolean toLowerCase = getParameterAsBoolean(PARAMETER_TO_LOWERCASE);

	List<String[]> replacements = new LinkedList<String[]>();
	Attribute from = dictionarySet.getAttributes().get(getParameterAsString(PARAMETER_FROM_ATTRIBUTE));
	Attribute to   = dictionarySet.getAttributes().get(getParameterAsString(PARAMETER_TO_ATTRIBUTE));
	if (!from.isNominal()) {
		throw new UserError(this, 119, new Object[] { from.getName(), this });
	}
	if (!to.isNominal()) {
		throw new UserError(this, 119, new Object[] { to.getName(), this });
	}
	for (Example example : dictionarySet) {
		if (toLowerCase) {
			replacements.add(new String[] { example.getValueAsString(from).toLowerCase(), example.getValueAsString(to).toLowerCase() });
		} else {
			replacements.add(new String[] { example.getValueAsString(from), example.getValueAsString(to) });
		}
	}
	return new Dictionary(exampleSet, 
			subsetSelector.getAttributeSubset(exampleSet, false), 
			replacements, 
			getParameterAsBoolean(PARAMETER_REGEXP), 
			toLowerCase,
			getParameterAsBoolean(PARAMETER_FIRST_MATCH_ONLY));		
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:31,代码来源:ExampleSetToDictionary.java

示例13: getPreprocessingModelClass

import com.rapidminer.operator.preprocessing.PreprocessingModel; //导入依赖的package包/类
@Override
public Class<? extends PreprocessingModel> getPreprocessingModelClass() {
	return DiscretizationModel.class;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:5,代码来源:MinMaxBinDiscretization.java

示例14: createPreprocessingModel

import com.rapidminer.operator.preprocessing.PreprocessingModel; //导入依赖的package包/类
@Override
public PreprocessingModel createPreprocessingModel(ExampleSet exampleSet) throws OperatorException {
	HashMap<Attribute, double[]> ranges = new HashMap<Attribute, double[]>();
	// Get and check parametervalues
	boolean useSqrt = getParameterAsBoolean(PARAMETER_USE_SQRT_OF_EXAMPLES);
	int numberOfBins = 0;
	if (!useSqrt) {
		// if not automatic sizing of bins, use parametervalue
		numberOfBins = getParameterAsInt(PARAMETER_NUMBER_OF_BINS);
		if (numberOfBins >= (exampleSet.size() - 1)) {
			throw new UserError(this, 116, PARAMETER_NUMBER_OF_BINS,
					"number of bins must be smaller than number of examples (here: " + exampleSet.size() + ")");
		}
	} else {
		exampleSet.recalculateAllAttributeStatistics();
	}

	for (Attribute currentAttribute : exampleSet.getAttributes()) {
		if (useSqrt) {
			numberOfBins = (int) Math.round(Math.sqrt(exampleSet.size()
					- (int) exampleSet.getStatistics(currentAttribute, Statistics.UNKNOWN)));
		}
		double[] attributeRanges = new double[numberOfBins];
		ExampleSet sortedSet = new SortedExampleSet(exampleSet, currentAttribute, SortedExampleSet.INCREASING);

		// finding ranges
		double examplesPerBin = exampleSet.size() / (double) numberOfBins;
		double currentBinSpace = examplesPerBin;
		double lastValue = Double.NaN;
		int currentBin = 0;

		for (Example example : sortedSet) {
			double value = example.getValue(currentAttribute);
			if (!Double.isNaN(value)) {
				// change bin if full and not last
				if (currentBinSpace < 1 && currentBin < numberOfBins && value != lastValue) {
					if (!Double.isNaN(lastValue)) {
						attributeRanges[currentBin] = (lastValue + value) / 2;
						currentBin++;
						currentBinSpace += examplesPerBin; // adding because same values might
															// cause binspace to be negative
						if (currentBinSpace < 1) {
							throw new UserError(this, 944, currentAttribute.getName());
						}
					}
				}
				currentBinSpace--;
				lastValue = value;
			}
		}
		attributeRanges[numberOfBins - 1] = Double.POSITIVE_INFINITY;
		ranges.put(currentAttribute, attributeRanges);
	}
	DiscretizationModel model = new DiscretizationModel(exampleSet);

	// determine number of digits
	int numberOfDigits = -1;
	if (getParameterAsBoolean(PARAMETER_AUTOMATIC_NUMBER_OF_DIGITS) == false) {
		numberOfDigits = getParameterAsInt(PARAMETER_NUMBER_OF_DIGITS);
	}

	model.setRanges(ranges, "range", getParameterAsInt(PARAMETER_RANGE_NAME_TYPE), numberOfDigits);
	return model;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:65,代码来源:FrequencyDiscretization.java

示例15: createPreprocessingModel

import com.rapidminer.operator.preprocessing.PreprocessingModel; //导入依赖的package包/类
@Override
public PreprocessingModel createPreprocessingModel(ExampleSet exampleSet) throws OperatorException {
	DiscretizationModel model = new DiscretizationModel(exampleSet);

	exampleSet.recalculateAllAttributeStatistics();
	// calculating number of bins
	int sizeOfBins = getParameterAsInt(PARAMETER_SIZE_OF_BINS);
	int numberOfBins = exampleSet.size() / sizeOfBins;
	int numberOfExamples = exampleSet.size();
	// add one bin if a remainder exists
	if (numberOfBins * sizeOfBins < numberOfExamples) {
		numberOfBins++;
	}
	HashMap<Attribute, double[]> ranges = new HashMap<Attribute, double[]>();

	int sortingDirection = getParameterAsInt(PARAMETER_SORTING_DIRECTION);

	for (Attribute attribute : exampleSet.getAttributes()) {
		if (attribute.isNumerical()) { // skip nominal and date attributes
			ExampleSet sortedSet = new SortedExampleSet(exampleSet, attribute, sortingDirection);
			double[] binRange = new double[numberOfBins];
			for (int i = 0; i < numberOfBins - 1; i++) {
				int offset = (i + 1) * sizeOfBins - 1;
				double infimum = sortedSet.getExample(offset).getValue(attribute);
				offset++;
				double supremum = sortedSet.getExample(offset).getValue(attribute);
				// if targets equal values: Search for next different value
				while (infimum == supremum && offset < numberOfExamples) {
					supremum = sortedSet.getExample(offset).getValue(attribute);
					offset++;
				}
				if (sortingDirection == SortedExampleSet.DECREASING) {
					binRange[numberOfBins - 2 - i] = (infimum + supremum) / 2d;
				} else {
					binRange[i] = (infimum + supremum) / 2d;
				}
			}
			binRange[numberOfBins - 1] = Double.POSITIVE_INFINITY;
			ranges.put(attribute, binRange);
		}
	}

	// determine number of digits
	int numberOfDigits = -1;
	if (getParameterAsBoolean(PARAMETER_AUTOMATIC_NUMBER_OF_DIGITS) == false) {
		numberOfDigits = getParameterAsInt(PARAMETER_NUMBER_OF_DIGITS);
	}

	model.setRanges(ranges, "range", getParameterAsInt(PARAMETER_RANGE_NAME_TYPE), numberOfDigits);
	return (model);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:52,代码来源:AbsoluteDiscretization.java


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