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

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

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

Attribute.<init>介绍

暂无

代码示例

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

public DataStreamFromStreamOfAssignments(Variables variables, Stream<Assignment> stream){
  this.variables = variables;
  this.stream = stream;
  List<Attribute> list = this.variables.getListOfVariables().stream()
      .map(var -> new Attribute(var.getVarID(), var.getName(), var.getStateSpaceType())).collect(Collectors.toList());
  this.atts= new Attributes(list);
}

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

/**
 * Creates a new temporal data stream.
 * @param sampler1 a {@link DynamicBayesianNetworkSampler} object.
 * @param nSequences1 an {@code int} that represents the number of sequences in the data stream to be sampled.
 * @param sequenceLength1 an {@code int} that represents the length of each sequence.
 */
TemporalDataStream(DynamicBayesianNetworkSampler sampler1, int nSequences1, int sequenceLength1){
  this.sampler=sampler1;
  this.nSequences = nSequences1;
  this.sequenceLength = sequenceLength1;
  List<Attribute> list = new ArrayList<>();
  list.add(new Attribute(0,Attributes.SEQUENCE_ID_ATT_NAME, new RealStateSpace()));
  list.add(new Attribute(1,Attributes.TIME_ID_ATT_NAME, new RealStateSpace()));
  list.addAll(this.sampler.network.getDynamicVariables().getListOfDynamicVariables().stream()
      .filter(var -> !sampler1.getLatentVars().contains(var))
      .map(var -> new Attribute(var.getVarID() + 2, var.getName(), var.getStateSpaceType())).collect(Collectors.toList()));
  this.atts= new Attributes(list);
}

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

attributesList.add( new Attribute(i, name, stateSpace) );

代码示例来源: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

DataFlink<DataInstance> data= sampler.sampleToDataFlink(env, this.nSamples);
Attribute attseq = new Attribute(data.getAttributes().getNumberOfAttributes(),Attributes.SEQUENCE_ID_ATT_NAME, new RealStateSpace());
Attribute atttime = new Attribute(data.getAttributes().getNumberOfAttributes()+1,Attributes.TIME_ID_ATT_NAME, new RealStateSpace());

代码示例来源: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

/**
   * Converts a {@link weka.core.Attribute} object to an amidst {@link Attribute} and add it to the current list of attributes.
   * @param attrWeka a {@link weka.core.Attribute} object.
   * @param attrList a {@code List} of {@link Attributes}.
   */
  private static void convertAttribute(weka.core.Attribute attrWeka, List<Attribute> attrList){
    StateSpaceType stateSpaceTypeAtt;
    if(attrWeka.isNominal()){
      String[] vals = new String[attrWeka.numValues()];
      for (int i=0; i<attrWeka.numValues(); i++) {
        vals[i] = attrWeka.value(i);
      }
      stateSpaceTypeAtt = new FiniteStateSpace(attrWeka.numValues());
    }else{
      stateSpaceTypeAtt = new RealStateSpace();
    }
    Attribute att = new Attribute(attrWeka.index(),attrWeka.name(), stateSpaceTypeAtt);
    attrList.add(att);
  }
}

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

/**
   * Converts a {@link weka.core.Attribute} object to an amidst {@link Attribute} and add it to the current list of attributes.
   * @param attrWeka a {@link weka.core.Attribute} object.
   * @param attrList a {@code List} of {@link Attributes}.
   */
  private static void convertAttribute(weka.core.Attribute attrWeka, List<Attribute> attrList){
    StateSpaceType stateSpaceTypeAtt;
    if(attrWeka.isNominal()){
      String[] vals = new String[attrWeka.numValues()];
      for (int i=0; i<attrWeka.numValues(); i++) {
        vals[i] = attrWeka.value(i);
      }
      stateSpaceTypeAtt = new FiniteStateSpace(attrWeka.numValues());
    }else{
      stateSpaceTypeAtt = new RealStateSpace();
    }
    Attribute att = new Attribute(attrWeka.index(),attrWeka.name(), stateSpaceTypeAtt);
    attrList.add(att);
  }
}

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

DataFlink<DataInstance> data= sampler.sampleToDataFlink(env,this.nSamples);
Attribute attseq = new Attribute(data.getAttributes().getNumberOfAttributes(),Attributes.SEQUENCE_ID_ATT_NAME, new RealStateSpace());
Attribute atttime = new Attribute(data.getAttributes().getNumberOfAttributes()+1,Attributes.TIME_ID_ATT_NAME, new RealStateSpace());

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

if (n.getKind().compareTo(NetworkModel.H_KIND_DISCRETE) == 0) {
  int numStates = (int)((DiscreteChanceNode)n).getNumberOfStates();
  attributes.add(new Attribute(i, n.getName(), new FiniteStateSpace(numStates)));
  attributes.add(new Attribute(i, n.getName(), new RealStateSpace()));

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

listOfAttributes.add(new Attribute(i, n.getName(), new FiniteStateSpace(numStates)));

相关文章

微信公众号

最新文章

更多