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