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