weka.core.Instances.stream()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(128)

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

Instances.stream介绍

暂无

代码示例

代码示例来源:origin: Waikato/wekaDeeplearning4j

@Override
public List<String> getLabels() {
 return data.stream()
   .map(Instance::classValue)
   .map(String::valueOf)
   .distinct()
   .sorted()
   .collect(Collectors.toList());
}

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

@Override
public void buildClusterer(Instances data) throws Exception {
  attributes_ = Converter.convertAttributes(data.enumerateAttributes());
  Variables modelHeader = new Variables(attributes_);
  clusterVar_ = modelHeader.newMultinomialVariable("clusterVar", this.numberOfClusters());
  inferenceAlgorithm_ = new ImportanceSampling();
  inferenceAlgorithm_.setSeed(this.getSeed());
  dag = new DAG(modelHeader);
  /* Set DAG structure. */
  /* Add the hidden cluster variable as a parent of all the predictive attributes. */
  dag.getParentSets().stream()
  .filter(w -> w.getMainVar().getVarID() != clusterVar_.getVarID())
  .filter(w -> w.getMainVar().isObservable())
  .forEach(w -> w.addParent(clusterVar_));
  System.out.println(dag.toString());
  parameterLearningAlgorithm_ = new SVB();
  parameterLearningAlgorithm_.setDAG(dag);
  DataOnMemoryListContainer<DataInstance> batch_ = new DataOnMemoryListContainer(attributes_);
  data.stream().forEach(instance ->
      batch_.add(new DataInstanceFromDataRow(new DataRowWeka(instance, this.attributes_)))
  );
  parameterLearningAlgorithm_.setDataStream(batch_);
  parameterLearningAlgorithm_.initLearning();
  parameterLearningAlgorithm_.runLearning();
  bnModel_ = parameterLearningAlgorithm_.getLearntBayesianNetwork();
  System.out.println(bnModel_);
  inferenceAlgorithm_.setModel(bnModel_);
}

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

data.stream().forEach(instance ->
  batch_.add(new DataInstanceFromDataRow(new DataRowWeka(instance, this.attributes_)))
);

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

data.stream().forEach(instance ->
  batch_.add(new DataInstanceFromDataRow(new DataRowWeka(instance, this.attributes_)))
);

相关文章

Instances类方法