本文整理汇总了Java中com.rapidminer.operator.learner.CapabilityCheck类的典型用法代码示例。如果您正苦于以下问题:Java CapabilityCheck类的具体用法?Java CapabilityCheck怎么用?Java CapabilityCheck使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CapabilityCheck类属于com.rapidminer.operator.learner包,在下文中一共展示了CapabilityCheck类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doWork
import com.rapidminer.operator.learner.CapabilityCheck; //导入依赖的package包/类
/**
* Trains a model using an ExampleSet from the input. Uses the method learn(ExampleSet).
*/
@Override
public void doWork() throws OperatorException {
ExampleSet exampleSet = exampleSetInput.getData(ExampleSet.class);
// some checks
if (exampleSet.getAttributes().getLabel() == null) {
throw new UserError(this, 105, new Object[0]);
}
if (exampleSet.getAttributes().size() == 0) {
throw new UserError(this, 106, new Object[0]);
}
// check capabilities and produce errors if they are not fulfilled
CapabilityCheck check = new CapabilityCheck(this, Tools.booleanValue(
ParameterService.getParameterValue(CapabilityProvider.PROPERTY_RAPIDMINER_GENERAL_CAPABILITIES_WARN), true));
check.checkLearnerCapabilities(this, exampleSet);
Model model = learn(exampleSet);
modelOutput.deliver(model);
exampleSetOutput.deliver(exampleSet);
}
示例2: doWork
import com.rapidminer.operator.learner.CapabilityCheck; //导入依赖的package包/类
@Override
public void doWork() throws OperatorException {
ExampleSet exampleSet = exampleSetInput.getData(ExampleSet.class);
// some checks
if (exampleSet.getAttributes().getLabel() == null) {
throw new UserError(this, 105, new Object[0]);
}
if (exampleSet.getAttributes().size() == 0) {
throw new UserError(this, 106, new Object[0]);
}
// check if the label attribute contains any missing values
Attribute labelAtt = exampleSet.getAttributes().getLabel();
exampleSet.recalculateAttributeStatistics(labelAtt);
if (exampleSet.getStatistics(labelAtt, Statistics.UNKNOWN) > 0) {
throw new UserError(this, 162, labelAtt.getName());
}
// check capabilities and produce errors if they are not fulfilled
CapabilityCheck check = new CapabilityCheck(this, Tools.booleanValue(
ParameterService.getParameterValue(CapabilityProvider.PROPERTY_RAPIDMINER_GENERAL_CAPABILITIES_WARN), true));
check.checkLearnerCapabilities(this, exampleSet);
Model model = learn(exampleSet);
modelOutput.deliver(model);
}
示例3: doWork
import com.rapidminer.operator.learner.CapabilityCheck; //导入依赖的package包/类
/**
* Trains a model using an ExampleSet from the input. Uses the method
* learn(ExampleSet).
*/
@Override
public void doWork() throws OperatorException {
ExampleSet exampleSet = exampleSetInput.getData(ExampleSet.class);
// some checks
if (exampleSet.getAttributes().getLabel() == null) {
throw new UserError(this, 105, new Object[0]);
}
if (exampleSet.getAttributes().size() == 0) {
throw new UserError(this, 106, new Object[0]);
}
// check capabilities and produce errors if they are not fulfilled
CapabilityCheck check = new CapabilityCheck(this, Tools.booleanValue(ParameterService.getParameterValue(AbstractLearner.PROPERTY_RAPIDMINER_GENERAL_CAPABILITIES_WARN), true));
check.checkLearnerCapabilities(this, exampleSet);
Model model = learn(exampleSet);
modelOutput.deliver(model);
exampleSetOutput.deliver(exampleSet);
}
示例4: doWork
import com.rapidminer.operator.learner.CapabilityCheck; //导入依赖的package包/类
@Override
public void doWork() throws OperatorException {
ExampleSet exampleSet = exampleSetInput.getData(ExampleSet.class);
// some checks
if (exampleSet.getAttributes().getLabel() == null) {
throw new UserError(this, 105, new Object[0]);
}
if (exampleSet.getAttributes().size() == 0) {
throw new UserError(this, 106, new Object[0]);
}
// check capabilities and produce errors if they are not fulfilled
CapabilityCheck check = new CapabilityCheck(this, Tools.booleanValue(ParameterService.getParameterValue(AbstractLearner.PROPERTY_RAPIDMINER_GENERAL_CAPABILITIES_WARN), true));
check.checkLearnerCapabilities(this, exampleSet);
Model model = learn(exampleSet);
modelOutput.deliver(model);
}
示例5: doWork
import com.rapidminer.operator.learner.CapabilityCheck; //导入依赖的package包/类
/**
* Helper method for anonymous instances of this class.
*/
public AttributeWeights doWork(ExampleSet exampleSet) throws OperatorException {
exampleSetInput.receive(exampleSet);
// check capabilities and produce errors if they are not fulfilled
CapabilityCheck check = new CapabilityCheck(this, Tools.booleanValue(
ParameterService.getParameterValue(PROPERTY_RAPIDMINER_GENERAL_CAPABILITIES_WARN), true)
|| onlyWarnForNonSufficientCapabilities());
check.checkLearnerCapabilities(this, exampleSet);
doWork();
return weightsOutput.getData(AttributeWeights.class);
}
示例6: doWork
import com.rapidminer.operator.learner.CapabilityCheck; //导入依赖的package包/类
/** Helper method for anonymous instances of this class.
*/
public AttributeWeights doWork(ExampleSet exampleSet) throws OperatorException {
exampleSetInput.receive(exampleSet);
// check capabilities and produce errors if they are not fulfilled
CapabilityCheck check = new CapabilityCheck(this, Tools.booleanValue(ParameterService.getParameterValue(PROPERTY_RAPIDMINER_GENERAL_CAPABILITIES_WARN), true) || onlyWarnForNonSufficientCapabilities());
check.checkLearnerCapabilities(this, exampleSet);
doWork();
return weightsOutput.getData(AttributeWeights.class);
}
示例7: doWork
import com.rapidminer.operator.learner.CapabilityCheck; //导入依赖的package包/类
@Override
public void doWork() throws OperatorException {
ExampleSet inputSet = exampleSetInput.getData(ExampleSet.class);
// check capabilities and produce errors if they are not fulfilled
CapabilityCheck check = new CapabilityCheck(this, false);
check.checkLearnerCapabilities(this, inputSet);
if (getParameterAsBoolean(PARAMETER_LEAVE_ONE_OUT)) {
number = inputSet.size();
} else {
number = getParameterAsInt(PARAMETER_NUMBER_OF_VALIDATIONS);
}
log("Starting " + number + "-fold cross validation prediction");
// init Operator progress
getProgress().setTotal(number + 1);
// disable checkForStop, will be called in #inApplyLoop() anyway
getProgress().setCheckForStop(false);
// creating predicted label
ExampleSet resultSet = (ExampleSet) inputSet.clone();
Attribute predictedLabel = PredictionModel.createPredictedLabel(resultSet, inputSet.getAttributes().getLabel());
Collection<String> predictedLabelValues = null;
if (predictedLabel.isNominal()) {
predictedLabelValues = predictedLabel.getMapping().getValues();
}
// Split training / test set
int samplingType = getParameterAsInt(PARAMETER_SAMPLING_TYPE);
SplittedExampleSet splittedSet = new SplittedExampleSet(inputSet, number, samplingType,
getParameterAsBoolean(RandomGenerator.PARAMETER_USE_LOCAL_RANDOM_SEED),
getParameterAsInt(RandomGenerator.PARAMETER_LOCAL_RANDOM_SEED), getCompatibilityLevel().isAtMost(
SplittedExampleSet.VERSION_SAMPLING_CHANGED));
getProgress().setCompleted(1);
for (iteration = 0; iteration < number; iteration++) {
splittedSet.selectAllSubsetsBut(iteration);
trainingProcessExampleSource.deliver(splittedSet);
getSubprocess(0).execute();
// IOContainer learnResult = getLearner().apply(new IOContainer(new IOObject[] {
// splittedSet }));
splittedSet.selectSingleSubset(iteration);
applyProcessExampleSource.deliver(splittedSet);
throughExtender.passDataThrough();
applyProcessModelSource.deliver(trainingProcessModelSink.getData(IOObject.class));
getSubprocess(1).execute();
ExampleSet predictedSet = applyProcessExampleInnerSink.getData(ExampleSet.class);
for (int i = 0; i < splittedSet.size(); i++) {
Example predictedExample = predictedSet.getExample(i);
// setting label in inputSet
Example resultExample = resultSet.getExample(splittedSet.getActualParentIndex(i));
resultExample.setValue(predictedLabel, predictedExample.getPredictedLabel());
if (predictedLabel.isNominal()) {
for (String s : predictedLabelValues) {
resultExample.setConfidence(s, predictedExample.getConfidence(s));
}
}
}
// PredictionModel.removePredictedLabel(predictedSet);
inApplyLoop();
getProgress().step();
}
exampleSetOutput.deliver(resultSet);
getProgress().complete();
}
示例8: doWork
import com.rapidminer.operator.learner.CapabilityCheck; //导入依赖的package包/类
@Override
public void doWork() throws OperatorException {
ExampleSet inputSet = exampleSetInput.getData(ExampleSet.class);
// check capabilities and produce errors if they are not fulfilled
CapabilityCheck check = new CapabilityCheck(this, false);
check.checkLearnerCapabilities(this, inputSet);
if (getParameterAsBoolean(PARAMETER_LEAVE_ONE_OUT)) {
number = inputSet.size();
} else {
number = getParameterAsInt(PARAMETER_NUMBER_OF_VALIDATIONS);
}
log("Starting " + number + "-fold cross validation prediction");
// creating predicted label
ExampleSet resultSet = (ExampleSet) inputSet.clone();
Attribute predictedLabel = PredictionModel.createPredictedLabel(resultSet, inputSet.getAttributes().getLabel());
Collection<String> predictedLabelValues = null;
if (predictedLabel.isNominal())
predictedLabelValues = predictedLabel.getMapping().getValues();
// Split training / test set
int samplingType = getParameterAsInt(PARAMETER_SAMPLING_TYPE);
SplittedExampleSet splittedSet = new SplittedExampleSet(inputSet, number, samplingType, getParameterAsBoolean(RandomGenerator.PARAMETER_USE_LOCAL_RANDOM_SEED), getParameterAsInt(RandomGenerator.PARAMETER_LOCAL_RANDOM_SEED), getCompatibilityLevel().isAtMost(SplittedExampleSet.VERSION_SAMPLING_CHANGED));
for (iteration = 0; iteration < number; iteration++) {
splittedSet.selectAllSubsetsBut(iteration);
trainingProcessExampleSource.deliver(splittedSet);
getSubprocess(0).execute();
// IOContainer learnResult = getLearner().apply(new IOContainer(new IOObject[] { splittedSet }));
splittedSet.selectSingleSubset(iteration);
applyProcessExampleSource.deliver((IOObject) splittedSet);
throughExtender.passDataThrough();
applyProcessModelSource.deliver(trainingProcessModelSink.getData(IOObject.class));
getSubprocess(1).execute();
ExampleSet predictedSet = applyProcessExampleInnerSink.getData(ExampleSet.class);
for (int i = 0; i < splittedSet.size(); i++) {
Example predictedExample = predictedSet.getExample(i);
// setting label in inputSet
Example resultExample = resultSet.getExample(splittedSet.getActualParentIndex(i));
resultExample.setValue(predictedLabel, predictedExample.getPredictedLabel());
if (predictedLabel.isNominal()) {
for (String s : predictedLabelValues) {
resultExample.setConfidence(s, predictedExample.getConfidence(s));
}
}
}
//PredictionModel.removePredictedLabel(predictedSet);
inApplyLoop();
}
exampleSetOutput.deliver(resultSet);
}