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


Java BinDiscretization类代码示例

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


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

示例1: getParameterTypes

import com.rapidminer.operator.preprocessing.discretization.BinDiscretization; //导入依赖的package包/类
@Override
public List<ParameterType> getParameterTypes() {
	List<ParameterType> types = super.getParameterTypes();
	types.add(new ParameterTypeInt(
			BinDiscretization.PARAMETER_NUMBER_OF_BINS,
			"The number of bins used for discretization of numerical attributes before the chi squared test can be performed.",
			2, Integer.MAX_VALUE, 10));
	return types;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:10,代码来源:ChiSquaredWeighting.java

示例2: calculateWeights

import com.rapidminer.operator.preprocessing.discretization.BinDiscretization; //导入依赖的package包/类
@Override
protected AttributeWeights calculateWeights(ExampleSet exampleSet) throws OperatorException {
	Attribute label = exampleSet.getAttributes().getLabel();
	if (!label.isNominal()) {
		throw new UserError(this, 101, "symmetrical uncertainty", label.getName());
	}

	// discretize numerical data
	BinDiscretization discretization = null;
	try {
		discretization = OperatorService.createOperator(BinDiscretization.class);
	} catch (OperatorCreationException e) {
		throw new UserError(this, 904, "Discretization", e.getMessage());
	}

	int numberOfBins = getParameterAsInt(BinDiscretization.PARAMETER_NUMBER_OF_BINS);
	discretization.setParameter(BinDiscretization.PARAMETER_NUMBER_OF_BINS, numberOfBins + "");
	exampleSet = discretization.doWork(exampleSet);

	// create and deliver weights
	AttributeWeights weights = new AttributeWeights(exampleSet);
	for (Attribute attribute : exampleSet.getAttributes()) {
		double[][] counters = new double[attribute.getMapping().size()][label.getMapping().size()];
		for (Example example : exampleSet) {
			counters[(int) example.getValue(attribute)][(int) example.getLabel()]++;
		}
		double weight = ContingencyTableTools.symmetricalUncertainty(counters);
		weights.setWeight(attribute.getName(), weight);
	}

	return weights;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:33,代码来源:SymmetricalUncertaintyOperator.java

示例3: performPreprocessing

import com.rapidminer.operator.preprocessing.discretization.BinDiscretization; //导入依赖的package包/类
/** This preprocessing discretizes the input example set by a view. */
@Override
protected ExampleSet performPreprocessing(ExampleSet eSet) throws OperatorException {
	try {
		PreprocessingOperator discretizationOperator = OperatorService.createOperator(BinDiscretization.class);
		discretizationOperator.setParameter(BinDiscretization.PARAMETER_NUMBER_OF_BINS,
				getParameterAsInt(BinDiscretization.PARAMETER_NUMBER_OF_BINS) + "");
		discretizationOperator.setParameter(PreprocessingOperator.PARAMETER_CREATE_VIEW, "true");
		return discretizationOperator.doWork((ExampleSet) eSet.clone());
	} catch (OperatorCreationException e) {
		// should not happen
		throw new OperatorException(getName() + ": Cannot create discretization operator (" + e + ").");
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:15,代码来源:MutualInformationMatrixOperator.java

示例4: getParameterTypes

import com.rapidminer.operator.preprocessing.discretization.BinDiscretization; //导入依赖的package包/类
@Override
public List<ParameterType> getParameterTypes() {
	List<ParameterType> types = super.getParameterTypes();
	types.add(new ParameterTypeInt(BinDiscretization.PARAMETER_NUMBER_OF_BINS,
			"Indicates the number of bins used for numerical attributes.", 2, Integer.MAX_VALUE, 10));
	return types;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:8,代码来源:MutualInformationMatrixOperator.java

示例5: getParameterTypes

import com.rapidminer.operator.preprocessing.discretization.BinDiscretization; //导入依赖的package包/类
@Override
public List<ParameterType> getParameterTypes() {
	List<ParameterType> types = super.getParameterTypes();
	types.add(new ParameterTypeInt(BinDiscretization.PARAMETER_NUMBER_OF_BINS,
			"The number of bins used for discretization of numerical attributes before the chi squared test can be performed.",
			2, Integer.MAX_VALUE, 10));
	return types;
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:9,代码来源:ChiSquaredWeighting.java

示例6: calculateWeights

import com.rapidminer.operator.preprocessing.discretization.BinDiscretization; //导入依赖的package包/类
@Override
protected AttributeWeights calculateWeights(ExampleSet exampleSet) throws OperatorException {
	Tools.hasNominalLabels(exampleSet, getOperatorClassName());
	Attribute label = exampleSet.getAttributes().getLabel();

	// discretize numerical data
	BinDiscretization discretization = null;
	try {
		discretization = OperatorService.createOperator(BinDiscretization.class);
	} catch (OperatorCreationException e) {
		throw new UserError(this, 904, "Discretization", e.getMessage());
	}

	int numberOfBins = getParameterAsInt(BinDiscretization.PARAMETER_NUMBER_OF_BINS);
	discretization.setParameter(BinDiscretization.PARAMETER_NUMBER_OF_BINS, numberOfBins + "");
	exampleSet = discretization.doWork(exampleSet);

	// create and deliver weights
	double totalProgress = exampleSet.getAttributes().size() * exampleSet.size();
	long progressCounter = 0;
	getProgress().setTotal(100);
	AttributeWeights weights = new AttributeWeights(exampleSet);
	for (Attribute attribute : exampleSet.getAttributes()) {
		double[][] counters = new double[attribute.getMapping().size()][label.getMapping().size()];
		for (Example example : exampleSet) {
			counters[(int) example.getValue(attribute)][(int) example.getLabel()]++;
			if (++progressCounter % PROGRESS_UPDATE_STEPS == 0) {
				getProgress().setCompleted((int) (100 * (progressCounter / totalProgress)));
			}
		}
		double weight = ContingencyTableTools.symmetricalUncertainty(counters);
		weights.setWeight(attribute.getName(), weight);
	}

	return weights;
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:37,代码来源:SymmetricalUncertaintyOperator.java

示例7: calculateWeights

import com.rapidminer.operator.preprocessing.discretization.BinDiscretization; //导入依赖的package包/类
@Override
protected AttributeWeights calculateWeights(ExampleSet exampleSet) throws OperatorException {
	Attribute label = exampleSet.getAttributes().getLabel();
	if (!label.isNominal()) {
		throw new UserError(this, 101, "symmetrical uncertainty", label.getName());
	}

	// discretize numerical data
	BinDiscretization discretization = null;
	try {
		discretization = OperatorService.createOperator(BinDiscretization.class);
	} catch (OperatorCreationException e) {
		throw new UserError(this, 904, "Discretization", e.getMessage());
	}

	int numberOfBins = getParameterAsInt(BinDiscretization.PARAMETER_NUMBER_OF_BINS);
	discretization.setParameter(BinDiscretization.PARAMETER_NUMBER_OF_BINS, numberOfBins + "");		
	exampleSet = discretization.doWork(exampleSet);		

	// create and deliver weights
	AttributeWeights weights = new AttributeWeights(exampleSet);
	for (Attribute attribute : exampleSet.getAttributes()) {
		double[][] counters = new double[attribute.getMapping().size()][label.getMapping().size()];
		for (Example example : exampleSet) {
			counters[(int)example.getValue(attribute)][(int)example.getLabel()]++;
		}
		double weight = ContingencyTableTools.symmetricalUncertainty(counters);
		weights.setWeight(attribute.getName(), weight);
	}

	return weights;
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:33,代码来源:SymmetricalUncertaintyOperator.java

示例8: performPreprocessing

import com.rapidminer.operator.preprocessing.discretization.BinDiscretization; //导入依赖的package包/类
/** This preprocessing discretizes the input example set by a view. */
@Override
protected ExampleSet performPreprocessing(ExampleSet eSet) throws OperatorException {
	try {
		PreprocessingOperator discretizationOperator = OperatorService.createOperator(BinDiscretization.class);
		discretizationOperator.setParameter(BinDiscretization.PARAMETER_NUMBER_OF_BINS, getParameterAsInt(BinDiscretization.PARAMETER_NUMBER_OF_BINS) + "");
		discretizationOperator.setParameter(PreprocessingOperator.PARAMETER_CREATE_VIEW, "true");
		return discretizationOperator.doWork((ExampleSet)eSet.clone());
	} catch (OperatorCreationException e) {
		// should not happen
		throw new OperatorException(getName() + ": Cannot create discretization operator (" + e + ").");
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:14,代码来源:MutualInformationMatrixOperator.java

示例9: getParameterTypes

import com.rapidminer.operator.preprocessing.discretization.BinDiscretization; //导入依赖的package包/类
@Override
public List<ParameterType> getParameterTypes() { 
	List<ParameterType> types = super.getParameterTypes();
	types.add(new ParameterTypeInt(BinDiscretization.PARAMETER_NUMBER_OF_BINS, "The number of bins used for discretization of numerical attributes before the chi squared test can be performed.", 2, Integer.MAX_VALUE, 10));
	return types;
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:7,代码来源:ChiSquaredWeighting.java

示例10: getParameterTypes

import com.rapidminer.operator.preprocessing.discretization.BinDiscretization; //导入依赖的package包/类
@Override
public List<ParameterType> getParameterTypes() { 
	List<ParameterType> types = super.getParameterTypes();
	types.add(new ParameterTypeInt(BinDiscretization.PARAMETER_NUMBER_OF_BINS, "The number of bins used for discretization of numerical attributes before the chi squared test can be performed.", 2, Integer.MAX_VALUE, 10)); 
	return types;
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:7,代码来源:SymmetricalUncertaintyOperator.java

示例11: getParameterTypes

import com.rapidminer.operator.preprocessing.discretization.BinDiscretization; //导入依赖的package包/类
@Override
public List<ParameterType> getParameterTypes() {
	List<ParameterType> types = super.getParameterTypes();
	types.add(new ParameterTypeInt(BinDiscretization.PARAMETER_NUMBER_OF_BINS, "Indicates the number of bins used for numerical attributes.", 2, Integer.MAX_VALUE, 10));
	return types;
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:7,代码来源:MutualInformationMatrixOperator.java


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