本文整理匯總了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;
}