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


Java CapabilityCheck类代码示例

本文整理汇总了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);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:26,代码来源:AbstractMetaLearner.java

示例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);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:26,代码来源:RelevanceTreeLearner.java

示例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);
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:26,代码来源:AbstractMetaLearner.java

示例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);
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:19,代码来源:RelevanceTreeLearner.java

示例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);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:16,代码来源:AbstractWeighting.java

示例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);
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:13,代码来源:AbstractWeighting.java

示例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();
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:72,代码来源:XVPrediction.java

示例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);
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:58,代码来源:XVPrediction.java


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