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


Java MaterializeDataInMemory类代码示例

本文整理汇总了Java中com.rapidminer.operator.preprocessing.MaterializeDataInMemory的典型用法代码示例。如果您正苦于以下问题:Java MaterializeDataInMemory类的具体用法?Java MaterializeDataInMemory怎么用?Java MaterializeDataInMemory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: apply

import com.rapidminer.operator.preprocessing.MaterializeDataInMemory; //导入依赖的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

示例2: doWork

import com.rapidminer.operator.preprocessing.MaterializeDataInMemory; //导入依赖的package包/类
@Override
public final void doWork() throws OperatorException {
	ExampleSet inputExampleSet = exampleSetInput.getData(ExampleSet.class);
	ExampleSet applySet = null;
	// check for needed copy of original exampleset
	if (writesIntoExistingData()) {
		int type = DataRowFactory.TYPE_DOUBLE_ARRAY;
		if (inputExampleSet.getExampleTable() instanceof MemoryExampleTable) {
			DataRowReader dataRowReader = inputExampleSet.getExampleTable().getDataRowReader();
			if (dataRowReader.hasNext()) {
				type = dataRowReader.next().getType();
			}
		}
		// check if type is supported to be copied
		if (type >= 0) {
			applySet = MaterializeDataInMemory.materializeExampleSet(inputExampleSet, type);
		}
	}

	if (applySet == null) {
		applySet = (ExampleSet) inputExampleSet.clone();
	}

	// we apply on the materialized data, because writing can't take place in views anyway.
	ExampleSet result = apply(applySet);
	originalOutput.deliver(inputExampleSet);
	exampleSetOutput.deliver(result);
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:29,代码来源:AbstractExampleSetProcessing.java

示例3: apply

import com.rapidminer.operator.preprocessing.MaterializeDataInMemory; //导入依赖的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

示例4: doWork

import com.rapidminer.operator.preprocessing.MaterializeDataInMemory; //导入依赖的package包/类
@Override
public final void doWork() throws OperatorException {
	ExampleSet inputExampleSet = exampleSetInput.getData(ExampleSet.class);
	ExampleSet applySet = null;
	// check for needed copy of original exampleset
	if (originalOutput.isConnected() && writesIntoExistingData()) {
		int type = DataRowFactory.TYPE_DOUBLE_ARRAY;
		if (inputExampleSet.getExampleTable() instanceof MemoryExampleTable) {
			DataRowReader dataRowReader = inputExampleSet.getExampleTable().getDataRowReader();
			if (dataRowReader.hasNext()) {
				type = dataRowReader.next().getType();
			}
		}
		// check if type is supported to be copied
		if (type >= 0) {
			applySet = MaterializeDataInMemory.materializeExampleSet(inputExampleSet, type);
		}
	}
	
	if (applySet == null)
		applySet = (ExampleSet) inputExampleSet.clone();

	// we apply on the materialized data, because writing can't take place in views anyway. 
	ExampleSet result = apply(applySet);
	originalOutput.deliver(inputExampleSet);
	exampleSetOutput.deliver(result);
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:28,代码来源:AbstractExampleSetProcessing.java


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