本文整理汇总了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;
}
示例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;
}
示例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 + ").");
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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 + ").");
}
}
示例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;
}
示例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;
}
示例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;
}