eu.amidst.core.datastream.Attribute.getIndex()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中eu.amidst.core.datastream.Attribute.getIndex()方法的一些代码示例,展示了Attribute.getIndex()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attribute.getIndex()方法的具体详情如下:
包路径:eu.amidst.core.datastream.Attribute
类名称:Attribute
方法名:getIndex

Attribute.getIndex介绍

暂无

代码示例

代码示例来源:origin: amidst/toolbox

@Override
public void setValue(Attribute att, double value) {
  row[att.getIndex()] = value;
}

代码示例来源:origin: amidst/toolbox

@Override
public double getValue(Attribute att) {
  return row[att.getIndex()];
}

代码示例来源:origin: amidst/toolbox

/**
 * {@inheritDoc}
 */
@Override
public double getValue(Attribute att) {
  return dataRow.value(att.getIndex());
}

代码示例来源:origin: amidst/toolbox

/**
 * {@inheritDoc}
 */
@Override
public void setValue(Attribute att, double value) {
  dataRow.setValue(att.getIndex(), value);
}

代码示例来源:origin: amidst/toolbox

/**
 * {@inheritDoc}
 */
@Override
public double getValue(Attribute att) {
  return dataRow.value(att.getIndex());
}

代码示例来源:origin: amidst/toolbox

@Override
public double getValue(Attribute att) {
  return this.assignment.getValue(variables.get(att.getIndex()));
}

代码示例来源:origin: amidst/toolbox

/**
 * {@inheritDoc}
 */
@Override
public void setValue(Attribute att, double value) {
  dataRow.setValue(att.getIndex(), value);
}

代码示例来源:origin: amidst/toolbox

/**
 * {@inheritDoc}
 */
@Override
public void setValue(Attribute att, double val, boolean present) {
  if (att.getIndex() == 0) {
    this.sequenceID = (int)val;
  } else if (att.getIndex() == 1){
    this.timeID = (int) val;
  }else {
    this.setValue(dbn.getDynamicVariables().getVariableById(att.getIndex() - 2), val);
  }
}

代码示例来源:origin: amidst/toolbox

/**
 * {@inheritDoc}
 */
@Override
public double getValue(Attribute att, boolean present) {
  if (att.getIndex() == 0) {
    return this.sequenceID;
  } else if (att.getIndex() == 1){
    return this.timeID;
  }else{
    return this.getValue(dbn.getDynamicVariables().getVariableById(att.getIndex() - 2));
  }
}

代码示例来源:origin: amidst/toolbox

@Override
public void setValue(Attribute att, double value) {
  if (!att.isSpecialAttribute())
    this.assignment.setValue(variables.get(att.getIndex()), value);
}

代码示例来源:origin: amidst/toolbox

.collect(Collectors.toList());
  Collections.sort(atts, (a,b) -> a.getIndex() - b.getIndex() );
  attributes = new Attributes(atts);
}catch (Exception ex){

代码示例来源:origin: amidst/toolbox

public static void main(String[] args) throws Exception{
  int nContinuousAttributes=0;
  int nDiscreteAttributes=5;
  String names[] = {"SEQUENCE_ID", "TIME_ID","DEFAULT","Income","Expenses","Balance","TotalCredit"};
  String path = "datasets/simulated/";
  int nSamples=1000;
  String filename="bank_data_test";
  int seed = filename.hashCode();
  //Generate random dynamic data
  DataStream<DynamicDataInstance> data  = DataSetGenerator.generate(seed,nSamples,nDiscreteAttributes,nContinuousAttributes);
  List<Attribute> list = new ArrayList<Attribute>();
  //Replace the names
  IntStream.range(0, data.getAttributes().getNumberOfAttributes())
      .forEach(i -> {
        Attribute a = data.getAttributes().getFullListOfAttributes().get(i);
        StateSpaceType s = a.getStateSpaceType();
        Attribute a2 = new Attribute(a.getIndex(), names[i],s);
        list.add(a2);
      });
  //New list of attributes
  Attributes att2 = new Attributes(list);
  List<DynamicDataInstance> listData = data.stream().collect(Collectors.toList());
  //Datastream with the new attribute names
  DataStream<DynamicDataInstance> data2 =
      new DataOnMemoryListContainer<DynamicDataInstance>(att2,listData);
  //Write to a single file
  DataStreamWriter.writeDataToFile(data2, path+filename+".arff");
}

代码示例来源:origin: amidst/toolbox

public static void main(String[] args) throws Exception{
  int nContinuousAttributes=4;
  int nDiscreteAttributes=1;
  String names[] = {"SEQUENCE_ID", "TIME_ID","Default","Income","Expenses","Balance","TotalCredit"};
  String path = "datasets/simulated/";
  int nSamples=1000;
  int seed = 11234;
  String filename="bank_data_test";
  //Generate random dynamic data
  DataStream<DynamicDataInstance> data  = DataSetGenerator.generate(seed,nSamples,nDiscreteAttributes,nContinuousAttributes);
  List<Attribute> list = new ArrayList<Attribute>();
  //Replace the names
  IntStream.range(0, data.getAttributes().getNumberOfAttributes())
      .forEach(i -> {
        Attribute a = data.getAttributes().getFullListOfAttributes().get(i);
        StateSpaceType s = a.getStateSpaceType();
        Attribute a2 = new Attribute(a.getIndex(), names[i],s);
        list.add(a2);
      });
  //New list of attributes
  Attributes att2 = new Attributes(list);
  List<DynamicDataInstance> listData = data.stream().collect(Collectors.toList());
  //Datastream with the new attribute names
  DataStream<DynamicDataInstance> data2 =
      new DataOnMemoryListContainer<DynamicDataInstance>(att2,listData);
  //Write to a single file
  DataStreamWriter.writeDataToFile(data2, path+filename+".arff");
}

代码示例来源:origin: amidst/toolbox

Attribute a = data.getAttributes().getFullListOfAttributes().get(i);
  StateSpaceType s = a.getStateSpaceType();
  Attribute a2 = new Attribute(a.getIndex(), names[i],s);
  list.add(a2);
});

代码示例来源:origin: amidst/toolbox

model.setClassVarID(data.getAttributes().getAttributeByName("DEFAULT").getIndex() + 2);
model.setParallelMode(true);
model.learn(data);

相关文章

微信公众号

最新文章

更多