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


Java AttributeDataSources类代码示例

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


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

示例1: createExampleSet

import com.rapidminer.tools.att.AttributeDataSources; //导入依赖的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.AttributeDataSources; //导入依赖的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.AttributeDataSources; //导入依赖的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.AttributeDataSources类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。