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