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

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

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

Attributes.<init>介绍

暂无

代码示例

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

/**
 * Creates a set of {@link Attributes} from a given {@code Enumeration} of {@link weka.core.Attribute}s.
 * @param attributesEnumeration an {@code Enumeration} of {@link weka.core.Attribute}s
 * @return a set of {@link Attributes}.
 */
public static Attributes convertAttributes(Enumeration<weka.core.Attribute> attributesEnumeration){
  weka.core.Attribute attrWeka;
  List<Attribute> attrList = new ArrayList<>();
  /* Predictive attributes */
  while (attributesEnumeration.hasMoreElements()) {
    attrWeka = (weka.core.Attribute) attributesEnumeration.nextElement();
    convertAttribute(attrWeka,attrList);
  }
  return new Attributes(attrList);
}

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

/**
 * Creates a set of {@link Attributes} from a given {@code Enumeration} of {@link weka.core.Attribute}s.
 * @param attributesEnumeration an {@code Enumeration} of {@link weka.core.Attribute}s
 * @return a set of {@link Attributes}.
 */
public static Attributes convertAttributes(Enumeration<weka.core.Attribute> attributesEnumeration){
  weka.core.Attribute attrWeka;
  List<Attribute> attrList = new ArrayList<>();
  /* Predictive attributes */
  while (attributesEnumeration.hasMoreElements()) {
    attrWeka = (weka.core.Attribute) attributesEnumeration.nextElement();
    convertAttribute(attrWeka,attrList);
  }
  return new Attributes(attrList);
}

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

/**
 * Creates a set of {@link Attributes}, including the class, from a given {@code Enumeration}
 * of {@link weka.core.Attribute}s and a {@link weka.core.Attribute}.
 * @param attributesEnumeration an {@code Enumeration} of {@link weka.core.Attribute}s
 * @param classAtt a {@link weka.core.Attribute} object that represents the class variable.
 * @return a set of {@link Attributes}.
 */
public static Attributes convertAttributes(Enumeration<weka.core.Attribute> attributesEnumeration,
                      weka.core.Attribute classAtt){
  weka.core.Attribute attrWeka;
  List<Attribute> attrList = new ArrayList<>();
  /* Predictive attributes */
  while (attributesEnumeration.hasMoreElements()) {
    attrWeka = (weka.core.Attribute) attributesEnumeration.nextElement();
    convertAttribute(attrWeka,attrList);
  }
  convertAttribute(classAtt, attrList);
  return new Attributes(attrList);
}

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

/**
 * Creates a set of {@link Attributes}, including the class, from a given {@code Enumeration}
 * of {@link weka.core.Attribute}s and a {@link weka.core.Attribute}.
 * @param attributesEnumeration an {@code Enumeration} of {@link weka.core.Attribute}s
 * @param classAtt a {@link weka.core.Attribute} object that represents the class variable.
 * @return a set of {@link Attributes}.
 */
public static Attributes convertAttributes(Enumeration<weka.core.Attribute> attributesEnumeration,
                      weka.core.Attribute classAtt){
  weka.core.Attribute attrWeka;
  List<Attribute> attrList = new ArrayList<>();
  /* Predictive attributes */
  while (attributesEnumeration.hasMoreElements()) {
    attrWeka = (weka.core.Attribute) attributesEnumeration.nextElement();
    convertAttribute(attrWeka,attrList);
  }
  convertAttribute(classAtt, attrList);
  return new Attributes(attrList);
}

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

attributes = new Attributes(atts);
}catch (Exception ex){
  throw new UndeclaredThrowableException(ex);

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

.collect(Collectors.toList());
  attributes = new Attributes(atts);
}catch (Exception ex){
  throw new UndeclaredThrowableException(ex);

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

return new Attributes(attributesList);

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

Attributes att2 = new Attributes(list);

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

att2.add(attseq);
att2.add(atttime);
newAttributes = new Attributes(att2);

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

Variables variables = new Variables(new Attributes(attributes));
DAG dag = new DAG(variables);

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

att2.add(attseq);
att2.add(atttime);
newAttributes = new Attributes(att2);

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

Attributes attributes = new Attributes(listOfAttributes);
DynamicVariables dynamicVariables = new DynamicVariables(attributes);
DynamicDAG dynamicDAG  = new DynamicDAG(dynamicVariables);

相关文章