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


Java MappedExampleSet.createWeightedBootstrappingMapping方法代码示例

本文整理汇总了Java中com.rapidminer.example.set.MappedExampleSet.createWeightedBootstrappingMapping方法的典型用法代码示例。如果您正苦于以下问题:Java MappedExampleSet.createWeightedBootstrappingMapping方法的具体用法?Java MappedExampleSet.createWeightedBootstrappingMapping怎么用?Java MappedExampleSet.createWeightedBootstrappingMapping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.rapidminer.example.set.MappedExampleSet的用法示例。


在下文中一共展示了MappedExampleSet.createWeightedBootstrappingMapping方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: estimatePerformance

import com.rapidminer.example.set.MappedExampleSet; //导入方法依赖的package包/类
@Override
public void estimatePerformance(ExampleSet inputSet) throws OperatorException {
	number = getParameterAsInt(PARAMETER_NUMBER_OF_VALIDATIONS);
	int size = (int) Math.round(inputSet.size() * getParameterAsDouble(PARAMETER_SAMPLE_RATIO));

	// start bootstrapping loop
	RandomGenerator random = RandomGenerator.getRandomGenerator(this);
	for (iteration = 0; iteration < number; iteration++) {
		
		int[] mapping = null;
		if (getParameterAsBoolean(PARAMETER_USE_WEIGHTS) && inputSet.getAttributes().getWeight() != null) {
			mapping = MappedExampleSet.createWeightedBootstrappingMapping(inputSet, size, random);
		} else {
	        mapping = MappedExampleSet.createBootstrappingMapping(inputSet, size, random);
		}
		MappedExampleSet trainingSet = new MappedExampleSet((ExampleSet)inputSet.clone(), mapping, true);
		learn(trainingSet);

		MappedExampleSet inverseExampleSet = new MappedExampleSet((ExampleSet)inputSet.clone(), mapping, false);            
		evaluate(inverseExampleSet);            
		inApplyLoop();
	}
	// end loop
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:25,代码来源:BootstrappingValidation.java

示例2: apply

import com.rapidminer.example.set.MappedExampleSet; //导入方法依赖的package包/类
@Override
public ExampleSet apply(ExampleSet exampleSet) throws OperatorException {         
	RandomGenerator random = RandomGenerator.getRandomGenerator(this);
	int size = exampleSet.size();
	switch (getParameterAsInt(PARAMETER_SAMPLE)) {
	case SAMPLE_ABSOLUTE:
		size = getParameterAsInt(PARAMETER_SAMPLE_SIZE);
		break;
	case SAMPLE_RELATIVE:
		size = (int) Math.round(exampleSet.size() * getParameterAsDouble(PARAMETER_SAMPLE_RATIO));
		break;
	}

	int[] mapping = null;
	if (getParameterAsBoolean(PARAMETER_USE_WEIGHTS) && exampleSet.getAttributes().getWeight() != null) {
		mapping = MappedExampleSet.createWeightedBootstrappingMapping(exampleSet, size, random);
	} else {
		mapping = MappedExampleSet.createBootstrappingMapping(exampleSet, size, random);
	}
	return new MappedExampleSet(exampleSet, mapping, true);
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:22,代码来源:BootstrappingOperator.java

示例3: estimatePerformance

import com.rapidminer.example.set.MappedExampleSet; //导入方法依赖的package包/类
@Override
public void estimatePerformance(ExampleSet inputSet) throws OperatorException {
	number = getParameterAsInt(PARAMETER_NUMBER_OF_VALIDATIONS);
	int size = (int) Math.round(inputSet.size() * getParameterAsDouble(PARAMETER_SAMPLE_RATIO));

	// start bootstrapping loop
	RandomGenerator random = RandomGenerator.getRandomGenerator(this);
	getProgress().setTotal(number);
	getProgress().setCheckForStop(false);

	for (iteration = 0; iteration < number; iteration++) {
		int[] mapping = null;
		if (getParameterAsBoolean(PARAMETER_USE_WEIGHTS) && inputSet.getAttributes().getWeight() != null) {
			mapping = MappedExampleSet.createWeightedBootstrappingMapping(inputSet, size, random);
		} else {
			mapping = MappedExampleSet.createBootstrappingMapping(inputSet, size, random);
		}
		MappedExampleSet trainingSet = new MappedExampleSet((ExampleSet) inputSet.clone(), mapping, true);
		learn(trainingSet);

		MappedExampleSet inverseExampleSet = new MappedExampleSet((ExampleSet) inputSet.clone(), mapping, false);
		evaluate(inverseExampleSet);
		inApplyLoop();
		getProgress().step();
	}
	// end loop
	getProgress().complete();
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:29,代码来源:BootstrappingValidation.java

示例4: createMapping

import com.rapidminer.example.set.MappedExampleSet; //导入方法依赖的package包/类
@Override
public int[] createMapping(ExampleSet exampleSet, int size, Random random) throws OperatorException {
	if (exampleSet.getAttributes().getWeight() == null) {
		throw new UserError(this, 113, Attributes.WEIGHT_NAME);
	}
	return MappedExampleSet.createWeightedBootstrappingMapping(exampleSet, size, random);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:8,代码来源:WeightedBootstrapping.java

示例5: apply

import com.rapidminer.example.set.MappedExampleSet; //导入方法依赖的package包/类
@Override
public ExampleSet apply(ExampleSet exampleSet) throws OperatorException {
	int size = exampleSet.size();

	// cannot bootstrap without any examples
	if (size < 1) {
		throw new UserError(this, 117);
	}

	RandomGenerator random = RandomGenerator.getRandomGenerator(this);
	switch (getParameterAsInt(PARAMETER_SAMPLE)) {
		case SAMPLE_ABSOLUTE:
			size = getParameterAsInt(PARAMETER_SAMPLE_SIZE);
			break;
		case SAMPLE_RELATIVE:
			size = (int) Math.round(exampleSet.size() * getParameterAsDouble(PARAMETER_SAMPLE_RATIO));
			break;
	}

	int[] mapping = null;
	if (getParameterAsBoolean(PARAMETER_USE_WEIGHTS) && exampleSet.getAttributes().getWeight() != null) {
		mapping = MappedExampleSet.createWeightedBootstrappingMapping(exampleSet, size, random);
	} else {
		mapping = MappedExampleSet.createBootstrappingMapping(exampleSet, size, random);
	}

	// create and materialize example set
	ExampleSet mappedExampleSet = new MappedExampleSet(exampleSet, mapping, true);
	if (getCompatibilityLevel().isAbove(VERSION_6_4_0)) {
		int type = DataRowFactory.TYPE_DOUBLE_ARRAY;
		if (exampleSet.size() > 0) {
			type = exampleSet.getExampleTable().getDataRow(0).getType();
		}
		mappedExampleSet = MaterializeDataInMemory.materializeExampleSet(mappedExampleSet, type);
	}
	return mappedExampleSet;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:38,代码来源:BootstrappingOperator.java

示例6: estimatePerformance

import com.rapidminer.example.set.MappedExampleSet; //导入方法依赖的package包/类
@Override
public void estimatePerformance(ExampleSet inputSet) throws OperatorException {
	boolean useWeights = getParameterAsBoolean(PARAMETER_USE_WEIGHTS);
	number = getParameterAsInt(PARAMETER_NUMBER_OF_VALIDATIONS);
	int size = (int) Math.round(inputSet.size() * getParameterAsDouble(PARAMETER_SAMPLE_RATIO));

	// start bootstrapping loop
	RandomGenerator random = RandomGenerator.getRandomGenerator(this);
	if (modelOutput.isConnected()) {
		getProgress().setTotal(number + 1);
	} else {
		getProgress().setTotal(number);
	}
	getProgress().setCheckForStop(false);

	for (iteration = 0; iteration < number; iteration++) {
		int[] mapping = null;
		if (useWeights && inputSet.getAttributes().getWeight() != null) {
			mapping = MappedExampleSet.createWeightedBootstrappingMapping(inputSet, size, random);
		} else {
			mapping = MappedExampleSet.createBootstrappingMapping(inputSet, size, random);
		}
		MappedExampleSet trainingSet = new MappedExampleSet(inputSet, mapping, true);
		learn(trainingSet);

		MappedExampleSet inverseExampleSet = new MappedExampleSet(inputSet, mapping, false);
		evaluate(inverseExampleSet);
		inApplyLoop();
		getProgress().step();
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:32,代码来源:BootstrappingValidation.java

示例7: apply

import com.rapidminer.example.set.MappedExampleSet; //导入方法依赖的package包/类
@Override
public ExampleSet apply(ExampleSet exampleSet) throws OperatorException {
	// cannot bootstrap without any examples
	Tools.isNonEmpty(exampleSet);
	int size = exampleSet.size();

	RandomGenerator random = RandomGenerator.getRandomGenerator(this);
	switch (getParameterAsInt(PARAMETER_SAMPLE)) {
		case SAMPLE_ABSOLUTE:
			size = getParameterAsInt(PARAMETER_SAMPLE_SIZE);
			break;
		case SAMPLE_RELATIVE:
			size = (int) Math.round(exampleSet.size() * getParameterAsDouble(PARAMETER_SAMPLE_RATIO));
			break;
	}

	int[] mapping = null;
	if (getParameterAsBoolean(PARAMETER_USE_WEIGHTS) && exampleSet.getAttributes().getWeight() != null) {
		mapping = MappedExampleSet.createWeightedBootstrappingMapping(exampleSet, size, random);
	} else {
		mapping = MappedExampleSet.createBootstrappingMapping(exampleSet, size, random);
	}

	// create and materialize example set
	ExampleSet mappedExampleSet = new MappedExampleSet(exampleSet, mapping, true);
	if (getCompatibilityLevel().isAbove(VERSION_6_4_0)) {
		int type = DataRowFactory.TYPE_DOUBLE_ARRAY;
		if (exampleSet.size() > 0) {
			type = exampleSet.getExampleTable().getDataRow(0).getType();
		}
		mappedExampleSet = MaterializeDataInMemory.materializeExampleSet(mappedExampleSet, type);
	}
	return mappedExampleSet;
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:35,代码来源:BootstrappingOperator.java

示例8: createMapping

import com.rapidminer.example.set.MappedExampleSet; //导入方法依赖的package包/类
@Override
protected int[] createMapping(ExampleSet exampleSet, int size, Random random) throws OperatorException {
	return MappedExampleSet.createWeightedBootstrappingMapping(exampleSet, size, random);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:5,代码来源:WeightedBootstrappingValidation.java

示例9: createMapping

import com.rapidminer.example.set.MappedExampleSet; //导入方法依赖的package包/类
@Override
protected int[] createMapping(ExampleSet exampleSet, int size, Random random) throws OperatorException {
       return MappedExampleSet.createWeightedBootstrappingMapping(exampleSet, size, random);
   }
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:5,代码来源:WeightedBootstrappingValidation.java

示例10: createMapping

import com.rapidminer.example.set.MappedExampleSet; //导入方法依赖的package包/类
@Override
public int[] createMapping(ExampleSet exampleSet, int size, Random random) throws OperatorException {
       if (exampleSet.getAttributes().getWeight() == null)
           throw new UserError(this, 113, Attributes.WEIGHT_NAME);
       return MappedExampleSet.createWeightedBootstrappingMapping(exampleSet, size, random);
   }
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:7,代码来源:WeightedBootstrapping.java


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