@Override public double getPosteriorSampleSize() { double sum = 0; for (Variable variable : this.nonReplicatedVariablesList) { sum+=this.ef_learningmodel.getDistribution(variable).getNaturalParameters().sum(); } return sum; } }
/** * {@inheritDoc} */ @Override public BayesianNetwork getLearntBayesianNetwork() { //Normalize the sufficient statistics SufficientStatistics normalizedSS = efBayesianNetwork.createZeroSufficientStatistics(); normalizedSS.copy(sumSS); normalizedSS.divideBy(numInstances); efBayesianNetwork.setMomentParameters(normalizedSS); return efBayesianNetwork.toBayesianNetwork(dag); }
public double[][] getLambdaNaturalParameters(){ double[][] out = new double[this.ef_TExpQ.length][maxsize]; for (int i = 0; i < out.length; i++) { for (int j = 0; j < out[i].length; j++) { out[i][j] = this.ef_TExpQ[i][j].getNaturalParameters().get(0); } } return out; }
public void initLearning() { efBayesianNetwork = new EF_BayesianNetwork(dag); sumSS = efBayesianNetwork.createInitSufficientStatistics(); }
private static Iterable<SufficientStatistics> sufficientStatisticsMap(Iterator<DataInstance> iter, EF_BayesianNetwork ef_bayesianNetwork) { SufficientStatistics accumulator = null; if (iter.hasNext()) accumulator = ef_bayesianNetwork.getSufficientStatistics(iter.next());; while (iter.hasNext()) { accumulator.sum(ef_bayesianNetwork.getSufficientStatistics(iter.next())); } // FIXME: Is this really necessary? ArrayList<SufficientStatistics> result = new ArrayList<SufficientStatistics>(); result.add(accumulator); return result; }
@Override public SufficientStatistics reduce(SufficientStatistics value1, SufficientStatistics value2) throws Exception { value2.sum(value1); return value2; }
public double[][] getLambdaMomentParameters(){ double[][] out = new double[this.ef_TExpQ.length][maxsize]; for (int i = 0; i < out.length; i++) { for (int j = 0; j < out[i].length; j++) { out[i][j] = this.ef_TExpQ[i][j].getMomentParameters().get(0); } } return out; }
public void setUpperInterval(double val) { this.ef_TExpP.setUpperInterval(val); } public void setLowerInterval(double val) {
public void setLowerInterval(double val) { this.ef_TExpP.setLowerInterval(val); } int maxsize = 0;
/** * {@inheritDoc} */ @Override public int sizeOfSufficientStatistics() { return this.bayesianNetworkTimeT.sizeOfSufficientStatistics() + this.bayesianNetworkTime0.sizeOfSufficientStatistics(); }
/** * {@inheritDoc} */ @Override public BayesianNetwork getLearntBayesianNetwork() { //Normalize the sufficient statistics SufficientStatistics normalizedSS = efBayesianNetwork.createZeroSufficientStatistics(); normalizedSS.copy(sumSS); normalizedSS.divideBy(numInstances); efBayesianNetwork.setMomentParameters(normalizedSS); return efBayesianNetwork.toBayesianNetwork(dag); }
public void initLearning() { efBayesianNetwork = new EF_BayesianNetwork(dag); sumSS = efBayesianNetwork.createInitSufficientStatistics(); }
@Override public SufficientStatistics reduce(SufficientStatistics value1, SufficientStatistics value2) throws Exception { value2.sum(value1); return value2; }
public double[] getLambdaNaturalParameters(){ double[] out = new double[this.prior.getNumberOfBaseVectors()]; for (int i = 0; i < out.length; i++) { out[i] = this.ef_TExpQ[i].getNaturalParameters().get(0); } return out; }
public double[] getLambdaMomentParameters(){ double[] out = new double[this.prior.getNumberOfBaseVectors()]; for (int i = 0; i < out.length; i++) { out[i] = this.ef_TExpQ[i].getMomentParameters().get(0); } return out; }
public void setUpperInterval(double val) { this.ef_TExpP.setUpperInterval(val); } public void setLowerInterval(double val) {
public void setLowerInterval(double val) { this.ef_TExpP.setLowerInterval(val); }
/** * {@inheritDoc} */ @Override public BayesianNetwork getLearntBayesianNetwork() { //Normalize the sufficient statistics SufficientStatistics normalizedSS = efBayesianNetwork.createZeroSufficientStatistics(); normalizedSS.copy(sumSS); normalizedSS.divideBy(numInstances); efBayesianNetwork.setMomentParameters(normalizedSS); return efBayesianNetwork.toBayesianNetwork(dag); }
public void initLearning() { efBayesianNetwork = new EF_BayesianNetwork(dag); sumSS = efBayesianNetwork.createInitSufficientStatistics(); }
private static SufficientStatistics sufficientStatisticsReduce(SufficientStatistics sta1, SufficientStatistics sta2) { sta1.sum(sta2); return sta1; }