eu.amidst.core.variables.Variables.setAttributes()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(110)

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

Variables.setAttributes介绍

暂无

代码示例

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

try {
  dagLearned = (BNConverterToAMIDST.convertToAmidst(huginNetwork)).getDAG();
  dagLearned.getVariables().setAttributes(dataStream.getAttributes());
} catch (ExceptionHugin exceptionHugin) {
  System.out.println("ParallelTan LearnDAG Error 6");

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

public static void baseTest(ExecutionEnvironment env, DataStream<DataInstance> data, BayesianNetwork network, int batchSize, double error) throws IOException, ClassNotFoundException {
  DataStreamWriter.writeDataToFile(data, "./datasets/simulated/tmp.arff");
  DataFlink<DataInstance> dataFlink = DataFlinkLoader.loadDataFromFile(env, "./datasets/simulated/tmp.arff", false);
  network.getDAG().getVariables().setAttributes(dataFlink.getAttributes());
  //Structure learning is excluded from the test, i.e., we use directly the initial Asia network structure
  // and just learn then test the parameter learning
  //Parameter Learning
  dVMP parallelVB = new dVMP();
  parallelVB.setOutput(true);
  parallelVB.setMaximumGlobalIterations(10);
  parallelVB.setSeed(5);
  parallelVB.setBatchSize(batchSize);
  parallelVB.setLocalThreshold(0.001);
  parallelVB.setGlobalThreshold(0.01);
  parallelVB.setMaximumLocalIterations(100);
  parallelVB.setMaximumGlobalIterations(100);
  parallelVB.setDAG(network.getDAG());
  parallelVB.initLearning();
  parallelVB.updateModel(dataFlink);
  BayesianNetwork bnet = parallelVB.getLearntBayesianNetwork();
  //Check if the probability distributions of each node
  for (Variable var : network.getVariables()) {
    if (Main.VERBOSE) System.out.println("\n------ Variable " + var.getName() + " ------");
    if (Main.VERBOSE) System.out.println("\nTrue distribution:\n" + network.getConditionalDistribution(var));
    if (Main.VERBOSE) System.out.println("\nLearned distribution:\n" + bnet.getConditionalDistribution(var));
    Assert.assertTrue(bnet.getConditionalDistribution(var).equalDist(network.getConditionalDistribution(var), error));
  }
  //Or check directly if the true and learned networks are equals
  Assert.assertTrue(bnet.equalBNs(network, error));
}

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

dagLearned.getVariables().setAttributes(dataStream.getAttributes());
  return dagLearned;
} catch (ExceptionHugin exceptionHugin) {

相关文章