本文整理汇总了Java中com.rapidminer.example.set.SimpleExampleSet类的典型用法代码示例。如果您正苦于以下问题:Java SimpleExampleSet类的具体用法?Java SimpleExampleSet怎么用?Java SimpleExampleSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SimpleExampleSet类属于com.rapidminer.example.set包,在下文中一共展示了SimpleExampleSet类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createExampleSet
import com.rapidminer.example.set.SimpleExampleSet; //导入依赖的package包/类
/**
* Returns a new example set with all attributes switched on. The given attributes will be used
* as a special label attribute for learning, as (example) weight attribute, and as id
* attribute.
*/
@Override
public ExampleSet createExampleSet(Attribute labelAttribute, Attribute weightAttribute, Attribute idAttribute) {
Map<Attribute, String> specialAttributes = new HashMap<>();
if (labelAttribute != null) {
specialAttributes.put(labelAttribute, Attributes.LABEL_NAME);
}
if (weightAttribute != null) {
specialAttributes.put(weightAttribute, Attributes.WEIGHT_NAME);
}
if (idAttribute != null) {
specialAttributes.put(idAttribute, Attributes.ID_NAME);
}
return new SimpleExampleSet(this, specialAttributes);
}
示例2: apply
import com.rapidminer.example.set.SimpleExampleSet; //导入依赖的package包/类
@Override
public ExampleSet apply(ExampleSet exampleSet) throws OperatorException {
// perform stratified sampling
SplittedExampleSet splittedExampleSet = new SplittedExampleSet(exampleSet, getRatio(exampleSet),
SplittedExampleSet.STRATIFIED_SAMPLING,
getParameterAsBoolean(RandomGenerator.PARAMETER_USE_LOCAL_RANDOM_SEED),
getParameterAsInt(RandomGenerator.PARAMETER_LOCAL_RANDOM_SEED));
splittedExampleSet.selectSingleSubset(0);
// fill new table
List<DataRow> dataList = new LinkedList<DataRow>();
Iterator<Example> reader = splittedExampleSet.iterator();
while (reader.hasNext()) {
Example example = reader.next();
dataList.add(example.getDataRow());
checkForStop();
}
List<Attribute> attributes = Arrays.asList(splittedExampleSet.getExampleTable().getAttributes());
ExampleTable exampleTable = new MemoryExampleTable(attributes, new ListDataRowReader(dataList.iterator()));
// regular attributes
List<Attribute> regularAttributes = new LinkedList<Attribute>();
for (Attribute attribute : exampleSet.getAttributes()) {
regularAttributes.add(attribute);
}
// special attributes
ExampleSet result = new SimpleExampleSet(exampleTable, regularAttributes);
Iterator<AttributeRole> special = exampleSet.getAttributes().specialAttributes();
while (special.hasNext()) {
AttributeRole role = special.next();
result.getAttributes().setSpecialAttribute(role.getAttribute(), role.getSpecialName());
}
return result;
}
示例3: makeStatisticsSet
import com.rapidminer.example.set.SimpleExampleSet; //导入依赖的package包/类
@Override
public IExampleSet makeStatisticsSet(IDataSet dataSet) throws Exception {
MemoryDataSet memoryDataSet = new MemoryDataSet(dataSet);
DataSetReader reader = new DataSetReader(null, memoryDataSet.getColumnMetaData(), true);
StatisticsSet statSet = new StatisticsSet((SimpleExampleSet) reader.read(memoryDataSet, null));
return statSet;
}
示例4: createExampleSet
import com.rapidminer.example.set.SimpleExampleSet; //导入依赖的package包/类
/**
* Returns a new example set with all attributes switched on. The given attributes will be used
* as a special label attribute for learning, as (example) weight attribute, and as id
* attribute.
*/
@Override
public ExampleSet createExampleSet(Attribute labelAttribute, Attribute weightAttribute, Attribute idAttribute) {
Map<Attribute, String> specialAttributes = new LinkedHashMap<>();
if (labelAttribute != null) {
specialAttributes.put(labelAttribute, Attributes.LABEL_NAME);
}
if (weightAttribute != null) {
specialAttributes.put(weightAttribute, Attributes.WEIGHT_NAME);
}
if (idAttribute != null) {
specialAttributes.put(idAttribute, Attributes.ID_NAME);
}
return new SimpleExampleSet(this, specialAttributes);
}
示例5: createExampleSet
import com.rapidminer.example.set.SimpleExampleSet; //导入依赖的package包/类
/**
* Returns a new example set with all attributes switched on. The
* given attributes will be used as a special label attribute for learning,
* as (example) weight attribute, and as id attribute.
*/
public ExampleSet createExampleSet(Attribute labelAttribute, Attribute weightAttribute, Attribute idAttribute) {
Map<Attribute, String> specialAttributes = new HashMap<Attribute, String>();
if (labelAttribute != null)
specialAttributes.put(labelAttribute, Attributes.LABEL_NAME);
if (weightAttribute != null)
specialAttributes.put(weightAttribute, Attributes.WEIGHT_NAME);
if (idAttribute != null)
specialAttributes.put(idAttribute, Attributes.ID_NAME);
return new SimpleExampleSet(this, specialAttributes);
}
示例6: apply
import com.rapidminer.example.set.SimpleExampleSet; //导入依赖的package包/类
@Override
public ExampleSet apply(ExampleSet exampleSet) throws OperatorException {
Tools.onlyNonMissingValues(exampleSet, "Fourier Transform");
// create new example table
int numberOfNewExamples = FastFourierTransform.getGreatestPowerOf2LessThan(exampleSet.size()) / 2;
ExampleTable exampleTable = new MemoryExampleTable(new LinkedList<Attribute>(), new DataRowFactory(DataRowFactory.TYPE_DOUBLE_ARRAY, '.'), numberOfNewExamples);
// create frequency attribute (for frequency)
Attribute frequencyAttribute = AttributeFactory.createAttribute("frequency", Ontology.REAL);
exampleTable.addAttribute(frequencyAttribute);
DataRowReader drr = exampleTable.getDataRowReader();
int k = 0;
while (drr.hasNext()) {
DataRow dataRow = drr.next();
dataRow.set(frequencyAttribute, FastFourierTransform.convertFrequency(k++, numberOfNewExamples, exampleSet.size()));
}
// create FFT values
Attribute label = exampleSet.getAttributes().getLabel();
// add FFT values
FastFourierTransform fft = new FastFourierTransform(WindowFunction.BLACKMAN_HARRIS);
SpectrumFilter filter = new SpectrumFilter(SpectrumFilter.NONE);
for (Attribute current : exampleSet.getAttributes()) {
if (current.isNumerical()) {
Complex[] result = fft.getFourierTransform(exampleSet, label, current);
Peak[] spectrum = filter.filter(result, exampleSet.size());
// create new attribute and fill table with values
Attribute newAttribute = AttributeFactory.createAttribute("fft(" + current.getName() + ")", Ontology.REAL);
exampleTable.addAttribute(newAttribute);
fillTable(exampleTable, newAttribute, spectrum);
}
}
ExampleSet resultSet = new SimpleExampleSet(exampleTable);
return resultSet;
}
示例7: apply
import com.rapidminer.example.set.SimpleExampleSet; //导入依赖的package包/类
@Override
public ExampleSet apply(ExampleSet exampleSet) throws OperatorException {
// perform stratified sampling
SplittedExampleSet splittedExampleSet = new SplittedExampleSet(exampleSet, getRatio(exampleSet), SplittedExampleSet.STRATIFIED_SAMPLING, getParameterAsBoolean(RandomGenerator.PARAMETER_USE_LOCAL_RANDOM_SEED), getParameterAsInt(RandomGenerator.PARAMETER_LOCAL_RANDOM_SEED));
splittedExampleSet.selectSingleSubset(0);
// fill new table
List<DataRow> dataList = new LinkedList<DataRow>();
Iterator<Example> reader = splittedExampleSet.iterator();
while (reader.hasNext()) {
Example example = reader.next();
dataList.add(example.getDataRow());
checkForStop();
}
List<Attribute> attributes = Arrays.asList(splittedExampleSet.getExampleTable().getAttributes());
ExampleTable exampleTable = new MemoryExampleTable(attributes, new ListDataRowReader(dataList.iterator()));
// regular attributes
List<Attribute> regularAttributes = new LinkedList<Attribute>();
for (Attribute attribute : exampleSet.getAttributes()) {
regularAttributes.add(attribute);
}
// special attributes
ExampleSet result = new SimpleExampleSet(exampleTable, regularAttributes);
Iterator<AttributeRole> special = exampleSet.getAttributes().specialAttributes();
while (special.hasNext()) {
AttributeRole role = special.next();
result.getAttributes().setSpecialAttribute(role.getAttribute(), role.getSpecialName());
}
return result;
}
示例8: StatisticsSet
import com.rapidminer.example.set.SimpleExampleSet; //导入依赖的package包/类
public StatisticsSet(SimpleExampleSet examples) {
super(examples);
}
示例9: apply
import com.rapidminer.example.set.SimpleExampleSet; //导入依赖的package包/类
@Override
public ExampleSet apply(ExampleSet exampleSet) throws OperatorException {
Tools.onlyNonMissingValues(exampleSet, getOperatorClassName(), this);
// create new example table
int numberOfNewExamples = FastFourierTransform.getGreatestPowerOf2LessThan(exampleSet.size()) / 2;
ExampleTable exampleTable = new MemoryExampleTable(new LinkedList<Attribute>(), new DataRowFactory(
DataRowFactory.TYPE_DOUBLE_ARRAY, '.'), numberOfNewExamples);
// create frequency attribute (for frequency)
Attribute frequencyAttribute = AttributeFactory.createAttribute("frequency", Ontology.REAL);
exampleTable.addAttribute(frequencyAttribute);
DataRowReader drr = exampleTable.getDataRowReader();
int k = 0;
while (drr.hasNext()) {
DataRow dataRow = drr.next();
dataRow.set(frequencyAttribute,
FastFourierTransform.convertFrequency(k++, numberOfNewExamples, exampleSet.size()));
}
// create FFT values
Attribute label = exampleSet.getAttributes().getLabel();
// add FFT values
FastFourierTransform fft = new FastFourierTransform(WindowFunction.BLACKMAN_HARRIS);
SpectrumFilter filter = new SpectrumFilter(SpectrumFilter.NONE);
for (Attribute current : exampleSet.getAttributes()) {
if (current.isNumerical()) {
Complex[] result = fft.getFourierTransform(exampleSet, label, current);
Peak[] spectrum = filter.filter(result, exampleSet.size());
// create new attribute and fill table with values
Attribute newAttribute = AttributeFactory.createAttribute("fft(" + current.getName() + ")", Ontology.REAL);
exampleTable.addAttribute(newAttribute);
fillTable(exampleTable, newAttribute, spectrum);
}
}
ExampleSet resultSet = new SimpleExampleSet(exampleTable);
return resultSet;
}