當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。