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