當前位置: 首頁>>代碼示例>>Java>>正文


Java AttributeDataSourceCreator類代碼示例

本文整理匯總了Java中com.rapidminer.tools.att.AttributeDataSourceCreator的典型用法代碼示例。如果您正苦於以下問題:Java AttributeDataSourceCreator類的具體用法?Java AttributeDataSourceCreator怎麽用?Java AttributeDataSourceCreator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AttributeDataSourceCreator類屬於com.rapidminer.tools.att包,在下文中一共展示了AttributeDataSourceCreator類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createExampleSet

import com.rapidminer.tools.att.AttributeDataSourceCreator; //導入依賴的package包/類
public static ExampleSet createExampleSet(File file, boolean firstRowAsColumnNames, double sampleRatio, int maxLines,
		String separatorRegExpr, char[] comments, int dataRowType, boolean useQuotes, boolean trimLines,
		boolean skipErrorLines, char decimalPointCharacter, Charset encoding, String labelName, int labelColumn,
		String idName, int idColumn, String weightName, int weightColumn) throws IOException, UserError,
		IndexOutOfBoundsException {
	// create attribute data sources and guess value types (performs a data scan)
	AttributeDataSourceCreator adsCreator = new AttributeDataSourceCreator();

	adsCreator.loadData(file, comments, separatorRegExpr, decimalPointCharacter, useQuotes, '"', '\\', trimLines,
			firstRowAsColumnNames, -1, skipErrorLines, encoding, null);

	List<AttributeDataSource> attributeDataSources = adsCreator.getAttributeDataSources();

	// set special attributes
	resetAttributeType(attributeDataSources, labelName, labelColumn, Attributes.LABEL_NAME);
	resetAttributeType(attributeDataSources, idName, idColumn, Attributes.ID_NAME);
	resetAttributeType(attributeDataSources, weightName, weightColumn, Attributes.WEIGHT_NAME);

	// read data
	FileDataRowReader reader = new FileDataRowReader(new DataRowFactory(dataRowType, decimalPointCharacter),
			attributeDataSources, sampleRatio, maxLines, separatorRegExpr, comments, useQuotes, '"', '\\', trimLines,
			skipErrorLines, encoding, RandomGenerator.getGlobalRandomGenerator());
	if (firstRowAsColumnNames) {
		reader.skipLine();
	}

	AttributeSet attributeSet = new AttributeSet(new AttributeDataSources(attributeDataSources, file, encoding));

	// create table and example set
	ExampleTable table = new MemoryExampleTable(attributeSet.getAllAttributes(), reader);
	ExampleSet result = table.createExampleSet(attributeSet);

	return result;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:35,代碼來源:SimpleExampleSource.java

示例2: createExampleSet

import com.rapidminer.tools.att.AttributeDataSourceCreator; //導入依賴的package包/類
public static ExampleSet createExampleSet(File file, boolean firstRowAsColumnNames, double sampleRatio, int maxLines,
		String separatorRegExpr, char[] comments, int dataRowType, boolean useQuotes, boolean trimLines,
		boolean skipErrorLines, char decimalPointCharacter, Charset encoding, String labelName, int labelColumn,
		String idName, int idColumn, String weightName, int weightColumn) throws IOException, UserError,
		IndexOutOfBoundsException {
	// create attribute data sources and guess value types (performs a data scan)
	AttributeDataSourceCreator adsCreator = new AttributeDataSourceCreator();

	adsCreator.loadData(file, comments, separatorRegExpr, decimalPointCharacter, useQuotes, '"', '\\', trimLines,
			firstRowAsColumnNames, -1, skipErrorLines, encoding, null);

	List<AttributeDataSource> attributeDataSources = adsCreator.getAttributeDataSources();

	// set special attributes
	resetAttributeType(attributeDataSources, labelName, labelColumn, Attributes.LABEL_NAME);
	resetAttributeType(attributeDataSources, idName, idColumn, Attributes.ID_NAME);
	resetAttributeType(attributeDataSources, weightName, weightColumn, Attributes.WEIGHT_NAME);

	// read data
	FileDataRowReader reader = new FileDataRowReader(new DataRowFactory(dataRowType, decimalPointCharacter),
			attributeDataSources, sampleRatio, maxLines, separatorRegExpr, comments, useQuotes, '"', '\\', trimLines,
			skipErrorLines, encoding, RandomGenerator.getGlobalRandomGenerator());
	if (firstRowAsColumnNames) {
		reader.skipLine();
	}

	AttributeSet attributeSet = new AttributeSet(new AttributeDataSources(attributeDataSources, file, encoding));

	// create table and example set
	ExampleSetBuilder builder = ExampleSets.from(attributeSet.getAllAttributes()).withDataRowReader(reader);
	attributeSet.getSpecialAttributes().entrySet().stream()
			.forEach(entry -> builder.withRole(entry.getValue(), entry.getKey()));
	return builder.build();
}
 
開發者ID:rapidminer,項目名稱:rapidminer-studio,代碼行數:35,代碼來源:SimpleExampleSource.java

示例3: createExampleSet

import com.rapidminer.tools.att.AttributeDataSourceCreator; //導入依賴的package包/類
public static ExampleSet createExampleSet(File file, boolean firstRowAsColumnNames, double sampleRatio, int maxLines, String separatorRegExpr, char[] comments, int dataRowType, boolean useQuotes, boolean trimLines, boolean skipErrorLines, char decimalPointCharacter, Charset encoding, String labelName, int labelColumn, String idName, int idColumn, String weightName, int weightColumn) throws IOException, UserError, IndexOutOfBoundsException {
	// create attribute data sources and guess value types (performs a data scan)
	AttributeDataSourceCreator adsCreator = new AttributeDataSourceCreator();

	adsCreator.loadData(file, comments, separatorRegExpr, decimalPointCharacter, useQuotes, '"', '\\', trimLines, firstRowAsColumnNames, -1, skipErrorLines, encoding, null);

	List<AttributeDataSource> attributeDataSources = adsCreator.getAttributeDataSources();

	// set special attributes
	resetAttributeType(attributeDataSources, labelName, labelColumn, Attributes.LABEL_NAME);
	resetAttributeType(attributeDataSources, idName, idColumn, Attributes.ID_NAME);
	resetAttributeType(attributeDataSources, weightName, weightColumn, Attributes.WEIGHT_NAME);

	// read data
	FileDataRowReader reader = new FileDataRowReader(new DataRowFactory(dataRowType, decimalPointCharacter), attributeDataSources, sampleRatio, maxLines, separatorRegExpr, comments, useQuotes, '"', '\\', trimLines, skipErrorLines, encoding,  RandomGenerator.getGlobalRandomGenerator());
	if (firstRowAsColumnNames) {
		reader.skipLine();
	}

	AttributeSet attributeSet = new AttributeSet(new AttributeDataSources(attributeDataSources, file, encoding));

	// create table and example set
	ExampleTable table = new MemoryExampleTable(attributeSet.getAllAttributes(), reader);
	ExampleSet result = table.createExampleSet(attributeSet);

	return result;		
}
 
開發者ID:rapidminer,項目名稱:rapidminer-5,代碼行數:28,代碼來源:SimpleExampleSource.java


注:本文中的com.rapidminer.tools.att.AttributeDataSourceCreator類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。